Align our AST's ESTree output with that of TS-ESLint's for
the`ObjectProperty` node. Relates to #9705
Add `optional` field and set to `false` fo the `ObjectProperty` when
serializing to TS estree.
Closes#3526.
Fully parse strings containing lone surrogates and encode the string in `value`.
Encoding schema is to encode a lone surrogate as the lossy replacement character, followed by the code point in hex. i.e. `"\uD800"` in source code would be encoded as `\u{FFFD}d800` in `value`. The lossy replacement character itself is encoded as `\u{FFFD}fffd`.
There's nothing special about the lossy replacement character. Just had to choose *some* valid Unicode character to be the escape marker, and that seemed like a reasonable choice of a character which is likely to be rare in real-world code.
All the ESTree-Test262 test cases related to lone surrogates now pass.
WIP. A bit of tidying up to do yet.
Oxc-parser equivalent of https://github.com/rolldown/rolldown/pull/3922
As discussed within Stackblitz and Rolldown team, stackblitz's package
swap isn't as simple nor as perfect as I thought, so Rolldown went with
auto downloading wasm binding during runtime. I suggest doing the same
for `oxc-parser`.
~TODO: I need to figure out how to patch `binding.js` during build
pipeline.~
TODO: Let nuxt folks know if this is released.
This is yet again only testable with the actual release, so
trial-and-error expected 😄
(At least, I tested running webcontainer-fallback.js directly on
stackblitz
https://stackblitz.com/edit/stackblitz-starters-yvuqgxo6?file=webcontainer-fallback.js)
Improve output for `StringLiteral`s containing lone surrogates.
Most of the remaining failing tests are just due to difference in case e.g.:
```diff
- "value": "\ud83d",
+ "value": "\uD83D",
```
But there are still a few genuine test fails. We don't have it exactly right yet. But this is a step in the right direction.
Adds and skips fields to the Estree serialiser for the
`TSMethodSignature` node.
Part of our broader work to align our AST's ESTree output with that of
TS-ESLint's. Relates to https://github.com/oxc-project/oxc/issues/9705
Adds the `static` and `accessibility` fields to the Estree serialiser
for the `TSPropertySignature` node.
Part of our broader work to align our AST's ESTree output with that of
TS-ESLint's. Relates to https://github.com/oxc-project/oxc/issues/9705
This PR is a follow up from #10020.
Follow-on after #9968. These 2 types are TS-only, so none of the fields are optional. Correct TS type defs by replacing `TSNull` with `Null` etc in the extra field types.
Make the`extends` field in `TSInterfaceDeclaration` serialize to `[]`
instead of `null` for interface declarations when the field is empty.
`"extends": null` -> `"extends": []`
PR is part of ongoing work to align our AST's ESTree output with that of
TS-ESLint's. Relates to #9705
Adds a `decorators` field with an empty array to align our AST's ESTree
output with that of TS-ESLint's for the `AssignmentPattern` node.
Relates to #9705
---------
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
Add missing estree fields to TSIndexSignature and TSIndexSignatureName
PR is part of ongoing work to align our AST's ESTree output with that of
TS-ESLint's. Relates to #9705.
---------
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
Skips estree serialisation for the field named `this_param` for both
`TSFunctionType` and `TSCallSignatureDeclaration` nodes.
PR is part of ongoing work to align our AST's ESTree output with that of
TS-ESLint's. Relates to #9705.
---------
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
Align our AST's ESTree output with that of TS-ESLint's for
the`ArrayPattern` node. Relates to #9705
Adds the following fields for estree serialization `decorators`
`optional` `typeAnnotation`.
Align our AST's ESTree output with that of TS-ESLint's for the
`FormalParameter` node. Relates to #9705
Skips the estree serialization of `accessibility` `readonly` and
`overrides` fields.
Shorten and simplify some `raw_deser` code, by using `THIS.prop` instead of `DESER[TypeOfProp](POS_OFFSET.prop)`.
As well as being shorter, this also results in more efficient deserializer code, as it avoids deserializing the same value twice.
Follow-on after #9913.
`TSThisParameter` is a TS-only type, so its fields aren't optional the way the TS fields of JS types are.
Fix the type def by using JS versions of added fields (`False` instead of `TsFalse` etc).
Also re-order the fields, so that `name` is first. We want the object shape to be the same (same field order) for all types which are `Identifier`s in the ESTree AST.
Follow-on after #9863. Speed up the raw deserializer code for `JSXElement` that PR introduced. Using `delete` in JS is usually a deoptimization. Better to create a new object.
- fixed `@vitest/browser` version mismatch
- removed `--typecheck` since `tsc` catches same errors (and honestly
vitest typecheck mode is not so intuitive 🙃)
- added `diff.expand: false` since raw transfer mismatch is huge (we
might change the default on Vitest side
https://github.com/vitest-dev/vitest/pull/7697)
Micro-optimization.
Re-order variants of `VariableDeclarationKind`. With this order:
* Checking if it's a lexical declaration is `discriminant != 0`
* Checking if it's const is `discriminant > 1`.
The latter is a couple of instructions shorter than it was before (`discriminant == 1 || discriminant > 2`).
Re-order the fields of `TemplateElement`, moving `tail` to last. This
means fields are in same order as ESTree, withou having to manually
re-order them.
The field order makes no real difference here, since `tail` field is not
visited, so I figure might as well align with ESTree.