Ensures that Unicode escape sequences (e.g., "\u{1D306}") are correctly preserved during the code transformation process. This fix addresses an issue where certain escape sequences were incorrectly converted when parsing and regenerating code.
The fix gives raw: true option to the meriyahparse function in transform.ts.
const tree = parse(code, {
source: url.toString(),
next: true,
loc: true,
module: true,
onComment: comments,
raw: true, // Added this line
});
This test, which would fail without the fix, is added to transform.test.ts.
it("transforms unicode correctly", () => {
const input = `const a = "\\u{1D306}";\n`;
// Ensure that "\u{1D306}" is not converted to "t̆".
expect(transform(input, new URL("file:///foo"), [new IdentityHook()])).toBe(input);
});
Fixes #172.
Ensures that Unicode escape sequences (e.g., "\u{1D306}") are correctly preserved during the code transformation process. This fix addresses an issue where certain escape sequences were incorrectly converted when parsing and regenerating code.
The fix gives
raw: true
option to themeriyah
parse
function intransform.ts
.This test, which would fail without the fix, is added to
transform.test.ts
.