Skip to content

When add or modify imports, the format is not kept #41

@iFwu

Description

@iFwu

Environment

Node: v18.15.0
magicast: v0.2.3

Reproduction

import { parseModule } from 'magicast'

const mod = parseModule(`import { defineConfig } from "foo"
export default defineConfig({})`)

mod.imports.defineConfig.from = 'bar'
console.log(mod.generate().code)

It outputs:

import { defineConfig } from "bar";
export default defineConfig({})

The semicolon should not be appended to the import declaration.

Describe the bug

When modify or add imports, the format is not kept.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions