SocketDev / SocketDev/socket-cli

Running node 18.20.8 and v1.1.152 results in not parsable regex

Open
#1,479 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
317
Forks
65
Avg merge
1h 26m
Merged PRs (30d)
30

Description

When using node version 18.20.8 upgrading to the release v1.1.152 failed, whereas version v1.1.143 works.

The documentation lists that for running socket, node version 18.20.8 is a minimum but supported requirement.

Steps for reproduction

nvm use 18.20.8
npm install --global socket@1.1.152
socket --version

The problem can also be reproduced directly with the relevant JavaScript syntax:

node -e 'console.log(/[\p{ASCII}&&\p{Letter}]/v)'

On Node.js 18.20.8 this results in:

SyntaxError: Invalid regular expression flags

Actual result

Every Socket command fails during startup, including:

socket --version
socket --help
socket npm --version

The application prints the following trace.

/home/x/.nvm/versions/node/v18.20.8/lib/node_modules/socket/dist/vendor.js:30745
                        */let cachedEastAsianWidth;function getEastAsianWidth(){if(cachedEastAsianWidth===void 0)cachedEastAsianWidth=require_get_east_asian_width().eastAsianWidth;return cachedEastAsianWidth;}let segmenter;function getSegmenter(){if(segmenter===void 0)segmenter=new require_primordials_intl.IntlSegmenter();return segmenter;}let zeroWidthClusterRegex;let leadingNonPrintingRegex;let emojiRegex;try{zeroWidthClusterRegex=/^(?:\p{Control}|\p{Default_Ignorable_Code_Point}|\p{Mark}|\p{Surrogate})+$/v;leadingNonPrintingRegex=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;emojiRegex=/^\p{RGI_Emoji}$/v;}catch{zeroWidthClusterRegex=/^(?:\p{Control}|\p{Default_Ignorable_Code_Point}|\p{Mark})+$/u;leadingNonPrintingRegex=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}]+/u;emojiRegex=/^\p{Extended_Pictographic}$/u;}/* c8 ignore stop *//**
                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^

SyntaxError: Invalid regular expression flags
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/home/x/.nvm/versions/node/v18.20.8/lib/node_modules/socket/dist/utils.js:3:14)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)

Node.js v18.20.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with Node.js 18.20.8 and the npm install and socket --version commands in the issue. Inspect dist/vendor.js and dist/utils.js around the shown regular expressions, then verify that socket --version, socket --help, and socket npm --version start successfully on the documented Node.js version.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.