Skip to content

Commit

Permalink
fix(recast): always generate tokens
Browse files Browse the repository at this point in the history
This is now required for recast, as it'll othewise fall back on esprima which doesn't work for JSX.

benjamn/recast#537
  • Loading branch information
eventualbuddha committed Nov 19, 2018
1 parent a4022a0 commit ca3b486
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/BabelPluginTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface ParseOptions {
allowReturnOutsideFunction?: boolean;
allowSuperOutsideMethod?: boolean;
plugins?: Array<string | [string, object]>;
tokens?: boolean;
}
export type AST = object;

Expand Down
2 changes: 1 addition & 1 deletion src/RecastPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function parse(
return recast.parse(code, {
parser: {
parse(code: string) {
return parse(code, options);
return parse(code, { ...options, tokens: true });
}
}
});
Expand Down
12 changes: 5 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,8 @@ assign-symbols@^1.0.0:

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

atob@^2.1.1:
version "2.1.2"
Expand Down Expand Up @@ -1369,14 +1370,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
version "1.0.5"
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

esprima@^4.0.0:
esprima@^4.0.0, esprima@~4.0.0:
version "4.0.1"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"

esprima@~4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"

esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
Expand Down Expand Up @@ -2795,7 +2792,8 @@ readable-stream@^2.0.0, readable-stream@^2.1.5:

recast@^0.16.1:
version "0.16.1"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.1.tgz#865f1800ef76e42e5d0375763b80f4d6a05f2069"
resolved "https://registry.npmjs.org/recast/-/recast-0.16.1.tgz#865f1800ef76e42e5d0375763b80f4d6a05f2069"
integrity sha512-ZUQm94F3AHozRaTo4Vz6yIgkSEZIL7p+BsWeGZ23rx+ZVRoqX+bvBA8br0xmCOU0DSR4qYGtV7Y5HxTsC4V78A==
dependencies:
ast-types "0.11.6"
esprima "~4.0.0"
Expand Down

0 comments on commit ca3b486

Please sign in to comment.