profile
viewpoint
Nayeem Rahman nayeemrmn London, UK Contributing to @denoland. Interested in Rust and Typescript.

nayeemrmn/deno 0

A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio

nayeemrmn/deno_install 0

Deno Binary Installer

nayeemrmn/deno_std 0

deno standard modules

nayeemrmn/deno_website2 0

deno.land website

nayeemrmn/discord-open-source 0

List of open source communities living on Discord

nayeemrmn/event-type 0

A general purpose, promise based event system.

nayeemrmn/glob-to-regexp 0

Convert glob strings to regular expressions.

nayeemrmn/hello 0

A C library I use to store a Makefile.

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha a553f6c41ee3d6f250d0ac1b29d0c02d92037956

fixup! refactor: Simplify globrex()

view details

push time in 36 minutes

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 43ed85d67525c565b9bbf4e5ee7bfabd104869f0

refactor: Simplify globrex()

view details

push time in an hour

Pull request review commentdenoland/deno

feat: custom http client for fetch

 declare namespace Deno {    * The pid of the current process's parent.    */   export const ppid: number;++  /** **UNSTABLE**: New API, yet to be vetted.+   * A custom HttpClient for use with `fetch`.+   * +   * ```ts+   * const client = new Deno.createHttpClient({ caFile: "./ca.pem" });+   * const req = await fetch("https://myserver.com", { client });+   * ```+   */+  export class HttpClient {+    rid: number;+    constructor(rid: number);

The constructor can be excluded from the public interface: https://github.com/denoland/deno/blob/55ea9c7e856cae5471fea309d9dc40444581c3ae/cli/dts/lib.deno.ns.d.ts#L1850-L1851

lucacasonato

comment created time in an hour

issue commentdenoland/deno_website2

[Discussion] Modules that can break other modules.

@jsejcksn There's some discussion here: https://github.com/denoland/deno/issues/6723.

andreespirela

comment created time in 5 hours

pull request commentdenoland/deno

feat(doc): Add detailed flag

My experience with deno doc | less -r is that I run it with the intention of being shown a huge wall of text either way, which I can easily filter using search (/Deno.ListenOptions). And then I get to the interface I was trying to lookup only to see nothing below it. I have to quit and re-enter deno doc --builtin Deno.ListenOptions. Why is "relevant information" defined as this opinionated overview?

The command should just print out a complete doc and leave the rest to external tools. For large docs like the built-ins, I have to use search either way. For small docs, it may as well just show everything. I would suggest an --overview flag instead but honestly don't see the point.

SyrupThinker

comment created time in 7 hours

created tagnayeemrmn/glob-to-regexp

tagv0.2.1

Convert glob strings to regular expressions.

created time in 18 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha b650283c0dc1ad51f944c8575ad034c7a348e31a

v0.2.1

view details

push time in 18 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 84520177f5e188402811196ae97a462697ea9297

refactor: Remove unused options and result fields from globrex()

view details

Nayeem Rahman

commit sha 445631c4ac1783efd8b7fb17110214b72e9b2bba

fix: Don't match path separators in wildcards

view details

Nayeem Rahman

commit sha 05910308dfd0c9e1d03682c163fda95bda50a6ac

fix: Remove extraneous slashes from generated regex

view details

Nayeem Rahman

commit sha a119c29bd1879c241fff73f8784ed2a82523f25e

refactor: Rewrite globrex() tests

view details

push time in 18 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 984f4113d7299a66c539305f90713e64648f47a1

fixup! refactor: Remove unused options and result fields from globrex()

view details

push time in 18 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 30988446fec82ca2dc270dba6f38587b197ef482

refactor: Rewrite globrex() tests

view details

push time in 18 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 023b491616a49dc1710b96f212fb90c1ff989cf2

fix: Remove extraneous slashes from generated regex

view details

push time in 19 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 182d3e077e4844d59fc392643a8c1f5dbc559a52

fix: Don't match path separators in wildcards

view details

push time in 19 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha d14a9491a38032c01f8eb1278892c35142b5b0ed

fixup! refactor: Remove unused options and result fields from globrex()

view details

push time in 19 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 5489d106afc136d5b85ab3e8cf0bfc0f9bbc9af7

fixup! refactor: Remove unused options and result fields from globrex()

view details

push time in 19 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 6bde0cb205381bcf469307d56c192a81ccf1c7c7

refactor: Remove unused options and result fields from globrex()

view details

push time in 19 hours

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha cab343a13a3e45bc25aecda8982bafac6893402c

fix: Correct example in README

view details

push time in 21 hours

issue commentdenoland/deno

deno install/run parity

@JayHelton No, go ahead! This needs to be part of the minor release on the 13th, I'm guessing there'll be one more patch release in between before this change can land.

fsenart

comment created time in a day

issue commentdenoland/deno

Add a way to dynamically import the same module multiple times

There is a workaround about it. We can add a query parameter to file path like this:

mod = await import(`./mod.ts?foo=${anyRandomlyGeneratedString}`);

and it will be loaded again and we get a new its version. But the problem is that BOTH versions of this module will exist in the cache, I suppose. That's not cool.

@lem0nify Instead of changing the query string, you can change the hash. When you do this the new cached code replaces the old. However it will not cause remote dependencies to be re-downloaded. Only recompiled (if the source is local and changed) and re-executed. Does that meet your needs?

lem0nify

comment created time in a day

issue openedswc-project/swc

strip: Parentheses around computed constructors are not preserved

Input code

new (eval("Date"))();

Output code

new eval("Date")();
Uncaught TypeError: eval is not a constructor

Seen in https://github.com/denoland/deno/blob/v1.2.2/std/node/_util/_util_types_test.ts#L197

cc @bartlomieju

created time in a day

issue openedswc-project/swc

strip: Class fields should be assigned after parameter properties

Input code

TypeScript allows regular class fields to depend on parameter properties:

class A {
  b = this.a;
  constructor(public a: any) {}
}

Output code (actual) The regular class field b is incorrectly initialised before the parameter property a:

class A {
    b = this.a;
    constructor(a){
        this.a = a;
    }
}

Output code (expected) The correct ordering is, parameter property assignment -> class field initialisation -> rest of the constructor. So if there are parameter properties present, the class field initialisation must be moved below their assignments in the constructor:

class A {
    constructor(a) {
        this.a = a;
        this.b = this.a;
    }
}

This is the official compiler's output.


Seen in https://github.com/denoland/deno/blob/v1.2.2/std/mime/multipart.ts#L263-L271

cc @bartlomieju

created time in a day

push eventnayeemrmn/deno

Bartek Iwańczuk

commit sha d54d4d21bddf0fe80a6f534ec945c655595c5f71

upgrade: swc_ecmascript (#6943)

view details

Luca Casonato

commit sha 9d50c5c1a6fbe6895b6a63dadcba7bacaf9dd578

feat: hash file names in gen cache (#6911)

view details

push time in a day

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha b53caab1c5a024de2a634edb7663a4b504fed3c3

v0.2.0

view details

push time in 2 days

created tagnayeemrmn/glob-to-regexp

tagv0.2.0

Convert glob strings to regular expressions.

created time in 2 days

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha a7366d2ccbb7a9acc8f14073780b275ac5de3c16

feat: Add GlobToRegExpOptions::os

view details

push time in 2 days

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha ba905e62b808b169b837d4a6ffa7e9ab97734de8

feat: Add GlobToRegExpOptions::os

view details

push time in 2 days

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha 18ee0fc5744d2009c80c045dba40c6a6f7a51a2f

Add GlobToRegExpOptions::os

view details

push time in 2 days

push eventnayeemrmn/glob-to-regexp

Nayeem Rahman

commit sha a67db5c8c92c204dc9a9ea08dfdc174718ba78a1

Add GlobToRegExpOptions::os

view details

push time in 2 days

created tagnayeemrmn/glob-to-regexp

tagv0.1.0

Convert glob strings to regular expressions.

created time in 2 days

create barnchnayeemrmn/glob-to-regexp

branch : main

created branch time in 2 days

created repositorynayeemrmn/glob-to-regexp

Convert glob strings to regular expressions.

created time in 2 days

issue openedswc-project/swc

strip: Constructor assignment fields are written before super()

Input code

class A extends Object {
  constructor(public a, private b) {
    super();
  }
}

Output code

class A extends Object {
    constructor(a, b){
        this.a = a;
        this.b = b;
        super();
    }
}

The constructor at runtime:

Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor

Seen in https://github.com/denoland/deno/blob/v1.2.2/std/io/bufio.ts.

cc @bartlomieju

created time in 2 days

push eventnayeemrmn/deno

Bartek Iwańczuk

commit sha b718e6ff53156a0aae486e570ce7c9cb8a3b822a

upgrade: deno_lint, dprint, swc (#6928) This commit upgrades: deno_lint 0.1.20 dprint-plugin-typescript 0.25.0 swc_ecmascript 0.1.0 SWC is no longer reexported from dprint nor deno_lint.

view details

Ryan Dahl

commit sha 7446230e6b39a0d3ce70b8fffbed3ebc63e8c762

v1.2.2

view details

push time in 3 days

issue commentdenoland/deno

Question: install scripts with external assets

https://github.com/axetroy/deno_pkger

swwind

comment created time in 3 days

issue commentdenoland/deno

Failed to get directory listing

Duplicate of https://github.com/denoland/deno_website2/issues/433.

fauzan121002

comment created time in 3 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

I honestly didn't expect the breaking change to be such an issue. Now I regret not raising the issue myself much earlier, not that I could have known. But it seems like those pointing this out have no problem with the current names, so I hope to put a dent there at least.

While dirname() is non sensical to some, parent() is non sensical to others.

I forgot, I never really explained why I think the "directory" of a path referring to its parent is nonsensical:

import { dirname } from "https://deno.land/std@0.63.0/path/mod.ts";
const perfectlyValidPath = "/etc/passwd/foo";
console.log(Deno.statSync(dirname(perfectlyValidPath)).isDirectory); // false

Golang's doc even qualifies that the result is "typically" a directory. We can go back and forth about how that path is perhaps not actually valid even though it will never fail any of our path functions, but again... the correct term is right there for us to use. The "directory name" of a path which points to a directory is also a very iffy concept. I can't see this as a minor preference issue. We know all of the precedents for the current names just took them from the same place. Rust seems to be the one of the few that thought up a consistent scheme for itself and respected its casing conventions. We should try to point the language in better directions where we can.

nayeemrmn

comment created time in 4 days

push eventnayeemrmn/deno

Luca Casonato

commit sha 4afb4b6e46de2ed536a3c9828d70d7799b5b6d03

feat: add $STD_VERSION replacement variable in docs (#6922)

view details

push time in 4 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

That is the residual issue. When we merged with master, we had a load of people up in arms, because they were on 1.1.3 and their dependency was using std from master, which then was breaking.

We got these issues all of the time when we made even additive changes to the Deno namespace that were used in std, some recent, they weren't that problematic. Not many popular modules are using implicit versions anymore. (From what I've heard, imports like this are going away anyway.)

The reason it's so different when its caused by the built-in API (an implicit peer dependency of everything you've imported!) is because now a very specific alignment needs to be struck between what versions of modules you're importing and what version of Deno all of you are using. Most people's complaints had something to do with their Deno version. I maintain that this change to a versioned userspace library would not be the same at all.

I know it would break the main branch of oak

deno info https://raw.githubusercontent.com/oakserver/oak/main/deps.ts doesn't show me any implicit master imports. By "break" do you mean having to update your own std/path import symbols once you opt into upgrading std? That's expected of v0... it has no similarity to the 1.2.0 incident.

nayeemrmn

comment created time in 5 days

push eventnayeemrmn/deno

Nayeem Rahman

commit sha 6e7208bec2911ac0d1729f334fc90bc50b8f9203

fix(cli/rt): Fix file URL to path conversion on Windows (#6920)

view details

push time in 5 days

delete branch nayeemrmn/deno

delete branch : from-file-url-builtin

delete time in 5 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

Also, this wouldn't be a minor breaking change, it would have significant impacts, and we originally thought correcting URL | string was a good idea and look at the impact that had.

@kitsonk This is not at all the same as that...

That was a breaking change for a built-in, where upgrading a minor version of Deno broke the std module people were already using. This would have no effect without explicitly upgrading std and there's no transitive effect from an intermediary dependency updating it's version of std. Why are we v0 if it's too late to change anything?

nayeemrmn

comment created time in 5 days

issue commentdenoland/deno

deno install --no-check

In this case, --no-check should not only be forwarded to the written deno run command but also affect the pre-caching that is done as part of deno install.

fsenart

comment created time in 5 days

pull request commentdenoland/deno

ci: upload release snapshots automatically to Githubb artifacts

I don't want to add this. I think it's confusing to users. Those of us who are developing deno need to build it.

@ry Can we revisit this? It sounds like the problem was the use case of "users wanting to use unreleased features", but I don't think people will start doing that. All this does is create persistent links on the workflow pages to binaries built in CI. That's useful for debugging a red PR across platforms, without needing a dev setup on each machine.

axetroy

comment created time in 5 days

PR opened denoland/deno

fix(cli/rt/util): Fix file URL to path conversion on Windows

Changes to std/path - fromFileUrl():

  • fix: Remove drive letter support in posix.
  • fix: Return UNC paths for hostnames in win32.
  • fix: Throw for non-file URLs.

Makes some final fixes to fromFIleUrl() in std and aligns the built-in version with it. Fixes #6919.

+62 -40

0 comment

4 changed files

pr created time in 5 days

create barnchnayeemrmn/deno

branch : from-file-url-builtin

created branch time in 5 days

push eventnayeemrmn/deno

Divy Srivastava

commit sha 0da4779b178a0c97925c1ef5589d0f24a37f4501

feat(unstable): add "--ignore" flag to deno fmt (#6890)

view details

push time in 5 days

push eventnayeemrmn/deno

Kid

commit sha 391088c6ff531ac6714e9076eb62f2294793ccdd

docs(std/encoding): Fix TOML docs (#6912)

view details

zfx

commit sha 95597fc6e2ed9975c26eae77ba68ae42ca2c331a

fix(std/tar): directory type bug (#6905)

view details

push time in 5 days

Pull request review commentdenoland/deno

feat: custom http client for fetch

 declare namespace Deno {    * The pid of the current process's parent.    */   export const ppid: number;++  /** **UNSTABLE**: New API, yet to be vetted.+   * A custom HTTPClient for a fetch.+   * +   * ```ts+   * const client = new Deno.HTTPClient({ caFile: "./ca.pem" });+   * const req = await fetch("https://myserver.com", { client });+   */+  export class HTTPClient {+    rid: number;+    constructor(init: HTTPClientInit);

I just think it says something that, if it happened to be rely on an async op, you'd have to use a different language construct to represent it as opposed to just adding async/await here and there.

You're only supposed to do basic data stationing in constructors that doesn't mess with global state.

lucacasonato

comment created time in 5 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

What if we just broke completely here and introduced a path object with these new properties? effectively reimplementing Rust's std::path::Path

@caspervonb It doesn't work as well here due to the inferior conversion constructs in JS and the fact that it's not built-in. Primitives are easier to work with.

Parent... I'd never have guessed what that was.

Really? Parent path is a well-known and properly formed name. As in a parent node in any tree structure? There's a lot of things you have to be unfamiliar with for that to be strange, unless anything that isn't dirname() is un-guessable.

nayeemrmn

comment created time in 5 days

Pull request review commentdenoland/deno

feat: custom http client for fetch

 declare namespace Deno {    * The pid of the current process's parent.    */   export const ppid: number;++  /** **UNSTABLE**: New API, yet to be vetted.+   * A custom HTTPClient for a fetch.+   * +   * ```ts+   * const client = new Deno.HTTPClient({ caFile: "./ca.pem" });+   * const req = await fetch("https://myserver.com", { client });+   */+  export class HTTPClient {
  export class HttpClient {
lucacasonato

comment created time in 5 days

Pull request review commentdenoland/deno

feat: custom http client for fetch

 declare namespace Deno {    * The pid of the current process's parent.    */   export const ppid: number;++  /** **UNSTABLE**: New API, yet to be vetted.+   * A custom HTTPClient for a fetch.+   * +   * ```ts+   * const client = new Deno.HTTPClient({ caFile: "./ca.pem" });+   * const req = await fetch("https://myserver.com", { client });+   */+  export class HTTPClient {+    rid: number;+    constructor(init: HTTPClientInit);

Wouldn't the more consistent API be Deno.createHttpClient() as opposed to a constructor? E.g. Deno.run(). It's not the best thing to allocate resources in constructors.

Deno.createHttpClient(options: Deno.CreateHttpClientOptions);
lucacasonato

comment created time in 5 days

Pull request review commentdenoland/deno

feat: custom http client for fetch

       method,       url,       headers: headerArray,+      // eslint-disable-next-line @typescript-eslint/camelcase+      client_rid: clientRid,

See above.

lucacasonato

comment created time in 5 days

Pull request review commentdenoland/deno

feat: custom http client for fetch

 use futures::future::FutureExt; use http::header::HeaderName; use http::header::HeaderValue; use http::Method;+use reqwest::Client; use std::convert::From;+use std::path::PathBuf;  pub fn init(i: &mut CoreIsolate, s: &State) {   i.register_op("op_fetch", s.stateful_json_op2(op_fetch));+  i.register_op(+    "op_create_http_client",+    s.stateful_json_op2(op_create_http_client),+  ); }  #[derive(Deserialize)] struct FetchArgs {
#[serde(rename_all = "camelCase")]
struct FetchArgs {

Then you're allowed to call it clientRid on the JS side.

lucacasonato

comment created time in 5 days

Pull request review commentdenoland/deno

std/node/util: add inspect

 import * as types from "./_util/_util_types.ts";  export { types }; +export function inspect(object: unknown, ...opts: any) {+    return typeof object === "string" ? object : JSON.stringify(object)
    return Deno.inspect(object, {
      depth: opts.depth ?? 4,
      maxArrayLength: opts.iterableLimit ?? 100,
      compact: !!(opts.compact ?? true),
      sorted: !!(opts.sorted ?? false)
    });
balupton

comment created time in 5 days

issue commentdenoland/deno

[std/path] fromFileUrl does not decode spaces on Windows

@jsejcksn Thanks, I see the problem. The built-in file URL conversion assumes that Windows paths must have a drive letter: https://github.com/denoland/deno/blob/6afe7bbd395eb34febd25bda48c5cd82f0a4f8b3/cli/rt/06_util.js#L75-L80

It's separate from the one is std, can you open an issue? I'll get on it tomorrow if no one else has.

jsejcksn

comment created time in 6 days

issue commentdenoland/deno

[std/path] fromFileUrl does not decode spaces on Windows

@jsejcksn Can you provide a smaller test with simple actual/expected values for fromFileUrl()? It's harder to run that not being on Windows.

jsejcksn

comment created time in 6 days

pull request commentdenoland/deno

std/node/util: add inspect

@balupton It's Deno.inspect() and Deno.InspectOptions respectively.


Deno.inspect() differs from Node's in that it favours double quotes over single quotes for inspecting strings. I think that's okay for now, but could you also document it in the JSDoc?

balupton

comment created time in 6 days

delete branch nayeemrmn/deno

delete branch : from-file-url-decoding

delete time in 6 days

push eventnayeemrmn/deno

Nayeem Rahman

commit sha 6afe7bbd395eb34febd25bda48c5cd82f0a4f8b3

fix(std/path): Percent-decode in fromFileUrl() (#6913)

view details

push time in 6 days

PR opened denoland/deno

fix(std/path): Percent-decode in fromFileUrl()

Fixes #6892.

+9 -5

0 comment

3 changed files

pr created time in 6 days

create barnchnayeemrmn/deno

branch : from-file-url-decoding

created branch time in 6 days

push eventnayeemrmn/deno

Kitson Kelly

commit sha 076547fbbb52b1df9d6db36dd72353bffa9e4a8b

chore: use matches macro for bool matches (#6904)

view details

Ryan Dahl

commit sha b7942bf0f6f151e172db9b1e08cf4436e8365e8b

Change release build flags to optimize for size (#6907)

view details

Bartek Iwańczuk

commit sha 315efbc0e86d9d848efa4b889aefbc665508598a

fix: downcast from SwcDiagnosticBuffer to OpError (#6909)

view details

Bartek Iwańczuk

commit sha c6917133942c791480cd2aec7297b2a2ee623059

refactor: Use SWC to strip types for "--no-check" flag (#6895)

view details

Luca Casonato

commit sha 1b60840f286bc0203a3bd2900f67557a8ff2c3f6

feat(std/async): add pooledMap utility (#6898)

view details

push time in 6 days

pull request commentdenoland/deno

feat: add "--exclude" flag to deno fmt

@divy-work Sorry, I think we should go back to --ignore to match // deno-fmt-ignore. For deno test we can use --ignore-files, having both --ignore and --exclude would be confusing anyway.

divy-work

comment created time in 6 days

delete branch nayeemrmn/deno

delete branch : mux-async-iterator

delete time in 6 days

Pull request review commentdenoland/deno

feat(std/async): add asyncPool utility

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++/**+ * pooledMap transforms values from an (async) iterable into another async+ * iterable. The transforms are done concurrently, with a max concurrency+ * defined by the poolLimit.+ * + * @param poolLimit The maximum count of items being processed concurrently. + * @param array The input array for mapping.+ * @param iteratorFn The function to call for every item of the array.+ */+export function pooledMap<T, R>(+  poolLimit: number,+  array: Iterable<T> | AsyncIterable<T>,+  iteratorFn: (data: T) => Promise<R>,+): AsyncIterableIterator<R> {

Yeah, I just noticed that the loop body is unable to act on different elements at the same time, is that what you meant? There's no meaning in it returning an iterator then... the original definition was fine.

lucacasonato

comment created time in 7 days

Pull request review commentdenoland/deno

feat(std/async): add asyncPool utility

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++/**+ * pooledMap transforms values from an (async) iterable into another async+ * iterable. The transforms are done concurrently, with a max concurrency+ * defined by the poolLimit.+ * + * @param poolLimit The maximum count of items being processed concurrently. + * @param array The input array for mapping.+ * @param iteratorFn The function to call for every item of the array.+ */+export function pooledMap<T, R>(+  poolLimit: number,+  array: Iterable<T> | AsyncIterable<T>,+  iteratorFn: (data: T) => Promise<R>,+): AsyncIterableIterator<R> {

The point of using a generator is that there doesn't need to be a mapping function parameter anymore. That would go in the loop body. The function just yields the promised values in order, capping the amount run at once.

lucacasonato

comment created time in 7 days

issue commentdenoland/deno

Request: Separate console functions from Standard Output

How/why is that clear? I expected console.log to write to stderr like every other command line tool on my computer.

We're talking about the expectations of the pre-existing server-side JS community, otherwise I would agree that a log function should probably write to stderr. But that would also be useless because there are other console functions which print to stderr.

The minor naming issue of console.log() is not a sufficient justification to change behaviour at this point.

KSXGitHub

comment created time in 7 days

push eventnayeemrmn/deno

Kitson Kelly

commit sha 076547fbbb52b1df9d6db36dd72353bffa9e4a8b

chore: use matches macro for bool matches (#6904)

view details

Nayeem Rahman

commit sha 6fad25f00189284406264e9c2e55595c4283cbeb

fixup! BREAKING refactor(std/path): Rename some symbols

view details

Nayeem Rahman

commit sha 96798a643560a1e6ff2b9ca4c56a4938dcd7bf63

Merge remote-tracking branch 'upstream/master' into std-path-rename

view details

push time in 7 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

These names come from Node's path module - so there is precedence. Is it really worth it to change?

@ry Yes, the current names are bad. dirname() to get the parent of the path is especially nonsensical. The casing inconsistency will become a problem when we want to add new things that don't share that precedence -- for example I think we should separate fileStem() from basename() rather than keeping the silly extension replacement thing. It's better to maintain consistency with the Rust APIs which are more well designed.

nayeemrmn

comment created time in 7 days

Pull request review commentdenoland/deno

feat(std/async): add asyncPool utility

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++// From https://github.com/rxaviers/async-pool/blob/master/lib/es7.js.+// Copyright (c) 2017 Rafael Xavier de Souza http://rafael.xavier.blog.br+// Licensed under MIT++/**+ * asyncPool is like Promise.all(array.map(async () => {...})), except that you+ * can specify the maximum amount of items being processed concurrently.+ * + * @param poolLimit The maximum count of items being processed concurrently. + * @param array The input array for mapping.+ * @param iteratorFn The function to call for every item of the array.+ */+export async function asyncPool<T, R>(+  poolLimit: number,+  array: T[],+  iteratorFn: (data: T) => Promise<R>,+): Promise<R[]> {

I was going to suggest that this be an async generator instead. Seeing https://github.com/rxaviers/async-pool#es7-async, it seems like that was the intention. We should do it here.

lucacasonato

comment created time in 8 days

issue commentdenoland/deno

Worker: Disable relative import specifiers

@aniketbiprojit It's about being analogous to the web. We don't have a globalThis.location yet so anything that's supposed to be relative to it should fail for now. Ref #4981.

nayeemrmn

comment created time in 8 days

Pull request review commentdenoland/deno

test(std/fs/writeJson): add test for append option

 // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.-import {-  assertEquals,-  assertThrowsAsync,-  assertThrows,-} from "../testing/asserts.ts"; import * as path from "../path/mod.ts";+import { assertEquals } from "../testing/asserts.ts"; import { writeJson, writeJsonSync } from "./write_json.ts";  const testdataDir = path.resolve("fs", "testdata");  Deno.test("writeJsonIfNotExists", async function (): Promise<void> {   const notExistsJsonFile = path.join(testdataDir, "file_not_exists.json"); -  await assertThrowsAsync(-    async (): Promise<void> => {-      await writeJson(notExistsJsonFile, { a: "1" });-      throw new Error("should write success");-    },-    Error,-    "should write success",-  );+  try {+    await writeJson(notExistsJsonFile, { a: "1" });+  } catch {+    // empty+  }

If you don't think any cleanup is happening, what do you think is the purpose of the Deno.remove statements that were in the tests?

Oops, I meant fault-tolerant cleanup.

jsejcksn

comment created time in 8 days

issue commentdenoland/deno

Question: install scripts with external assets

I think that issue is relative to mine, but load non-importable resources though import is not the only possible solution for mine.

For example, we can add a manifest file for deno install, which listed all the files which is required to install the script. Such as:

This is also a solution to #5987... the problems are tightly coupled. deno install just creates a shortcut script which invokes the deno run command for you. There's nothing that should only work for deno installed scripts.

swwind

comment created time in 8 days

Pull request review commentdenoland/deno

test(std/fs/writeJson): add test for append option

 // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.-import {-  assertEquals,-  assertThrowsAsync,-  assertThrows,-} from "../testing/asserts.ts"; import * as path from "../path/mod.ts";+import { assertEquals } from "../testing/asserts.ts"; import { writeJson, writeJsonSync } from "./write_json.ts";  const testdataDir = path.resolve("fs", "testdata");  Deno.test("writeJsonIfNotExists", async function (): Promise<void> {   const notExistsJsonFile = path.join(testdataDir, "file_not_exists.json"); -  await assertThrowsAsync(-    async (): Promise<void> => {-      await writeJson(notExistsJsonFile, { a: "1" });-      throw new Error("should write success");-    },-    Error,-    "should write success",-  );+  try {+    await writeJson(notExistsJsonFile, { a: "1" });+  } catch {+    // empty+  }

but don't stop the test if it throws

That wasn't the previous behaviour. If writeJson() failed, the containing assertThrows() would fail because it wouldn't have the correct error message. I don't think any of these is doing any cleanup or you'd see a try/finally.

jsejcksn

comment created time in 8 days

PR opened denoland/deno

BREAKING refactor(std/path): Rename some symbols
  • basename() -> fileName()
  • dirname() -> parent()
  • extname() -> extension()
  • sep -> separator

Closes #6829. Uses Rust names for functions.

Refs:

  • https://doc.rust-lang.org/std/path/struct.Path.html
  • https://en.cppreference.com/w/cpp/filesystem/path
+206 -205

0 comment

24 changed files

pr created time in 8 days

create barnchnayeemrmn/deno

branch : std-path-rename

created branch time in 8 days

pull request commentdenoland/deno

feat: add "--ignore" flag to deno fmt

I wonder if we should go with --exclude. The ignore name is used for something slightly different for deno test -- it might be confusing when we bring this over there.

divy-work

comment created time in 8 days

Pull request review commentdenoland/deno

feat: add "--ignore" flag to deno fmt

 const BOM_CHAR: char = '\u{FEFF}'; /// /// First argument supports globs, and if it is `None` /// then the current directory is recursively walked.-pub async fn format(args: Vec<String>, check: bool) -> Result<(), ErrBox> {+pub async fn format(+  args: Vec<String>,+  check: bool,+  ignore: Vec<String>,+) -> Result<(), ErrBox> {   if args.len() == 1 && args[0] == "-" {     return format_stdin(check);   }--  let target_files = collect_files(args)?;-+  let mut target_files = collect_files(args)?;+  if !ignore.is_empty() {+    let ignore_files = collect_files(ignore)?;+    target_files.retain(|f| !ignore_files.contains(&f));+  }

So the filtering is only for files and not parent folders as the folders content are resolved to its files.

So deno fmt --ignore=./node_modules/ won't work, then? That probably needs to be fixed since ignoring by directory is a big use case.

divy-work

comment created time in 8 days

push eventnayeemrmn/deno

迷渡

commit sha 836ce3a9a6e050cae50593de65f17772af01b65d

chore: mark typescript.js and type definitions as vendored (#6863)

view details

Ryan Dahl

commit sha 25a0ad3e16e767d58b1315e9d12a236ea36c5998

v1.2.1

view details

Ryan Dahl

commit sha f162ced76aa475a20a17411510d185c994a25425

Remove deno_typescript references from ci (#6866)

view details

Bartek Iwańczuk

commit sha b45f9a7357fad1d13c2fbffa5e419e064a3aa89f

fix: deno-types directive should have higher precedence than X-TypeScript-Types header (#6761)

view details

Bartek Iwańczuk

commit sha 69552b1defcd77748de87fc4c9311b1baec1361d

upgrade: deno_lint v0.1.17 (#6869)

view details

Trivikram Kamat

commit sha 017aa1ca1b63f08bd251ef3bd0fc6b540d2b5fdd

chore: remove TODO about manual JSON parsing (#6878)

view details

Mark Tiedemann

commit sha 9f3ab4dca7ed5c810352b67fce24aa800defc5a6

Shorten Windows file description (#6881)

view details

Trivikram Kamat

commit sha 35a1421fb1b8407a13e33081ad2dbc05460e7452

chore: use ts-expect-error instead of ts-ignore (#6876)

view details

Jordan Cannon

commit sha 3b7fdd6734c4f1dbc34b0971296464395dc173bf

Fix typo (#6872)

view details

Marcin Puc

commit sha 7326e1ab490aab2220b139460165be0bfbf04f36

fix(std/json): Add newline at the end of json files (#6885)

view details

Trivikram Kamat

commit sha c8fc679329f45f50c061a67400e572f356b7890f

test(std): remove unstable from multiple tests (#6882)

view details

Trivikram Kamat

commit sha ccd0d0eb79db6ad33095ca06e9d491a27379b87a

chore(ci): update actions to run on macos-10.15 (#6884)

view details

push time in 8 days

issue commentdenoland/deno

feat: Deno.cacheDir, Deno.cache, resolveCacheModulePath

Deno.cacheDir()

This was removed in #6385.

Deno.cache(path: string, options: CacheOptions)

Duplicate of #4752.

resolveCacheModulePath(path: string)

Duplicate of #2096 (tracking issue for programmatic deno info, which provides this).

timreichen

comment created time in 8 days

Pull request review commentdenoland/deno

feat: add "--ignore" flag to deno fmt

 Ignore formatting a file by adding an ignore comment at the top of the file:         .help("Check if the source files are formatted.")         .takes_value(false),     )+    .arg(+      Arg::with_name("ignore")+        .long("ignore")+        .takes_value(true)+        .use_delimiter(true)+        .require_equals(true)+        .help("Ignore formatting particular source files."),+    )

I think if you make this dependent on the unstable flag .requires("unstable"), we can land this before 1.3.0. It should be reverted when the time comes.

divy-work

comment created time in 8 days

Pull request review commentdenoland/deno

feat: add "--ignore" flag to deno fmt

 const BOM_CHAR: char = '\u{FEFF}'; /// /// First argument supports globs, and if it is `None` /// then the current directory is recursively walked.-pub async fn format(args: Vec<String>, check: bool) -> Result<(), ErrBox> {+pub async fn format(+  args: Vec<String>,+  check: bool,+  ignore: Vec<String>,+) -> Result<(), ErrBox> {   if args.len() == 1 && args[0] == "-" {     return format_stdin(check);   }--  let target_files = collect_files(args)?;-+  let mut target_files = collect_files(args)?;+  if !ignore.is_empty() {+    let ignore_files = collect_files(ignore)?;+    target_files.retain(|f| !ignore_files.contains(&f));+  }

Does this work for filtering out by parent paths, like your use case suggests?

divy-work

comment created time in 8 days

Pull request review commentdenoland/deno

test(std/fs/writeJson): add test for append option

 // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.-import {-  assertEquals,-  assertThrowsAsync,-  assertThrows,-} from "../testing/asserts.ts"; import * as path from "../path/mod.ts";+import { assertEquals } from "../testing/asserts.ts"; import { writeJson, writeJsonSync } from "./write_json.ts";  const testdataDir = path.resolve("fs", "testdata");  Deno.test("writeJsonIfNotExists", async function (): Promise<void> {   const notExistsJsonFile = path.join(testdataDir, "file_not_exists.json"); -  await assertThrowsAsync(-    async (): Promise<void> => {-      await writeJson(notExistsJsonFile, { a: "1" });-      throw new Error("should write success");-    },-    Error,-    "should write success",-  );+  try {+    await writeJson(notExistsJsonFile, { a: "1" });+  } catch {+    // empty+  }

Yes the previous code was really strange. Why did you replace with a try/catch block?

  await writeJson(notExistsJsonFile, { a: "1" });
jsejcksn

comment created time in 8 days

startedtc39/proposal-asset-references

started time in 9 days

create barnchnayeemrmn/proposal-asset-references

branch : deno-use-case

created branch time in 9 days

fork nayeemrmn/proposal-asset-references

Proposal to ECMAScript to add first-class location references relative to a module

fork in 9 days

issue commentdenoland/deno

Question: install scripts with external assets

Duplicate of #5987, effectively. I'm not sure if deno install is a special case.

swwind

comment created time in 9 days

pull request commentdenoland/deno

chore: add GitHub issue templates for bug reports and feature requests

See https://github.com/denoland/deno/pull/5151#issuecomment-626147299.

trivikr

comment created time in 10 days

Pull request review commentdenoland/deno

fix(std/fs): Make writeJson func create a POSIX compliant file

 export interface WriteJsonOptions {   replacer?: Array<number | string> | Replacer; } +function createJsonWithEol(+  // eslint-disable-next-line @typescript-eslint/no-explicit-any+  object: any,+  options: WriteJsonOptions,+): string {+  const contentRaw = JSON.stringify(+    object,+    options.replacer as string[],+    options.spaces,+  );++  const eol = Deno.build.os === "windows" ? EOL.CRLF : EOL.LF;+  return format(`${contentRaw}\n`, eol);

This is a breaking change from current behavior. Currently, LF is used for all newlines, regardless of OS environment.

If newline replacement/formatting is being considered, it should be optional and not the default behavior.

It doesn't matter if it's breaking because std is unstable. I'm not sure what you mean here, currently there is no new line, right? It's not breaking either way because the spec of the function is to write a valid JSON string to a file. Not sure it needs to be configurable, is there any reason not to write the new line?

tranzystorek-io

comment created time in 10 days

issue commentdenoland/deno

error: The subcommand 'run' wasn't recognized. Did you mean 'run'?

@caspervonb If you're referring to the placement of --quiet, it's a global flag so putting it before the subcommand does work: deno --quiet run mod.ts.

It's apparently intentional that subcommands must come before --, so as @Spoonbender said this is strictly an error message problem tracked in https://github.com/clap-rs/clap/issues/1744.

fritzblue

comment created time in 10 days

pull request commentdenoland/deno

feat(std/testing): add assertInstanceOf

Duplicate of #5749.

buttercubz

comment created time in 10 days

issue commentdenoland/deno

feat: Importmap resolution

It's still too esoteric to include in CLI or std, especially for a spec so far from being standardised.

timreichen

comment created time in 10 days

pull request commentdenoland/deno

fix(std/fs): Make writeJson func create a POSIX compliant file

I agree. It makes sense for Deno.writeTextFile() to write the string verbatim. Data given to writeJson() cannot not model what happens with the line ending of the file, so it should decide internally.

tranzystorek-io

comment created time in 10 days

issue commentdenoland/deno

Permissionless static imports of local modules still allowed

@teleclimber The first entry of that import map sends imports to all file paths from root to undefined:. The second entry overrides that for the import map's containing directory, resetting it back to itself. Do the same for any exceptions you want to make.

{
  "imports": {
    "/": "undefined:",
    "./": "./",
    "/home/nayeem/my-scripts/": "/home/nayeem/my-scripts/"
  }
}
teleclimber

comment created time in 11 days

issue commentdenoland/deno

Fetch API doesn't respect forbidden headers

The behaviour is to silently drop them ... And it simply stripped the cookie header

Yep, as I hinted at in the example. But when you author a fetch() to a hardcoded URL with a cookie which is prerequisite to getting an ok response (auth?), it's likely to propagate into an error anyway, and you end up with a script that is expected to work in Deno but can't work in a browser. This will lead to the same kind of surprise our compatibility rule is supposed to prevent. Code which won't work as expected in a browser should be signalled with a Deno reference.

nayeemrmn

comment created time in 11 days

issue openeddenoland/deno

fetch() API doesn't respect forbidden headers

https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name

This restriction wouldn't make sense on a server with arbitrary TCP support, and node-fetch also allows forbidden headers. Nevertheless, this is a browser-incompatibility for a non-Deno API.

We should force use of a Deno symbol to set these headers:

// Bad: The Cookie header is silently dropped (in favour of the cookie jar).
await fetch(
  "https://example.com/",
  { headers: new Headers({ "Accept": "text/html", "Cookie": "foo=bar" }) },
);

// Good.
await fetch(
  "https://example.com/",
  {
    headers: new Headers({ "Accept": "text/html" }),
    [Deno.extension]: {
      headers: new Headers({ "Cookie": "foo=bar" }),
    },
  },
);

Or we could accept and document the incompatibility. I much prefer the first option since we're planning on extending fetch() with other things anyway: https://github.com/denoland/deno/issues/3444#issuecomment-658734031.

created time in 11 days

push eventnayeemrmn/deno

Bartek Iwańczuk

commit sha da48fa42d309e32684210a8d30ec3fc7ef7079df

chore: update Rust to 1.45.0 (#6791)

view details

Luca Casonato

commit sha 071a6e284aaaa26d40300b82d9f4cbb15a4dd6f5

Share reqwest client between fetch calls (#6792)

view details

sonota88

commit sha aebea6bd24dc1788c6db2f58204177af1c5d2dd6

doc(std/bytes): Fix wrong import in the example code (copyBytes) (#6787)

view details

Bert Belder

commit sha faa64edaf409757549a7df85812f6ea4f368051c

Upgrade to rusty_v8 0.7.0 (#6801)

view details

Jason Miller

commit sha c587450cd458514d8ae17d1fb649b1d36bb4649e

typo (#6800)

view details

木杉

commit sha 53adde866dd399aa2509d14508642fce37afb8f5

refactor(std/path): enrich the types in parse_format_test (#6803)

view details

Bartek Iwańczuk

commit sha fa61956f03491101b6ef64423ea2f1f73af26a73

Port internal TS code to JS (#6793) Co-authored-by: Ryan Dahl <ry@tinyclouds.org>

view details

Ryan Dahl

commit sha 628c10b55259f9d2b215b4203c2228062da189dc

fix benchmark_test (#6814)

view details

crowlKats

commit sha 903d28f872b90a800c64339dea058806cde0be67

Remove duplicate code and allow filename overwrite for DomFile (#6817)

view details

Ryan Dahl

commit sha 2460689b1a9582ef6ab8c5fa429e281c88bc14d1

Remove deno_typescript (#6813)

view details

木杉

commit sha f34a441a7d3e3e5c1517207a1ee2ed2a0eaee0c9

fix(tools/lint): don't exceed max command line length on windows (#6804)

view details

crowlKats

commit sha 9d13b539b5dfc96e2b5a0e89fc8e0312d6500fff

Fix lastModified for DomFile in FormData (#6830)

view details

Ryan Dahl

commit sha bf9930066d3a5d26baad22fb1766de26be49c2ae

Reduce size of TypeScript Compiler snapshot (#6809) This PR is intentionally ugly. It duplicates all of the code in cli/js2/ into cli/tsc/ ... because it's very important that we all understand that this code is unnecessarily duplicated in our binary. I hope this ugliness provides the motivation to clean it up. The typescript git submodule is removed, because it's a very large repo and contains all sorts of stuff we don't need. Instead the necessary files are copied directly into the deno repo. Hence +200k lines. COMPILER_SNAPSHOT.bin size ``` master 3448139 this branch 3320972 ``` Fixes #6812

view details

David Sherret

commit sha a28e153a12a1c78a0a048b290b82b92a1a971cd1

Use incremental formatting internally for dprint (#6815)

view details

Ryan Dahl

commit sha 69706331a590edceb49eae58835abd54b39878c2

clean up set_binary_metadata (#6811)

view details

Ryan Dahl

commit sha f8695b493dff3c4daee6e9f6b948a55810d2d0fa

Add web APIs to cli/js2/README.md (#6842)

view details

Casper Beyer

commit sha 587eefe7736efe70532124ca4ac93899f4ffbb8c

test(cli/unit): remove rogue console.log statement (#6846)

view details

Bartek Iwańczuk

commit sha b573bbe4471c3872f96e1d7b9d1d1a2b39ff4cf1

upgrade: tokio 0.2.22 (#6838)

view details

Casper Beyer

commit sha 843b54549c04337f18c62d1daf159a79865de6b7

BREAKING(std/fs): remove writeFileStr and writeFileStrSync (#6847) This removes the writeFileStr and writeFileStrSync functions which are effectivly duplicates of Deno.writeTextFile and Deno.writeTextFileSync.

view details

Casper Beyer

commit sha fd900cfe215e919392941b39b57a16b4a9976eec

BREAKING(std/fs): remove readFileStr and readFileStrSync (#6848) This removes the readFileStr and readFileStrSync functions which are effectively duplicates of Deno.readTextFile and Deno.readTextFileSync.

view details

push time in 12 days

delete branch nayeemrmn/deno

delete branch : watch-fs

delete time in 12 days

delete branch nayeemrmn/deno

delete branch : url-parsing

delete time in 12 days

pull request commentdenoland/deno

v1.2.1

Can we get #6785 in?

ry

comment created time in 12 days

more