Unsupported greater that ES2017
- Dominant language
- JavaScript
- Stars
- 9
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Reactor sandbox use [match-requires](https://www.npmjs.com/package/match-requires) which indirectly use [babylon](https://www.npmjs.com/package/babylon), an old version of [@babel/parser](https://www.npmjs.com/package/@babel/parser) which support only ES2017 syntax.
Reactor build system however support newer version at least ES2020 or ES2021 (I'm not sure, I didn't find any documentation about it).
While the extension use a syntax like async iterator, optional chaining, nullish coalescing, etc. use the sandbox is no more possible.
### Expected Behaviour
Be able to write extension with minium of ES2021 code
### Actual Behaviour
An error is throw about invalid syntax.
### Reproduce Scenario (including but not limited to)
Use ES2021 code, then execute `reactor-sandbox`
### Workaround
I found a way to force to use a newer version of babel parser by overriding sandbox dependencies:
```json
{
"overrides": {
"@adobe/reactor-sandbox@^14.0.0": {
"match-requires": {
"strip-comments": {
"babel-extract-comments": {
"babylon": "npm:@babel/parser@^8.0.4"
}
}
}
}
}
}
```
Contributor guide
Research direction
Start by tracing the `reactor-sandbox` execution path and its `match-requires` dependency to the old `babylon` parser. Verify which parser version is resolved, then run the reported ES2021 syntax examples; done means extensions using async iterators, optional chaining, and nullish coalescing no longer fail with syntax errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100