Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builders.raw throws when adding comments. #129

Open
Hugos68 opened this issue Jan 12, 2025 · 0 comments
Open

builders.raw throws when adding comments. #129

Hugos68 opened this issue Jan 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Hugos68
Copy link

Hugos68 commented Jan 12, 2025

Environment

NodeJS: 22.12.0
Magicast: ^0.3.5

Reproduction

import { builders } from 'magicast';

builders.raw('/** foo */');

Describe the bug

Providing a comment of any kind to builders.raw throws an error that looks to be related to the babel parser. I would like to add comments until #103 is merged but unsure how to do that.

I was wondering if I could also add comments using the $ast, perhaps somebody could help me out?

Additional context

No response

Logs

SyntaxError: Unterminated regular expression. (1:2)
 ❯ toParseError ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parse-error.ts:95:45
 ❯ V8IntrinsicMixin.raise ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/tokenizer/index.ts:1496:19
 ❯ V8IntrinsicMixin.readRegexp ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/tokenizer/index.ts:1074:20
 ❯ V8IntrinsicMixin.parseExprAtom ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/expression.ts:1103:14
 ❯ V8IntrinsicMixin.parseExprAtom ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/plugins/jsx/index.ts:576:22
 ❯ V8IntrinsicMixin.parseExprAtom ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/plugins/v8intrinsic.ts:33:42
 ❯ V8IntrinsicMixin.parseExprSubscripts ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/expression.ts:709:23
 ❯ V8IntrinsicMixin.parseUpdate ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/expression.ts:688:21
 ❯ V8IntrinsicMixin.parseMaybeUnary ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/expression.ts:650:23
 ❯ V8IntrinsicMixin.parseMaybeUnary ../../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/plugins/typescript/index.ts:3593:20
@Hugos68 Hugos68 added the bug Something isn't working label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant