1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

8441 commits

Author SHA1 Message Date
Dj
ad82918f56
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-08 09:28:10 +05:30
Geert-Jan Zwiers
84ef26ac9b
refactor(cli/tools): move flag and config logic to CliOptions (#17008)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-07 15:22:09 -05:00
Bartek Iwańczuk
fac6447815
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-07 17:25:34 +01:00
Chengzhong Wu
82e930726e
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-06 22:37:42 +01:00
David Sherret
d1cdf65b10
fix(npm): handle declaration file resolution where packages incorrectly define "types" last in "exports" (#17290)
Closes #17279
2023-01-06 12:57:52 -05:00
David Sherret
7db729a42d
fix(npm): support old packages and registries with no integrity, but with a sha1sum (#17289)
Closes #17281
2023-01-06 11:36:12 -05:00
Jun Jiang
f26700862a
chore: upgrade tokio to 1.24.0 (#17271) 2023-01-06 16:37:23 +01:00
David Sherret
3e72241fda
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-06 09:13:21 -05:00
David Sherret
c9b0d2709b
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-06 08:48:56 -05:00
Kenta Moriuchi
ff89ff4abb
perf(ext,runtime): remove using SafeArrayIterator from for-of (#17255) 2023-01-06 21:45:23 +09:00
Doni Rubiagatra
39cbaa6d34
fix(cli): uninstall command accept short flags (#17259) 2023-01-06 02:09:39 +00:00
Yiyu Lin
896dd56b7a
refactor(cli,core,ext,rt): remove some unnecessary clone or malloc (#17274) 2023-01-05 14:29:50 -05:00
Geert-Jan Zwiers
4e6b78cb43
refactor(cli): clean up clones (#17268) 2023-01-05 12:33:09 -05:00
denobot
fa271b70db
chore: forward v1.29.2 release commit to main (#17277)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-05 16:48:19 +01:00
David Sherret
0ee64ad847
fix: upgrade deno_ast to 0.23 (#17269)
Closes #17172
Closes #15669
Closes #8529
2023-01-04 18:54:54 -05:00
Yiyu Lin
319f607476
chore(cli,ext,rt): remove some unnecessary clone or malloc (#17261) 2023-01-04 13:20:36 +01:00
Yiyu Lin
2da882137e
docs(cli): do not need gen doc for cli (#17260) 2023-01-04 13:19:58 +01:00
Asher Gomez
e010eb69c2
chore(CI): update to actions/cache@v3 (#17201) 2023-01-04 15:05:38 +09:00
Asher Gomez
1b001d1b18
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-03 21:50:14 +01:00
Geert-Jan Zwiers
deed07e1d9
chore: resolve clippy errors in windows build (#17215) 2023-01-03 15:04:02 -05:00
Bartek Iwańczuk
c1ffd3d2cb
fix(lsp): don't error if completionItem/resolve request fails (#17250) 2023-01-03 18:13:21 +01:00
Bartek Iwańczuk
7a5b6a3261
fix(permissions): fix italic font in permission prompt (#17249) 2023-01-03 17:30:15 +01:00
Fenix
501472f06b
fix(cli): bundle command support shebang file (#17113) 2023-01-03 16:19:28 +00:00
Leo Kettmeir
7716449d41
fix(lsp): treat empty string config value as None (#17227)
Fixes #14630
2023-01-03 16:59:48 +01:00
David Sherret
421ec90a8e
fix(declaration): change Deno.open example to not use Deno.close(rid) (#17218) 2023-01-03 10:48:03 -05:00
Geert-Jan Zwiers
8a9f5c152e
refactor(lsp): reduce number of clones (#17254)
This PR optimizes the code in the language server by performing less
cloning of data.
2023-01-03 11:41:50 +01:00
David Sherret
10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
Geert-Jan Zwiers
f729576b2d
refactor: cleanup redundant call (#17226) 2022-12-30 20:04:17 -08:00
Bartek Iwańczuk
98bbf87742
fix(lsp): less agressive completion triggers (#17225)
Closes https://github.com/denoland/deno/issues/17056
Closes https://github.com/denoland/deno/issues/17055
2022-12-30 14:11:50 +01:00
Bartek Iwańczuk
218d7ab778
fix(lsp): completions for private variables (#17220) 2022-12-29 22:22:47 +01:00
Bartek Iwańczuk
ef5f8cd265
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.
2022-12-29 21:07:09 +01:00
Kamil Ogórek
65ea554afe
fix(node): Add op_node_unstable_os_uptime to allow for node interop (#17208) 2022-12-28 14:56:05 +01:00
Kamil Ogórek
8bdf66c59c
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/
2022-12-28 11:42:04 +01:00
Bartek Iwańczuk
bece1ce057
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
2022-12-28 10:29:48 +01:00
Kamil Ogórek
7ce2b58bcf
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
2022-12-27 00:16:12 +01:00
Andreu Botella
a67fd3e23e
chore(core): Make OpCtx instances be realm-specific (#17174) 2022-12-26 17:00:13 +01:00
Ikko Ashimine
1a3665b612
chore(npm): fix typo in local.rs (#17186) 2022-12-26 17:24:25 +09:00
Bartek Iwańczuk
208c91b68f
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
2022-12-23 19:46:24 +01:00
Kamil Ogórek
2a61b5fdd4
fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164) 2022-12-23 17:39:14 +01:00
Geert-Jan Zwiers
e58cdbcb4b
fix: add missing verb in description (#17163) 2022-12-22 14:51:22 +01:00
Bartek Iwańczuk
a8d1ffa281
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)
```
2022-12-22 06:26:28 +01:00
Kenta Moriuchi
156fef9cea
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.
2022-12-22 02:54:38 +01:00
Bartek Iwańczuk
4258e06f87
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) >

```
2022-12-21 14:24:39 +01:00
Kamil Ogórek
6a47ffa4d3
fix(core): Do not print errors prop for non-AggregateError errors (#17123)
This commit fixes formatting of JSError with "errors" property. Before this
commit all instances of "Error" were treated as if they were "AggregateError"
if they had "errors" property. After this commit only actual instances of 
"AggregateError" are formatted in such a way, while instances of "Error"
that have "errors" property are formatted without showing details of "errors".
2022-12-21 01:18:49 +01:00
David Sherret
423474caa8
fix(lsp/format): language formatter used should be based on language id (#17148)
Closes #11897
2022-12-20 15:19:35 -05:00
Andreu Botella
fcca54d3ba
fix(core): Have custom errors be created in the right realm (#17050)
Although PR #16366 did not fully revert `deno_core`'s support for
realms, since `JsRealm` still existed after that, it did remove the
`ContextState` struct, originally introduced in #14734. This change made
`js_build_custom_error_cb`, among other properties, a per-runtime
callback, rather than per-realm, which cause a bug where errors thrown
from an op would always be constructed in the main realm, rather than in
the current one.

This change adds back `ContextState` to fix this bug, adds back the
`known_realms` field of `JsRuntimeState` (needed to be able to drop the
callback when snapshotting), and also relands #14750, which adds the
`js_realm_sync_ops` test for this bug that was removed in #16366.
2022-12-20 20:09:16 +01:00
Bartek Iwańczuk
748ce0a435
chore: update node compat layer to std@0.170.0 (#17147)
Fixed a performance regression for express server
2022-12-20 18:23:02 +01:00
David Sherret
8165cded14
fix: ignore local lockfile for deno install and uninstall (#17145)
Closes #17116
2022-12-20 12:00:57 -05:00
David Sherret
a06f59981b
fix(npm): resolve npm specifiers when root redirected (#17144)
Closes #17136
2022-12-20 11:40:26 -05:00
Ryan Dahl
400cd331fb
chore: bump deno_fetch and deno_http versions (#17124)
https://github.com/denoland/deno/pull/17081
https://github.com/denoland/deno/pull/17126
2022-12-20 04:54:27 -08:00