profile
viewpoint
devsnek devsnek @nodejs @tc39 @WebAssembly @OpenJS-Foundation The Open Web https://gc.gy maker of overly complex interpreted languages | they/them

devsnek/discord-rich-presence 71

Discord RPC but only the rich presence part

devsnek/earl 9

Pure JavaScript ETF encoder/decoder

devsnek/ecma-operator-overloading 6

proposal for ecmascript operator overloading

devsnek/discord_bouncer 4

A fast and simple way to communicate with the Discord API

devsnek/boop-teh-snek 3

award winning game

issue commentnodejs/node

"Support" static import in repl

@ljharb yes. the idea is that we should be using v8's repl mode in node's repl (btw I've been prototyping with all sorts of fun stuff in this vein in https://github.com/nodejs/repl, y'all should try it out)

MylesBorins

comment created time in 16 hours

issue commentnodejs/node

"Support" static import in repl

@ljharb "repl mode" here meaning v8's debug repl mode, not node's repl module. although fwiw, repl mode doesn't support const redeclaration yet, only let. but anyway, within the repl mode we have leeway to provide this functionality.

MylesBorins

comment created time in 16 hours

issue commentnodejs/node

"Support" static import in repl

@ljharb it can run multiple times, repl mode also allows lexical redeclarations

MylesBorins

comment created time in 16 hours

issue commentnodejs/node

"Support" static import in repl

import isn't sync though

MylesBorins

comment created time in 18 hours

push eventnodejs/repl

Gus Caplan

commit sha 333a2cda9315d3daa3f96e50d8a2d01aa594ef23

enable replMode

view details

push time in 19 hours

issue commentnodejs/node

"Support" static import in repl

@BridgeAR interestingly i just checked again in the prototype repl and it seems like replMode: true isn't hanging anymore, at least on latest node. Issue might've been fixed?

MylesBorins

comment created time in 19 hours

issue commentnodejs/node

"Support" static import in repl

I had been looking into adding native support for static imports to V8's repl mode (https://docs.google.com/document/d/1WTMuQ6Ra_-hO7ebgkp_9XFDh_gaSt4eSqqPRHGlWQMg/edit#). Hoping to get around to it at some point.

MylesBorins

comment created time in 20 hours

PR closed engine262/engine262

Recognize ZWJ and ZWNJ as valid identifier parts

Recognize zero width joiner (U+200D) and zero width non-joiner (U+200C) as valid identifier parts (https://tc39.es/ecma262/#sec-names-and-keywords). I have a pull request to test262 containing relevant tests (https://github.com/tc39/test262/pull/2723).

There were a couple other things that came up that should be fixed now. Previously, when the identifier start was a Unicode escape, it was only being checked that it was a valid identifier part. Also, a Unicode escaped backslash was being allowed in identifiers.

+9 -3

1 comment

2 changed files

akluball

pr closed time in 20 hours

pull request commentengine262/engine262

Recognize ZWJ and ZWNJ as valid identifier parts

Sorry I didn't see this PR. This is fixed now.

akluball

comment created time in 20 hours

PR closed engine262/engine262

chore(deps): Update rollup to v2.23.0

This updates Rollup to v2.


I’ve also added the module, <code>type: "commonjs"</code> and <code>exports</code> fields to package.json, so that ESM consumers will use the ESM bundle, rather than the UMD one.

The type: "commonjs" field tells Node that .js files in this package are to always be treated as CommonJS modules, instead of needing the special .cjs extension.


I’ve also added src/package.json with <code>{ type: "module" }</code>, which will make it possible to switch to using the .js file extension in the src directory, while keeping the ES Module syntax.

+35 -13

2 comments

3 changed files

ExE-Boss

pr closed time in 20 hours

pull request commentengine262/engine262

chore(deps): Update rollup to v2.23.0

This happened at some point

ExE-Boss

comment created time in 20 hours

startedcutenode/1x.engineer

started time in 21 hours

push eventtc39/agendas

devsnek

commit sha 7b57610d79366c141187a7f6c4030a67489be82f

Add Unused Function Parameters for Stage 1

view details

push time in a day

delete branch tc39/agendas

delete branch : devsnek-patch-1

delete time in a day

PR closed tc39/agendas

Add Unused Function Parameters for Stage 1
+1 -0

0 comment

1 changed file

devsnek

pr closed time in a day

push eventtc39/agendas

devsnek

commit sha 31a21354ef6b331a0984774d6c44c3dd61e2875b

Add Standardized Debug for Stage 1

view details

push time in a day

push eventdevsnek/proposal-standardized-debug

devsnek

commit sha 72746cddecd88fc29b240a41d4e7699ab1683de6

Update README.md

view details

push time in a day

push eventdevsnek/proposal-standard-debug

devsnek

commit sha 778c1e019aadb5f1b7d540d8b29789e4bfb6ba0f

Update README.md

view details

push time in a day

push eventdevsnek/proposal-standard-debug

devsnek

commit sha 9129978d03826b117cc92daeb4167b0591bd606e

Update README.md

view details

push time in a day

create barnchdevsnek/proposal-standard-debug

branch : main

created branch time in a day

created repositorydevsnek/proposal-standard-debug

created time in a day

push eventdevsnek/proposal-unused-function-parameters

devsnek

commit sha 7a0aca8843028db5375a882e45678f64ab157bef

Update README.md

view details

push time in a day

push eventtc39/agendas

devsnek

commit sha 7a0278ee516d3b350591d8bf862ea25ae2a751f8

Update 09.md

view details

push time in a day

PR opened tc39/agendas

Add Optional Function Parameters for Stage 1
+1 -0

0 comment

1 changed file

pr created time in a day

create barnchtc39/agendas

branch : devsnek-patch-1

created branch time in a day

push eventdevsnek/proposal-optional-function-parameters

devsnek

commit sha 2eac47e9e01e0f69f8dfbcfc2fe17c6ae854a2c3

Update README.md

view details

push time in a day

push eventdevsnek/proposal-optional-function-parameters

devsnek

commit sha abb3e71fcff4815377ecb1b90bbdb0131c42e5e6

Update README.md

view details

push time in a day

create barnchdevsnek/proposal-optional-function-parameters

branch : main

created branch time in a day

created repositorydevsnek/proposal-optional-function-parameters

created time in a day

pull request commentnodejs/node

repl: unflag Top-Level Await

We should be able to get this for free once v8:10539 is fixed

hemanth

comment created time in 2 days

issue commentopenjs-foundation/standards

Issue not created for today's meeting?

i'd like to join whichever meeting #102 is discussed at.

MylesBorins

comment created time in 2 days

issue commentnodejs/node

setTimeout imposes minimum 1-millisecond delay

@fmela that's not true in any implementation I'm aware of. node apparently sets it to 1 and browsers have a minimum between 4-16ms.

fmela

comment created time in 2 days

issue commentnodejs/node

setTimeout imposes minimum 1-millisecond delay

setTimeout 0 and undefined sounds like a programming error to me.

fmela

comment created time in 2 days

push eventdevsnek/ecmarkup

Gus Caplan

commit sha ed68fe10495529f0802f75ae3fd97811b95060c8

Add multipage support Fixes #151

view details

push time in 2 days

Pull request review commenttc39/ecmarkup

Add multipage support

 export default class Spec {     }   } +  private async buildMultipage() {+    const doc = this.doc.cloneNode(true) as Document;++    const links = new Map<string, string>();+    const linksForJson: { [key: string]: string[] } = {};+    const registerLinks = (page: string, node: Element) => {+      const all = [];+      if (node.id) {+        links.set(`#${node.id}`, `${page}#${node.id}`);+        all.push(node.id);+      }+      Array.from(node.querySelectorAll('[id]')).forEach(n => {+        links.set(`#${n.id}`, `${page}#${n.id}`);+        if (!n.id.startsWith('_ref')) {+          all.push(n.id);+        }+      });+      linksForJson[page] = all;+    };++    const pages = new Map<string, Element>();+    pages.set('index', this.doc.createElement('div'));+    Array.from(doc.querySelector('#spec-container')!.children).forEach(c => {+      if (!c.id || !/^(\d+|\w) /.test(c.querySelector('h1')?.textContent!)) {

it's more like, the intro and everything before the intro (the title, logo, metadata block, etc). is it safe to just do if (has not seen 'emu-intro')?

devsnek

comment created time in 2 days

push eventdevsnek/ecmarkup

Gus Caplan

commit sha 4fe03260050b7c24bd2073889ab2a4edf943bf57

Add multipage support Fixes #151

view details

push time in 2 days

push eventdevsnek/ecmarkup

Gus Caplan

commit sha b64193a94353a3cb02012974b1a79dd6ba3b1daf

Add multipage support Fixes #151

view details

push time in 2 days

Pull request review commenttc39/ecmarkup

Add multipage support

 export default class Spec {     }   } +  private async buildMultipage() {+    const doc = this.doc.cloneNode(true) as Document;++    const links = new Map<string, string>();+    const linksForJson: { [key: string]: string[] } = {};+    const registerLinks = (page: string, node: Element) => {+      const all = [];+      if (node.id) {+        links.set(`#${node.id}`, `${page}#${node.id}`);+        all.push(node.id);+      }+      Array.from(node.querySelectorAll('[id]')).forEach(n => {+        links.set(`#${n.id}`, `${page}#${n.id}`);+        if (!n.id.startsWith('_ref')) {+          all.push(n.id);+        }+      });+      linksForJson[page] = all;+    };++    const pages = new Map<string, Element>();+    pages.set('index', this.doc.createElement('div'));+    Array.from(doc.querySelector('#spec-container')!.children).forEach(c => {+      if (!c.id || !/^(\d+|\w) /.test(c.querySelector('h1')?.textContent!)) {+        registerLinks('index.html', c);+        pages.get('index')!.appendChild(c);+      } else {+        pages.set(c.id, c);+        registerLinks(`${c.id}.html`, c);+      }+    });++    Array.from(doc.querySelectorAll('a')).forEach(a => {+      const href = a.getAttribute('href')!;+      if (links.has(href)) {+        a.setAttribute('href', links.get(href)!);+      }+    });++    const REWRITE_SCRIPT = `\+'use strict';++if (document.location.hash) {+  const obj = JSON.parse(${JSON.stringify(JSON.stringify(linksForJson))});+  for (const [page, ids] of Object.entries(obj)) {+    if (ids.includes(document.location.hash.slice(1))) {+      window.location.href = page + document.location.hash;+      break;+    }+  }+}+`;++    let outDir: string;+    if (this.opts.outfile) {+      outDir = path.dirname(this.opts.outfile);+    } else {+      outDir = process.cwd();+    }++    await Promise.all(+      [...pages].map(([id, e]) => {+        return utils.writeFile(+          path.join(outDir, 'multipage', `${id}.html`),+          `\+<!DOCTYPE html>+<html>+  <head>+    <script>+    ${REWRITE_SCRIPT}+    </script>+    ${doc.head.innerHTML.replace(/(href|src)="/g, '$1="../')}+  </head>+  <body>+    ${doc.querySelector('#menu-toggle')!.outerHTML}+    ${doc.querySelector('#menu-spacer')!.outerHTML}+    ${doc.querySelector('#menu')!.outerHTML}+    <div id="spec-container">

this pr doesn't include the next/previous section buttons

devsnek

comment created time in 2 days

Pull request review commenttc39/ecmarkup

Add multipage support

 export default class Spec {     }   } +  private async buildMultipage() {+    const doc = this.doc.cloneNode(true) as Document;++    const links = new Map<string, string>();+    const linksForJson: { [key: string]: string[] } = {};+    const registerLinks = (page: string, node: Element) => {+      const all = [];+      if (node.id) {+        links.set(`#${node.id}`, `${page}#${node.id}`);+        all.push(node.id);+      }+      Array.from(node.querySelectorAll('[id]')).forEach(n => {+        links.set(`#${n.id}`, `${page}#${n.id}`);+        if (!n.id.startsWith('_ref')) {+          all.push(n.id);+        }+      });+      linksForJson[page] = all;+    };++    const pages = new Map<string, Element>();+    pages.set('index', this.doc.createElement('div'));+    Array.from(doc.querySelector('#spec-container')!.children).forEach(c => {+      if (!c.id || !/^(\d+|\w) /.test(c.querySelector('h1')?.textContent!)) {+        registerLinks('index.html', c);+        pages.get('index')!.appendChild(c);+      } else {+        pages.set(c.id, c);+        registerLinks(`${c.id}.html`, c);+      }+    });++    Array.from(doc.querySelectorAll('a')).forEach(a => {+      const href = a.getAttribute('href')!;+      if (links.has(href)) {+        a.setAttribute('href', links.get(href)!);+      }+    });++    const REWRITE_SCRIPT = `\+'use strict';++if (document.location.hash) {+  const obj = JSON.parse(${JSON.stringify(JSON.stringify(linksForJson))});+  for (const [page, ids] of Object.entries(obj)) {+    if (ids.includes(document.location.hash.slice(1))) {+      window.location.href = page + document.location.hash;+      break;+    }+  }+}+`;++    let outDir: string;+    if (this.opts.outfile) {+      outDir = path.dirname(this.opts.outfile);+    } else {+      outDir = process.cwd();+    }++    await Promise.all(+      [...pages].map(([id, e]) => {+        return utils.writeFile(+          path.join(outDir, 'multipage', `${id}.html`),+          `\+<!DOCTYPE html>+<html>+  <head>+    <script>+    ${REWRITE_SCRIPT}+    </script>+    ${doc.head.innerHTML.replace(/(href|src)="/g, '$1="../')}

need to rewrite this better

devsnek

comment created time in 2 days

Pull request review commenttc39/ecmarkup

Add multipage support

 export default class Spec {     }   } +  private async buildMultipage() {+    const doc = this.doc.cloneNode(true) as Document;++    const links = new Map<string, string>();+    const linksForJson: { [key: string]: string[] } = {};+    const registerLinks = (page: string, node: Element) => {+      const all = [];+      if (node.id) {+        links.set(`#${node.id}`, `${page}#${node.id}`);+        all.push(node.id);+      }+      Array.from(node.querySelectorAll('[id]')).forEach(n => {+        links.set(`#${n.id}`, `${page}#${n.id}`);+        if (!n.id.startsWith('_ref')) {+          all.push(n.id);+        }+      });+      linksForJson[page] = all;+    };++    const pages = new Map<string, Element>();+    pages.set('index', this.doc.createElement('div'));+    Array.from(doc.querySelector('#spec-container')!.children).forEach(c => {+      if (!c.id || !/^(\d+|\w) /.test(c.querySelector('h1')?.textContent!)) {

is there a better way to tell apart whether the section is standalone (1 Scope, A Grammar Summary) or should be part of the landing page?

devsnek

comment created time in 2 days

PR opened tc39/ecmarkup

Add multipage support

Fixes #151

+92 -2

0 comment

2 changed files

pr created time in 2 days

delete branch devsnek/ecmarkup

delete branch : patch-1

delete time in 2 days

PR closed tc39/ecmarkup

Add multipage support to the menu

Multipage builds link to a page and a fragment, instead of just a fragment. This transparently continues to work on single page builds because '#xyz'.split('#') is ['', 'xyz']. Without this change, the script goes into an infinite loop and causes the page to become unresponsive.

+1 -1

0 comment

1 changed file

devsnek

pr closed time in 2 days

create barnchdevsnek/ecmarkup

branch : multipage

created branch time in 2 days

PR opened tc39/ecmarkup

Add multipage support to the menu

Multipage builds link to a page and a fragment, instead of just a fragment. This transparently continues to work on single page builds because '#xyz'.split('#') is ['', 'xyz']. Without this change, the script goes into an infinite loop and causes the page to become unresponsive.

+1 -1

0 comment

1 changed file

pr created time in 2 days

push eventdevsnek/ecmarkup

devsnek

commit sha 6ad1d80abbf164ee846f2c50ffa384d672e39b59

Add multipage support to the menu

view details

push time in 2 days

fork devsnek/ecmarkup

An HTML superset/Markdown subset source format for ECMAScript and related specifications

https://tc39.es/ecmarkup/

fork in 2 days

pull request commentnodejs/node

build: implement a Commit Queue in Actions

Does this validate that the cq label was added by someone with commit permissions?

mmarchini

comment created time in 3 days

Pull request review commentnodejs/node

net: introduce net.BlockList

 SocketAddress SocketAddress::FromPeerName(const uv_udp_t& handle) {   return FromUVHandle(uv_udp_getpeername, handle); } +namespace {+constexpr uint8_t mask[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };++bool is_match_ipv4(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in* one_in =+      reinterpret_cast<const sockaddr_in*>(one.data());+  const sockaddr_in* two_in =+      reinterpret_cast<const sockaddr_in*>(two.data());+  return memcmp(&one_in->sin_addr, &two_in->sin_addr, sizeof(uint32_t)) == 0;+}++bool is_match_ipv6(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in6* one_in =+      reinterpret_cast<const sockaddr_in6*>(one.data());+  const sockaddr_in6* two_in =+      reinterpret_cast<const sockaddr_in6*>(two.data());+  return memcmp(&one_in->sin6_addr, &two_in->sin6_addr, 16) == 0;+}++bool is_match_ipv4_ipv6(+    const SocketAddress& ipv4,+    const SocketAddress& ipv6) {++  const sockaddr_in* check_ipv4 =+      reinterpret_cast<const sockaddr_in*>(ipv4.data());+  const sockaddr_in6* check_ipv6 =+      reinterpret_cast<const sockaddr_in6*>(ipv6.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&check_ipv6->sin6_addr);++  return memcmp(ptr, mask, sizeof(mask)) == 0 &&+         memcmp(ptr + sizeof(mask),+                &check_ipv4->sin_addr,+                sizeof(uint32_t)) == 0;+}++int compare_ipv4(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in* one_in =+      reinterpret_cast<const sockaddr_in*>(one.data());+  const sockaddr_in* two_in =+      reinterpret_cast<const sockaddr_in*>(two.data());++  if (one_in->sin_addr.s_addr < two_in->sin_addr.s_addr)+    return -1;+  else if (one_in->sin_addr.s_addr == two_in->sin_addr.s_addr)+    return 0;+  else+    return 1;+}++int compare_ipv6(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in6* one_in =+      reinterpret_cast<const sockaddr_in6*>(one.data());+  const sockaddr_in6* two_in =+      reinterpret_cast<const sockaddr_in6*>(two.data());+  int ret = memcmp(&one_in->sin6_addr, &two_in->sin6_addr, 16);+  if (ret < 0)+    return -1;+  else if (ret > 0)+    return 1;+  return 0;+}++int compare_ipv4_ipv6(+    const SocketAddress& ipv4,+    const SocketAddress& ipv6) {++  const sockaddr_in* ipv4_in =+      reinterpret_cast<const sockaddr_in*>(ipv4.data());+  const sockaddr_in6 * ipv6_in =+      reinterpret_cast<const sockaddr_in6*>(ipv6.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&ipv6_in->sin6_addr);++  if (memcmp(ptr, mask, sizeof(mask)) != 0)+    return -2;++  int ret = memcmp(+      &ipv4_in->sin_addr,+      ptr + sizeof(mask),+      sizeof(uint32_t));++  if (ret < 0)+    return -1;+  else if (ret > 0)+    return 1;+  return 0;+}++bool in_network_ipv4(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {+  uint32_t mask = ((1 << prefix) - 1) << (32 - prefix);++  const sockaddr_in* ip_in =+      reinterpret_cast<const sockaddr_in*>(ip.data());+  const sockaddr_in* net_in =+      reinterpret_cast<const sockaddr_in*>(net.data());++  return (htonl(ip_in->sin_addr.s_addr) & mask) ==+         (htonl(net_in->sin_addr.s_addr) & mask);+}++bool in_network_ipv6(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {++  // Special case, if prefix == 128, then just do a+  // straight comparison.+  if (prefix == 128)+    return compare_ipv6(ip, net) == 0;++  uint8_t r = prefix % 8;+  int len = (prefix - r) / 8;+  uint8_t mask = (1 << r) << (8 - r);++  const sockaddr_in6* ip_in =+      reinterpret_cast<const sockaddr_in6*>(ip.data());+  const sockaddr_in6* net_in =+      reinterpret_cast<const sockaddr_in6*>(net.data());++  if (memcmp(&ip_in->sin6_addr, &net_in->sin6_addr, len) != 0)+    return false;++  const uint8_t* p1 = reinterpret_cast<const uint8_t*>(+      ip_in->sin6_addr.s6_addr);+  const uint8_t* p2 = reinterpret_cast<const uint8_t*>(+      net_in->sin6_addr.s6_addr);++  return (p1[len] & mask) == (p2[len] & mask);+}++bool in_network_ipv4_ipv6(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {++  if (prefix == 128)+    return compare_ipv4_ipv6(ip, net) == 0;++  uint8_t r = prefix % 8;+  int len = (prefix - r) / 8;+  uint8_t mask = (1 << r) << (8 - r);++  const sockaddr_in* ip_in =+      reinterpret_cast<const sockaddr_in*>(ip.data());+  const sockaddr_in6* net_in =+      reinterpret_cast<const sockaddr_in6*>(net.data());++  uint8_t ip_mask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0};+  uint8_t* ptr = ip_mask;+  memcpy(ptr + 12, &ip_in->sin_addr, 4);++  if (memcmp(ptr, &net_in->sin6_addr, len) != 0)+    return false;++  ptr += len;+  const uint8_t* p2 = reinterpret_cast<const uint8_t*>(+      net_in->sin6_addr.s6_addr);++  return (ptr[0] & mask) == (p2[len] & mask);+}++bool in_network_ipv6_ipv4(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {+  if (prefix == 32)+    return compare_ipv4_ipv6(net, ip) == 0;++  uint32_t m = ((1 << prefix) - 1) << (32 - prefix);++  const sockaddr_in6* ip_in =+      reinterpret_cast<const sockaddr_in6*>(ip.data());+  const sockaddr_in* net_in =+      reinterpret_cast<const sockaddr_in*>(net.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&ip_in->sin6_addr);++  if (memcmp(ptr, mask, sizeof(mask)) != 0)+    return false;++  ptr += sizeof(mask);+  uint32_t check = ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3];++  return (check & m) == (htonl(net_in->sin_addr.s_addr) & m);+}+}  // namespace++// TODO(@jasnell): The implementations of is_match, compare, and+// is_in_network have not been performance optimized and could+// likely benefit from work on more performant approaches.++bool SocketAddress::is_match(const SocketAddress& other) const {+  switch (family()) {+    case AF_INET:+      switch (other.family()) {+        case AF_INET: return is_match_ipv4(*this, other);+        case AF_INET6: return is_match_ipv4_ipv6(*this, other);+      }+      break;+    case AF_INET6:+      switch (other.family()) {+        case AF_INET: return is_match_ipv4_ipv6(other, *this);+        case AF_INET6: return is_match_ipv6(*this, other);+      }+      break;+  }+  return false;+}

ah got it, that's fair.

jasnell

comment created time in 3 days

Pull request review commentnodejs/node

net: introduce net.BlockList

 SocketAddress SocketAddress::FromPeerName(const uv_udp_t& handle) {   return FromUVHandle(uv_udp_getpeername, handle); } +namespace {+constexpr uint8_t mask[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };++bool is_match_ipv4(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in* one_in =+      reinterpret_cast<const sockaddr_in*>(one.data());+  const sockaddr_in* two_in =+      reinterpret_cast<const sockaddr_in*>(two.data());+  return memcmp(&one_in->sin_addr, &two_in->sin_addr, sizeof(uint32_t)) == 0;+}++bool is_match_ipv6(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in6* one_in =+      reinterpret_cast<const sockaddr_in6*>(one.data());+  const sockaddr_in6* two_in =+      reinterpret_cast<const sockaddr_in6*>(two.data());+  return memcmp(&one_in->sin6_addr, &two_in->sin6_addr, 16) == 0;+}++bool is_match_ipv4_ipv6(+    const SocketAddress& ipv4,+    const SocketAddress& ipv6) {++  const sockaddr_in* check_ipv4 =+      reinterpret_cast<const sockaddr_in*>(ipv4.data());+  const sockaddr_in6* check_ipv6 =+      reinterpret_cast<const sockaddr_in6*>(ipv6.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&check_ipv6->sin6_addr);++  return memcmp(ptr, mask, sizeof(mask)) == 0 &&+         memcmp(ptr + sizeof(mask),+                &check_ipv4->sin_addr,+                sizeof(uint32_t)) == 0;+}++int compare_ipv4(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in* one_in =+      reinterpret_cast<const sockaddr_in*>(one.data());+  const sockaddr_in* two_in =+      reinterpret_cast<const sockaddr_in*>(two.data());++  if (one_in->sin_addr.s_addr < two_in->sin_addr.s_addr)+    return -1;+  else if (one_in->sin_addr.s_addr == two_in->sin_addr.s_addr)+    return 0;+  else+    return 1;+}++int compare_ipv6(+    const SocketAddress& one,+    const SocketAddress& two) {+  const sockaddr_in6* one_in =+      reinterpret_cast<const sockaddr_in6*>(one.data());+  const sockaddr_in6* two_in =+      reinterpret_cast<const sockaddr_in6*>(two.data());+  int ret = memcmp(&one_in->sin6_addr, &two_in->sin6_addr, 16);+  if (ret < 0)+    return -1;+  else if (ret > 0)+    return 1;+  return 0;+}++int compare_ipv4_ipv6(+    const SocketAddress& ipv4,+    const SocketAddress& ipv6) {++  const sockaddr_in* ipv4_in =+      reinterpret_cast<const sockaddr_in*>(ipv4.data());+  const sockaddr_in6 * ipv6_in =+      reinterpret_cast<const sockaddr_in6*>(ipv6.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&ipv6_in->sin6_addr);++  if (memcmp(ptr, mask, sizeof(mask)) != 0)+    return -2;++  int ret = memcmp(+      &ipv4_in->sin_addr,+      ptr + sizeof(mask),+      sizeof(uint32_t));++  if (ret < 0)+    return -1;+  else if (ret > 0)+    return 1;+  return 0;+}++bool in_network_ipv4(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {+  uint32_t mask = ((1 << prefix) - 1) << (32 - prefix);++  const sockaddr_in* ip_in =+      reinterpret_cast<const sockaddr_in*>(ip.data());+  const sockaddr_in* net_in =+      reinterpret_cast<const sockaddr_in*>(net.data());++  return (htonl(ip_in->sin_addr.s_addr) & mask) ==+         (htonl(net_in->sin_addr.s_addr) & mask);+}++bool in_network_ipv6(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {++  // Special case, if prefix == 128, then just do a+  // straight comparison.+  if (prefix == 128)+    return compare_ipv6(ip, net) == 0;++  uint8_t r = prefix % 8;+  int len = (prefix - r) / 8;+  uint8_t mask = (1 << r) << (8 - r);++  const sockaddr_in6* ip_in =+      reinterpret_cast<const sockaddr_in6*>(ip.data());+  const sockaddr_in6* net_in =+      reinterpret_cast<const sockaddr_in6*>(net.data());++  if (memcmp(&ip_in->sin6_addr, &net_in->sin6_addr, len) != 0)+    return false;++  const uint8_t* p1 = reinterpret_cast<const uint8_t*>(+      ip_in->sin6_addr.s6_addr);+  const uint8_t* p2 = reinterpret_cast<const uint8_t*>(+      net_in->sin6_addr.s6_addr);++  return (p1[len] & mask) == (p2[len] & mask);+}++bool in_network_ipv4_ipv6(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {++  if (prefix == 128)+    return compare_ipv4_ipv6(ip, net) == 0;++  uint8_t r = prefix % 8;+  int len = (prefix - r) / 8;+  uint8_t mask = (1 << r) << (8 - r);++  const sockaddr_in* ip_in =+      reinterpret_cast<const sockaddr_in*>(ip.data());+  const sockaddr_in6* net_in =+      reinterpret_cast<const sockaddr_in6*>(net.data());++  uint8_t ip_mask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0};+  uint8_t* ptr = ip_mask;+  memcpy(ptr + 12, &ip_in->sin_addr, 4);++  if (memcmp(ptr, &net_in->sin6_addr, len) != 0)+    return false;++  ptr += len;+  const uint8_t* p2 = reinterpret_cast<const uint8_t*>(+      net_in->sin6_addr.s6_addr);++  return (ptr[0] & mask) == (p2[len] & mask);+}++bool in_network_ipv6_ipv4(+    const SocketAddress& ip,+    const SocketAddress& net,+    int prefix) {+  if (prefix == 32)+    return compare_ipv4_ipv6(net, ip) == 0;++  uint32_t m = ((1 << prefix) - 1) << (32 - prefix);++  const sockaddr_in6* ip_in =+      reinterpret_cast<const sockaddr_in6*>(ip.data());+  const sockaddr_in* net_in =+      reinterpret_cast<const sockaddr_in*>(net.data());++  const uint8_t* ptr =+      reinterpret_cast<const uint8_t*>(&ip_in->sin6_addr);++  if (memcmp(ptr, mask, sizeof(mask)) != 0)+    return false;++  ptr += sizeof(mask);+  uint32_t check = ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3];++  return (check & m) == (htonl(net_in->sin_addr.s_addr) & m);+}+}  // namespace++// TODO(@jasnell): The implementations of is_match, compare, and+// is_in_network have not been performance optimized and could+// likely benefit from work on more performant approaches.++bool SocketAddress::is_match(const SocketAddress& other) const {+  switch (family()) {+    case AF_INET:+      switch (other.family()) {+        case AF_INET: return is_match_ipv4(*this, other);+        case AF_INET6: return is_match_ipv4_ipv6(*this, other);+      }+      break;+    case AF_INET6:+      switch (other.family()) {+        case AF_INET: return is_match_ipv4_ipv6(other, *this);+        case AF_INET6: return is_match_ipv6(*this, other);+      }+      break;+  }+  return false;+}

When you say "ipv6 encoding" do you mean it would consider [2001:678:c18::1] and [2001:678:c18::0001] to be different, even though they're the same address?

jasnell

comment created time in 3 days

push eventdevsnek/esvu

Gus Caplan

commit sha f874238a3d8372ed769a8f85e4ab52cd488f19c1

disable hermes on linux until they fix it

view details

push time in 3 days

push eventdevsnek/esvu

Gus Caplan

commit sha 3da422851ebffe5eed1116796daa7b8cbdc01796

disable hermes on linux until they fix it

view details

push time in 3 days

push eventdevsnek/esvu

Gus Caplan

commit sha 7a7d841c0e803ef0ce2254410e1b892a91e06be7

disable hermes on linux until they fix it

view details

push time in 3 days

push eventdevsnek/esvu

Gus Caplan

commit sha 7d3e857753cae0830483b48057aad9c4459461e5

fix hermes

view details

push time in 3 days

issue commentnodejs/node

Use FinalizationRegistry to warn for leaked resources

wow @addaleax jinx

ronag

comment created time in 3 days

issue commentnodejs/node

Use FinalizationRegistry to warn for leaked resources

rooted in gc terms means the object is being referenced so it shouldn't be collected. in this case the socket is being referenced by the other end of the socket. as long as the other end is still open you probably want your side to stay open so it can get messages. this is different from an fs handle where you can completely consume the content and then forget to close it. in the native side we use persistents with finalizer callbacks to track gc.

ronag

comment created time in 3 days

issue commentWebAssembly/js-types

`WebAssembly.Module.{imports,exports}`

Ah I was reading the rendered spec. Glad to hear this is being added :)

devsnek

comment created time in 3 days

issue commenttc39/ecmarkup

Multipage builds

Made a little demo by postprocessing the spec: https://snek.dev/ecma262-multipage-demo/multipage/

After playing with it for a bit I think a separate page for each numbered/lettered section is good, even if the first few sections are a bit small. The one awkward part was manually putting the "contributing to this specification" and "introduction" into the index instead of on their own separate pages, but I assume with the data from the biblio that can be automated.

devsnek

comment created time in 3 days

issue commentnodejs/node

Meta: revert grace period

I don't think we've had any big problems with this. The only examples that come to mind are my semver version comparison api prs, and those happened over a year ago.

I think the bigger picture here though, is that if we were wanting of a revert grace period, we should just make the initial review time requirement longer.

mmarchini

comment created time in 3 days

issue commentnodejs/help

--disable-proto=delete flag does not allow to set a key named __proto__ using object literal

the proto flag only disables the prototype accessor. the literal syntax is not considered a security concern so it is not included.

Media-Evil

comment created time in 3 days

issue commentnodejs/node

Rename readdir and readdirSync methods

They are named after the POSIX operation readdir, all one word.

thejinbok

comment created time in 4 days

issue commentWebAssembly/esm-integration

Wasm/ESM integration and additional start/main functions

@xtuc so if I export a webassembly.memory from js, it gets imported in the cyclic module as that value, and then passed directly to the instantiate call via the import object. it seems like that should be sufficient?

littledan

comment created time in 4 days

issue commenttc39/proposal-record-tuple

Why restrict immutable types to only containing other immutable types?

@littledan we could allow them to be proxy targets, not like proxies aren't already weird

Jamesernator

comment created time in 4 days

issue openedWebAssembly/js-types

`WebAssembly.Module.{imports,exports}`

The import/export reflection APIs are nice but only provide kind: 'global', without any information about what type of global is being imported/exported. Adding additional type info to this API might be within scope of this proposal.

Some additional considerations might be designing the additions with future types like gc structs being kept in mind so we don't make this harder down the road.

created time in 4 days

issue commentWebAssembly/esm-integration

Wasm/ESM integration and additional start/main functions

@xtuc if you do export let a = 1 and then (import "whatever" "a"), it should work fine. the let a = 1 will evaluate before the execution of the wasm module (https://webassembly.github.io/esm-integration/js-api/index.html#module-execution). the case where it would not work fine is if there is a circularity between those where the wasm module's evaluation happens first, exacerbated because of the value snapshots.

littledan

comment created time in 5 days

issue commentWebAssembly/esm-integration

Wasm/ESM integration and additional start/main functions

so the concern is about circulars which expose tdz and get snapshotted as undefined?

littledan

comment created time in 5 days

issue commentWebAssembly/esm-integration

Wasm/ESM integration and additional start/main functions

@xtuc the main function can already access the module's imports, i'm not sure what you mean.

littledan

comment created time in 5 days

issue commentWebAssembly/esm-integration

Wasm/ESM integration and additional start/main functions

My understanding was that this would be solved by interface types providing the ability to pass nonscalar values.

littledan

comment created time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha 984c9b188e94edf95532206b70cc23c2fba214d9

clean up various comments and config

view details

push time in 5 days

issue commentnodejs/help

Using `__proto__` in object literals

@tjcrowder fwiw we actually are working on moving things out of annex b, for example https://github.com/tc39/ecma262/pull/2125

vsemozhetbyt

comment created time in 5 days

issue commentnodejs/node-addon-api

std::this_thread::sleep_for(std::chrono::milliseconds)

nope, it's just there as an example of a task that blocks while the main thread continues to run

srikanthkampati

comment created time in 5 days

issue commentnodejs/help

Using `__proto__` in object literals

Just reading through, it looks like they should be about the same (although there might be a bug where the __proto__ sets the prototype twice?). Also fwiw, modifying the prototype of an object right after you create it is not that bad. Modifying the prototype once the object has been passed around the codebase and such is what can cause slowdowns.

vsemozhetbyt

comment created time in 5 days

issue closednodejs/node

Exception when trying to import JSX with esm module loader

<!-- Thank you for reporting an issue.

This issue tracker is for bugs and issues found within Node.js core. If you require more general support please file an issue on our help repo. https://github.com/nodejs/help

Please fill in as much of the template below as you're able.

Version: output of node -v Platform: output of uname -a (UNIX), or version and 32 or 64-bit (Windows) Subsystem: if known, please specify affected core module name -->

  • Version: v12.18.3
  • Platform: Windows
  • Subsystem:

What steps will reproduce the bug?

Just try to load any React component that includes JSX, while using experimental modules by configuring :

  • "type": "module", in package.json
  • running script using node --es-module-specifier-resolution=node myScript.js
import MyReactComponent from '../components/MyReactComponent';

How often does it reproduce? Is there a required condition?

always.

What is the expected behavior?

The file is being imported without exception

What do you see instead?

(node:11964) ExperimentalWarning: The ESM module loader is experimental. file:///D:/.../components/MyReactComponent.js:58 <div className="col-lg-6 col-md-12 ^ SyntaxError: Unexpected token '<' at Loader.moduleStrategy (internal/modules/esm/translators.js:122:18)

closed time in 5 days

jony89

issue commentnodejs/node

Exception when trying to import JSX with esm module loader

you'll need to transpile your jsx or use a loader.

jony89

comment created time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha 4f500c5ebd8e991f01824726146176663c578f2e

various fixes

view details

push time in 5 days

PR closed nodejs/node

Create node.js.yml invalid

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [ ] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [ ] tests and/or benchmarks are included
  • [ ] documentation is changed or added
  • [ ] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+29 -0

0 comment

1 changed file

202006233011

pr closed time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha 898ec07766eaade4354f19e70c39fd1371bc4976

add function tostring test to slowlist

view details

push time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha 93409ede593dd159b43815a19a66a505739d08b7

skip a bunch of tests

view details

push time in 5 days

issue commenttc39/test262

Writing to deleted global variable references has been classified as a spec bug

More invalid tests:

language/expressions/compound-assignment/S11.13.2_A5.1_T4.js language/expressions/compound-assignment/S11.13.2_A5.4_T4.js language/expressions/compound-assignment/S11.13.2_A5.7_T4.js language/expressions/compound-assignment/S11.13.2_A5.10_T4.js language/expressions/compound-assignment/S11.13.2_A5.11_T4.js language/expressions/compound-assignment/S11.13.2_A5.2_T4.js language/expressions/compound-assignment/S11.13.2_A5.3_T4.js language/expressions/compound-assignment/S11.13.2_A5.5_T4.js language/expressions/compound-assignment/S11.13.2_A5.6_T4.js language/expressions/compound-assignment/S11.13.2_A5.9_T4.js language/expressions/compound-assignment/S11.13.2_A5.8_T4.js

bakkot

comment created time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha dbada3109a1bf42ebef3bfa256b417828031e8ae

some arrow parsing cleanup, remove module wrapper

view details

push time in 5 days

push eventengine262/engine262

Gus Caplan

commit sha 4bd6c93d3e6294d198e0d7cc55d8612ef17d22bd

some arrow parsing cleanup, remove module wrapper

view details

push time in 6 days

pull request commentnodejs/node

doc: harden policy around objections

our review period is already what accounts for making sure everyone sees the pr. given our incredibly low revert rate, I would say it works pretty well.

mmarchini

comment created time in 6 days

starteduwplse/herbie

started time in 6 days

PR opened tc39/agendas

Add `__proto__` item
+1 -0

0 comment

1 changed file

pr created time in 6 days

create barnchtc39/agendas

branch : devsnek-patch-1

created branch time in 6 days

pull request commenttc39/ecma262

Editorial: remove legacy intrinsics

Couldn't we technically just remove this whole table? Every intrinsic is already declared inline with the relevant definition via "is the %Xyz% intrinsic object"

ljharb

comment created time in 7 days

issue commentnodejs/node

Array.sort arguments order changed in Node.js 11

@JJBocanegra you could return 0 instead of return a.id - b.id The point is that if both items have admin, they need to compare consistently by some other metric.

hudochenkov

comment created time in 7 days

issue commentnodejs/TSC

Node.js TSC Survey: Unhandled Promises

@RRomoff

Thanks. For the header, the only thing i would say there is that screenshots would not be ideal for people who use screenreaders, unless it provides the option for alt text. For question one, I think check all that apply is the best.

joesepi

comment created time in 7 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

I agree we shouldn't consider those success cases. I'm saying, the message says "Unfinished Top-Level Await" but it can be caused by other things, which is potentially confusing. It might be better to rename it to "ESM Import Stalled" or something and mention that while many things can cause it, it would probably be caused by await (promise that never resolves)

addaleax

comment created time in 7 days

issue commentnodejs/node

Array.sort arguments order changed in Node.js 11

That's because your comparison function is inconsistent. It returns -1 same result for both check(members[0], members[2]) and check(members[2], members[0]). A better comparison would be this:

(a, b) => {
  if (a.isAdmin && b.isAdmin) {
    return a.id - b.id;
  }
  if (a.isAdmin) {
    return -1;
  }
  return 1;
}
hudochenkov

comment created time in 7 days

issue commenttc39/proposal-extended-numeric-literals

Potential alternative: Special lexical declarations for literal syntax

I think combined with the existence of numeric separators, 10_cm where cm is a normal value with normal scope semantics is far preferable to a bunch of new syntax and scoping and whatnot.

littledan

comment created time in 7 days

issue commentnodejs/TSC

Node.js TSC Survey: Unhandled Promises

all the code blocks are missing indentation and the one at the top is cut off:

joesepi

comment created time in 7 days

pull request commenttc39/ecma262

Editorial: Remove "Runtime Semantics" prefix from abstract operations

so does this just eliminate the category of runtime semantics that operate on productions as arguments instead of being syntax directed?

gibson042

comment created time in 7 days

issue commentnodejs/TSC

Proposed new strategic initiative: future of Node.js build toolchain

+1 for cmake, we could vendor stuff so much more easily.

mmarchini

comment created time in 7 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

No I'm just saying, with the current implementation, 13 doesn't actually imply the lack of promise resolution came from a source text module with TLA. I think the best you could do is moving the exitCode check to where module.evaluate() is called, although that still isn't inherently a source text module using TLA.

addaleax

comment created time in 7 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

this will be used if any part of the import() process stalls, for example a loader returning a promise that never resolves.

addaleax

comment created time in 7 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 function runMainESM(mainPath) {   esmLoader.loadESM((ESMLoader) => {

the loadESM function here is already supposed to upgrade rejections to uncaught exceptions. is that not working?

addaleax

comment created time in 7 days

push eventengine262/engine262

Gus Caplan

commit sha 72aa9feadbd917ffeb8f5e98994d5912451edda5

implement InitialName

view details

push time in 8 days

push eventengine262/engine262

Gus Caplan

commit sha f94928f2dd222ac582a153804fccaed73756e8cb

unflag weakrefs

view details

push time in 8 days

push eventengine262/engine262.github.io

Gus Caplan

commit sha e920718d95a7bc7d0f450f754dbd59bfc29b737b

update for api changes

view details

push time in 8 days

more