Skip to content

Commit ca3b486

Browse files
fix(recast): always generate tokens
This is now required for recast, as it'll othewise fall back on esprima which doesn't work for JSX. benjamn/recast#537
1 parent a4022a0 commit ca3b486

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/BabelPluginTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface ParseOptions {
1111
allowReturnOutsideFunction?: boolean;
1212
allowSuperOutsideMethod?: boolean;
1313
plugins?: Array<string | [string, object]>;
14+
tokens?: boolean;
1415
}
1516
export type AST = object;
1617

src/RecastPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function parse(
1111
return recast.parse(code, {
1212
parser: {
1313
parse(code: string) {
14-
return parse(code, options);
14+
return parse(code, { ...options, tokens: true });
1515
}
1616
}
1717
});

yarn.lock

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,8 @@ assign-symbols@^1.0.0:
894894

895895
ast-types@0.11.6:
896896
version "0.11.6"
897-
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.6.tgz#4e2266c2658829aef3b40cc33ad599c4e9eb89ef"
897+
resolved "https://registry.npmjs.org/ast-types/-/ast-types-0.11.6.tgz#4e2266c2658829aef3b40cc33ad599c4e9eb89ef"
898+
integrity sha512-nHiuV14upVGl7MWwFUYbzJ6YlfwWS084CU9EA8HajfYQjMSli5TQi3UTRygGF58LFWVkXxS1rbgRhROEqlQkXg==
898899

899900
atob@^2.1.1:
900901
version "2.1.2"
@@ -1369,14 +1370,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
13691370
version "1.0.5"
13701371
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
13711372

1372-
esprima@^4.0.0:
1373+
esprima@^4.0.0, esprima@~4.0.0:
13731374
version "4.0.1"
13741375
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
13751376

1376-
esprima@~4.0.0:
1377-
version "4.0.0"
1378-
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
1379-
13801377
esutils@^2.0.2:
13811378
version "2.0.2"
13821379
resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@@ -2795,7 +2792,8 @@ readable-stream@^2.0.0, readable-stream@^2.1.5:
27952792

27962793
recast@^0.16.1:
27972794
version "0.16.1"
2798-
resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.1.tgz#865f1800ef76e42e5d0375763b80f4d6a05f2069"
2795+
resolved "https://registry.npmjs.org/recast/-/recast-0.16.1.tgz#865f1800ef76e42e5d0375763b80f4d6a05f2069"
2796+
integrity sha512-ZUQm94F3AHozRaTo4Vz6yIgkSEZIL7p+BsWeGZ23rx+ZVRoqX+bvBA8br0xmCOU0DSR4qYGtV7Y5HxTsC4V78A==
27992797
dependencies:
28002798
ast-types "0.11.6"
28012799
esprima "~4.0.0"

0 commit comments

Comments
 (0)