Skip to content

Multiline comments are not stripped #279

@cjpearson

Description

@cjpearson

Environment

Node v20.18.0, mlly@1.7.1

Reproduction

mlly.hasESMSyntax(`/* export * */`, { stripComments: false }) // true ✅ 
mlly.hasESMSyntax(`/* export * */`, { stripComments: true }) // false ✅ 
mlly.hasESMSyntax(`/* 
  export * 
*/`, { stripComments: true }) // true ❌ 

Describe the bug

The strip comments functionality does not handle multiline comments resulting in incorrect results for hasESMSyntax and isValidNodeImport.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions