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

Inner comment lost when manipulating an object #33

Open
Andarist opened this issue Apr 5, 2023 · 0 comments
Open

Inner comment lost when manipulating an object #33

Andarist opened this issue Apr 5, 2023 · 0 comments
Labels

Comments

@Andarist
Copy link
Contributor

Andarist commented Apr 5, 2023

Environment

magicast@0.2.0

Reproduction

import { parseModule, generateCode } from "magicast";

const mod = parseModule(`

export default {
  /*inner comment*/
}

`);

mod.exports.default.foo ||= [];
mod.exports.default.foo.push("b");
mod.exports.default.foo.unshift("a");

const { code } = generateCode(mod);

console.log({ code });

Describe the bug

actual: an inner comment within an empty object is lost after manipulating that object
expected: the inner comment should be preserved

Additional context

No response

Logs

No response

@antfu antfu added the upstream label Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants