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

8448 commits

Author SHA1 Message Date
Nayeem Rahman
3545bff678 fix(watch): preserve ProcState::file_fetcher between restarts (#15466)
This commit changes "ProcState" to store "file_fetcher" field in an "Arc",
allowing it to be preserved between restarts and thus keeping the state
alive between the restarts. File watchers for "deno test" and "deno bench"
now reset "ProcState" between restarts.
2023-01-13 11:20:14 -05:00
Bartek Iwańczuk
aa79603674 fix(napi): handle static properties in classes (#17320)
Adds support for static properties when using "napi_define_class".
2023-01-13 11:20:14 -05:00
Bartek Iwańczuk
1c2db072b5 fix(npm): allow to read package.json if permissions are granted (#17209)
This commit changes signature of "deno_core::ModuleLoader::resolve" to pass
an enum indicating whether or not we're resolving a specifier for dynamic import.

Additionally "CliModuleLoader" was changes to store both "parent permissions" (or
"root permissions") as well as "dynamic permissions" that allow to check for permissions
in top-level module load an dynamic imports.

Then all code paths that have anything to do with Node/npm compat are now checking
for permissions which are passed from module loader instance associated with given
worker.
2023-01-13 11:20:14 -05:00
Marcos Casagrande
49b5ac947f fix(ext/web/streams): fix ReadableStream asyncIterator (#16276) 2023-01-13 11:20:14 -05:00
Geert-Jan Zwiers
fab10ea3e0 fix(cli/args): update value_name of inspect args to resolve broken completions (#17287)
This PR updates the name used in `clap::Arg::value_name` for the
`--inspect*` flags from `HOST:PORT` to `HOST_AND_PORT` because the
former causes an arguments error when using shell completions in the
`zsh` shell.
2023-01-13 11:20:13 -05:00
Leo Kettmeir
deefb3b40b feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-13 11:20:13 -05:00
David Sherret
1640f984fa fix(install): should always include --no-config in shim unless --config is specified (#17300)
Closes #17294
2023-01-13 11:20:13 -05:00
Dj
11b1e901ad feat(ext/ffi): structs by value (#15060)
Adds support for passing and returning structs as buffers to FFI. This does not implement fastapi support for structs. Needed for certain system APIs such as AppKit on macOS.
2023-01-13 11:20:13 -05:00
Geert-Jan Zwiers
941e28792c refactor(cli/tools): move flag and config logic to CliOptions (#17008)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-13 11:20:13 -05:00
Bartek Iwańczuk
ce8acee44d refactor(permissions): add PermissionsContainer struct for internal mutability (#17134)
Turns out we were cloning permissions which after prompting were discarded,
so the state of permissions was never preserved. To handle that we need to store
all permissions behind "Arc<Mutex<>>" (because there are situations where we
need to send them to other thread).

Testing and benching code still uses "Permissions" in most places - it's undesirable
to share the same permission set between various test/bench files - otherwise
granting or revoking permissions in one file would influence behavior of other test
files.
2023-01-13 11:20:12 -05:00
Chengzhong Wu
f7613eac84 fix(core): get v8 console from context extra bindings (#17243)
Explicitly get `console` object from V8 instead of relying on `console`
defined on the global object.
2023-01-13 11:20:12 -05:00
David Sherret
ab07129ee7 fix(npm): handle declaration file resolution where packages incorrectly define "types" last in "exports" (#17290)
Closes #17279
2023-01-13 11:20:12 -05:00
David Sherret
4289ba0f77 fix(npm): support old packages and registries with no integrity, but with a sha1sum (#17289)
Closes #17281
2023-01-13 11:20:12 -05:00
Jun Jiang
97a11a2503 chore: upgrade tokio to 1.24.0 (#17271) 2023-01-13 11:20:12 -05:00
David Sherret
14b7e9db08 fix(npm): reduce copy packages when resolving optional peer dependencies (#17280)
If an optional peer dependency entry previously wasn't resolved and it's
now being resolved, then it will add it as if it were a dependency of
the previously resolved package instead of creating a new "copy package"
(seems to be what npm and pnpm does).

Closes #17240
2023-01-13 11:20:12 -05:00
David Sherret
27f6feebd9 fix(npm): panic resolving some dependencies with dist tags (#17278)
This would only occur if a dist tag for a package was resolved more than
once.

Closes #17275
2023-01-13 11:20:11 -05:00
Kenta Moriuchi
32d66b7425 perf(ext,runtime): remove using SafeArrayIterator from for-of (#17255) 2023-01-13 11:20:11 -05:00
Doni Rubiagatra
c56477654f fix(cli): uninstall command accept short flags (#17259) 2023-01-13 11:20:11 -05:00
Yiyu Lin
b72d244bbd refactor(cli,core,ext,rt): remove some unnecessary clone or malloc (#17274) 2023-01-13 11:20:11 -05:00
Geert-Jan Zwiers
dd05c3b70d refactor(cli): clean up clones (#17268) 2023-01-13 11:20:11 -05:00
denobot
14c4c8f934
1.29.2 (#17276)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-05 14:37:23 +01:00
David Sherret
f1ff5edc42
fix: upgrade deno_ast to 0.23 (#17269)
Closes #17172
Closes #15669
Closes #8529
2023-01-05 13:06:22 +01:00
Yiyu Lin
d5ed8a0a9f
chore(cli,ext,rt): remove some unnecessary clone or malloc (#17261) 2023-01-05 13:06:22 +01:00
Yiyu Lin
4820ed9b58
docs(cli): do not need gen doc for cli (#17260) 2023-01-05 13:06:21 +01:00
Asher Gomez
a162f5ef54
chore(CI): update to actions/cache@v3 (#17201) 2023-01-05 13:06:21 +01:00
Asher Gomez
63ca68d058
fix(permissions): process URL in Deno.FfiPermissionDescriptor.path for revoke() and request() (#17094)
Previously, `Deno.permissions.[revoke|request]()` wouldn't correctly
process the `path: URL` when `name` was `ffi`. This change fixes that
behaviour and adds a new function, `formDescriptor()`, to ensure `URL`
arguments are consistently handled across
`Deno.permissions.[query|revoke|request]()`.
2023-01-05 13:06:21 +01:00
Geert-Jan Zwiers
43e8b51316
chore: resolve clippy errors in windows build (#17215) 2023-01-05 13:06:21 +01:00
Bartek Iwańczuk
a012d731ee
fix(lsp): don't error if completionItem/resolve request fails (#17250) 2023-01-05 13:06:21 +01:00
Bartek Iwańczuk
7177768e49
fix(permissions): fix italic font in permission prompt (#17249) 2023-01-05 13:06:21 +01:00
Fenix
211a8b438a
fix(cli): bundle command support shebang file (#17113) 2023-01-05 13:06:21 +01:00
Leo Kettmeir
822173664e
fix(lsp): treat empty string config value as None (#17227)
Fixes #14630
2023-01-05 13:06:20 +01:00
David Sherret
76f30a1878
fix(declaration): change Deno.open example to not use Deno.close(rid) (#17218) 2023-01-05 13:05:50 +01:00
Geert-Jan Zwiers
1a61fe910c
refactor(lsp): reduce number of clones (#17254)
This PR optimizes the code in the language server by performing less
cloning of data.
2023-01-05 13:05:49 +01:00
David Sherret
2fee8394a9
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-05 13:05:49 +01:00
Geert-Jan Zwiers
287f46f0cd
refactor: cleanup redundant call (#17226) 2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
0904665f89
fix(lsp): less agressive completion triggers (#17225)
Closes https://github.com/denoland/deno/issues/17056
Closes https://github.com/denoland/deno/issues/17055
2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
b9768e2338
fix(lsp): completions for private variables (#17220) 2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
4a1a6b7985
fix(lsp): "Add all missing imports" uses correct specifiers (#17216)
This commit fixes "Add all missing imports" quick fix; before
it was replacing all occurrences with the same specifier. Now
every line returned from TSC is processed individually.
2023-01-05 13:05:49 +01:00
Kamil Ogórek
203b5a4822
fix(node): Add op_node_unstable_os_uptime to allow for node interop (#17208) 2023-01-05 13:05:48 +01:00
Kamil Ogórek
5c9e7662d7
fix(ext/net): Remove unstable check from op_node_unstable_net_listen_udp (#17207)
The whole point of creating this alternative operation was to allow
usage in node, without `--unstable` flag.
Introduced and I believe missed in
https://github.com/denoland/deno/pull/16520/
2023-01-05 13:05:48 +01:00
Bartek Iwańczuk
2b15b07753
feat(unstable): Add Deno.Conn.ref()/unref() (#17170)
This commit adds "Deno.Conn.ref()" and "Deno.Conn.unref()" methods.

These methods can be used to make connection block or not block the
event loop from finishing. Refing/unrefing only influences "read" 
operations - ie. scheduling writes to a connection _do_ keep event 
loop alive.

Required for https://github.com/denoland/deno/issues/16710
2023-01-05 13:05:48 +01:00
Kamil Ogórek
3baf1a4bd3
feat(unstable): Add "Deno.osUptime()" API (#17179)
This PR adds support for `Deno.osUptime` which reports number of seconds
since os was booted. It will allow us to be compatible with Node's `os.uptime` -
https://nodejs.org/api/os.html#osuptime

Partially based on
https://docs.rs/uptime_lib/latest/src/uptime_lib/lib.rs.html
2023-01-05 13:05:48 +01:00
Andreu Botella
1e857bc03c
chore(core): Make OpCtx instances be realm-specific (#17174) 2023-01-05 13:05:17 +01:00
Ikko Ashimine
d560fd7b11
chore(npm): fix typo in local.rs (#17186) 2023-01-05 13:05:17 +01:00
Bartek Iwańczuk
127b68df39
fix(core): run macrotasks and next ticks after polling dynamic imports (#17173)
This commit fixes handling of rejected promises in dynamic imports
evaluation.

Previously we were running callbacks for next ticks and macrotasks
_before_ polling
dynamic imports and checked for unhandled rejections immediately after.
This is wrong,
as `unhandledrejection` event is dispatched and its callbacks are run as
macrotasks.

This commit changes order of actions performed by the event loop to
following:
- poll async ops
- poll dynamic imports
- run next tick callbacks
- run macrotask callbacks
- check for unhandled promise rejections
2023-01-05 13:05:16 +01:00
Kamil Ogórek
36a936c5aa
fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164) 2023-01-05 13:05:16 +01:00
Geert-Jan Zwiers
859913c484
fix: add missing verb in description (#17163) 2023-01-05 13:05:16 +01:00
Bartek Iwańczuk
10ad562b90
fix: rejected dynamic import should retain error context (#17160)
Found this while debugging
https://github.com/denoland/deno/issues/16280.

Before:
```
TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'.
    at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17)
    at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59)
    at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39)
    at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43)
```

After:
```
TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'.
  Caused by: 
    Reading /Users/ib/dev/test_rollup/mocha/package.json is not allowed
    at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17)
    at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59)
    at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39)
    at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43)
```
2023-01-05 13:05:16 +01:00
Kenta Moriuchi
b1cee59fcb
fix(ext): Add checks for owning properties in for-in loops (#17139)
In the for-in loops, there were a few places where we forgot to check if
objects owned some properties, so I added them.
2023-01-05 13:05:16 +01:00
Bartek Iwańczuk
ee39fb2f27
fix(permissions): add information about import() API request (#17149)
This commit changes permission prompt to show that "import()" API
is requesting permissions.

Given "dynamic_import.js" like so:
```
import("https://deno.land/std@0.170.0/version.ts");
```

Before:
```
deno run dynamic_import.js
⚠️  ┌ Deno requests net access to "deno.land".
   ├ Run again with --allow-net to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) > 

```

After:
```
deno run dynamic_import.js
⚠️  ┌ Deno requests net access to "deno.land".
   ├ Requested by `import()` API
   ├ Run again with --allow-net to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) >

```
2023-01-05 13:05:16 +01:00