From cecf507595a0088b76df6cf8721ee6e873a75005 Mon Sep 17 00:00:00 2001 From: Nick Heiner Date: Wed, 24 Feb 2021 10:22:13 -0500 Subject: [PATCH] Update README.md Adding a note about a gotcha that I spent some time working out. Feel free to put the note somewhere else if what I did isn't the right organization. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e47fe3ce..87b430cb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Installation --- -From NPM: +From npm: npm install recast @@ -158,6 +158,8 @@ const tsAst = recast.parse(source, { **Note:** Some of these parsers import npm packages that Recast does not directly depend upon, so please be aware you may have to run `npm install babylon@next` to use the `typescript`, `flow`, or `babylon` parsers, or `npm install acorn` to use the `acorn` parser. Only Esprima is installed by default when Recast is installed. +After calling `recast.parse`, if you're going to transform the AST, make sure that the `.original` property is preserved. With Babel, for instance, if you call `transformFromAST`, you must pass `cloneInputAst: false` in its options. ([More detail](https://github.com/babel/babel/issues/12882). + Source maps ---