Skip to content

Conversation

@MattiasBuelens
Copy link
Contributor

@MattiasBuelens MattiasBuelens commented Dec 31, 2024

I noticed that the changes from #542 only affected src/, but not lib/. As such, the latest 4.6.0 release doesn't actually fix #541, since it still has the bigint literal fyntax in lib/ours/errors.js.

I wanted to fix this by rerunning node build/build.mjs locally. However, that surfaced a couple of more issues, which this PR aims to fix as well:

  1. The regex for inserting headers was looking for "use strict" only on the very first line. However, most source files start with a copyright comment, so the "use strict" directive only appears a few lines further. I fixed it by turning on the multiline flag on the regex.
  2. src/util.js was using ERR_INVALID_ARG_TYPE without requireing it from src/errors.js. I added the missing require().
  3. However, this new require() created a cyclic dependency between errors.js and util.js, so I had to move format, inspect and AggregateError out of util.js to break the cycle. (Node does something similar, see lib/internal/util/inspect.js).

I think we should have a test on our CI to verify that lib/ has been correctly built using our build script. It's not always obvious to new contributors that lib/ is generated code (see review comment), and it should (hopefully) prevent mistakes like #542 in the future. I'll make a follow-up PR for that.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 434aea0 into main Jan 1, 2025
196 checks passed
@mcollina
Copy link
Member

mcollina commented Jan 1, 2025

Any improvement to CI is very welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants