Skip to content

Commit

Permalink
fix: stringifier types
Browse files Browse the repository at this point in the history
  • Loading branch information
prevwong committed Apr 2, 2024
1 parent 1c07252 commit c120fb8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/parser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './parser';
export * from './stringifier';
export * from './utils';
2 changes: 0 additions & 2 deletions packages/parser/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { Stringifier, StringifierOpts } from './stringifier';
import { TokenType } from './tokens';
import { getIdentifierFromStr } from './utils';

export { StringifierOpts } from './stringifier';

const parseWithAcorn = (source: string, loc: number) => {
const JSXParser = AcornParser.extend(jsx());

Expand Down
7 changes: 2 additions & 5 deletions packages/parser/src/stringifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { EXTERNAL_IDENTIFIER_PREFIX_SYMBOL } from './utils';
import { Writer, WriterResult } from './writer';

export type StringifierOpts = {
onStringifyNode: (
node: t.ASTNode,
stringifier: _Stringifier
) => t.ASTNode | null | undefined;
onStringifyNode: (node: t.ASTNode) => t.ASTNode | null | undefined;
};

class _Stringifier {
Expand Down Expand Up @@ -101,7 +98,7 @@ class _Stringifier {
}

stringify(node: t.ASTNode, precedence: Precedence = Precedence.Sequence) {
const value = this.opts.onStringifyNode(node, this);
const value = this.opts.onStringifyNode(node);

if (value) {
node = value;
Expand Down

0 comments on commit c120fb8

Please sign in to comment.