fix(babel-types): Add assertions to ExportAllDeclaration (#12273)
This commit is contained in:
parent
b7754d3c82
commit
d04b4dd116
@ -248,6 +248,17 @@ describe("@babel/template", function () {
|
|||||||
expect(result.assertions[0].type).toBe("ImportAttribute");
|
expect(result.assertions[0].type).toBe("ImportAttribute");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should return assertions in ExportAllDeclaration when using .ast", () => {
|
||||||
|
const result = template.ast(
|
||||||
|
`export * from "foo.json" assert { type: "json" };`,
|
||||||
|
{
|
||||||
|
plugins: ["importAssertions"],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(result.assertions[0].type).toBe("ImportAttribute");
|
||||||
|
});
|
||||||
|
|
||||||
it("should replace JSX placeholder", () => {
|
it("should replace JSX placeholder", () => {
|
||||||
const result = template.expression(
|
const result = template.expression(
|
||||||
`
|
`
|
||||||
|
|||||||
@ -1401,6 +1401,12 @@ defineType("ExportAllDeclaration", {
|
|||||||
source: {
|
source: {
|
||||||
validate: assertNodeType("StringLiteral"),
|
validate: assertNodeType("StringLiteral"),
|
||||||
},
|
},
|
||||||
|
assertions: {
|
||||||
|
validate: chain(
|
||||||
|
assertValueType("array"),
|
||||||
|
assertNodeType("ImportAttribute"),
|
||||||
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user