bytecodealliance / bytecodealliance/javy

Uncaught SyntaxError: invalid escape sequence in regular expression

Open
#71 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.7k
Forks
135
Avg merge
1d 44m
Merged PRs (30d)
11

Description

While experimenting with a solution that uses `javy`, I happened to include the [`camelcase`](https://www.npmjs.com/package/camelcase) package. When attempting to build, I get the error below.

```
thread '' panicked at 'called `Result::unwrap()` on an `Err` value: Uncaught SyntaxError: invalid escape sequence in regular expression
at RegExp (native)
at (:10)
at ./node_modules/camelcase/index.js (script.js:39)
at __webpack_require__ (script.js:63)
at (:2)
at ./src/index.js (script.js:29)
at __webpack_require__ (script.js:63)
at (script.js:115)
at (script.js:118)
at webpackUniversalModuleDefinition (script.js:15)
at (script.js:120)
', crates/core/src/lib.rs:35:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: the `wizer.initialize` function trapped

Caused by:
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0xcb9d9 - !__rust_start_panic
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable to may show more debugging information

Error: Couldn't create wasm from input
```

[Reproduction here](https://github.com/nickwesselman/javy-camelcase-issue/blob/main/src/index.js), I was able to isolate the issue to the following lines in `camelcase`:

```
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
const SEPARATORS = /[_.\- ]+/;
const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);

// THIS LINE APPEARS TO BE THE ISSUE
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
```

Not sure what the exact issue is, or how common it might be in other code.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.