Skip to content

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions