From 241fca6f4fca8644d5b99ab4b8d44bb49fc9835c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 9 Aug 2022 16:46:39 -0500 Subject: [PATCH] update Deno deps (*down-to* std@0.134.0; *pin*); avoid permission prompt(s) - revert to earlier deno::std library version without NODE_DEBUG permission prompts # [why] In the change from deno::std@0.134.0 to deno::std@0.135.0, a change was made to remove a top-level async permission query gate from the library, replacing it with a synchronous `try...catch`.[1] This was done to avoid unexpected module load order since the module with `await` will run at a time later than synchronous peers (although still prior to user code).[2,3] Unfortunately, the, now default, behavior of Deno is to prompt on use for permissions which aren't 'granted' or 'denied'. This leads to ugly UI/UX for scripts which try to control their logging and UI (as well as being confusing and unexpected for non-developer users). This UI/UX behavior is only avoidable if the script is run with the `--no-prompt` option flag or all needed permissions enabled, encouraging use of `--no-prompt` and, more problematically, `--allow-all`. As of 2022-08, with the current Deno (Deno v1.8.0+) and deno::std (deno::std@0.135.0+) library implementation, no work-around is possible due to: 1. being impossible to actually revoke a permission (`revoke` just "downgrade[s] a permission from 'granted' to 'prompt'); 2. the permission API has no synchronous functions making revocation impossible prior to a synchronous access (even if a polyfill patch via module was attempted). Reversion and pinning of deno::std to v0.134.0 avoids the patch changing from async gating to sync `try...catch` while still maintaining most of the functionality of later deno::std library versions. # refs [1] [fix(node): Make global.ts evaluate synchronously](https://github.com/denoland/deno_std/pull/2098) [2] [Execution order of imports in deno is unclear/unexpected](https://github.com/denoland/deno/issues/14243) [3] [std/node should avoid TLA](https://github.com/denoland/deno_std/issues/2097) ## related discussion/issues [Discussion ~ Bring back permission prompt behind a flag](https://github.com/denoland/deno/issues/3811) [Security prompt by default (instead of throw)](https://github.com/denoland/deno/issues/10183) [Seeking a better UX for permissions](https://github.com/denoland/deno/discussions/11061) [Design Meeting 2021-07-29 ~ `Prompt by default`](https://github.com/denoland/deno/discussions/11767) [permission prompt problems](https://github.com/denoland/deno/issues/11936) [`deno repl` has permissions by default?](https://github.com/denoland/deno/discussions/12665) [Bad UX with prompt by default](https://github.com/denoland/deno/issues/13730) [DENO_NO_PROMPT env var support](https://github.com/denoland/deno/issues/14208) [feat: Add DENO_NO_PROMPT variable](https://github.com/denoland/deno/pull/14209) [HowTO test that a module is *no-panic* and *no-prompt* when statically imported?](https://github.com/denoland/deno/discussions/15356) --- src/platform-adapters/deno.deno.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-adapters/deno.deno.ts b/src/platform-adapters/deno.deno.ts index fc84e15..f2e9944 100644 --- a/src/platform-adapters/deno.deno.ts +++ b/src/platform-adapters/deno.deno.ts @@ -2,7 +2,7 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -import * as path from 'https://deno.land/std@0.150.0/path/mod.ts'; +import * as path from 'https://deno.land/std@0.134.0/path/mod.ts'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import osPaths from 'https://deno.land/x/os_paths@v7.1.1/src/mod.deno.ts';