From 4d4ad123cd2f1c8d07c847f36508696ca9dfddbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Sat, 23 Sep 2023 23:56:48 +0900 Subject: [PATCH 1/3] alias --- crates/swc/src/config/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 1a79edfdf0eb..0dbb836cd71b 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -1497,7 +1497,7 @@ pub struct JscExperimental { #[serde(default)] pub plugins: Option>, /// If true, keeps import assertions in the output. - #[serde(default)] + #[serde(default, alias = "keepImportAssertions")] pub keep_import_attributes: BoolConfig, #[serde(default)] From 71b12d498b922edd5908769e79ff6e2d6481ed28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Sat, 23 Sep 2023 23:56:52 +0900 Subject: [PATCH 2/3] Add a test --- .../fixture/issues-7xxx/7908/input/3/.swcrc | 17 +++++++++++++++++ .../tests/fixture/issues-7xxx/7908/input/3/1.js | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 crates/swc/tests/fixture/issues-7xxx/7908/input/3/.swcrc create mode 100644 crates/swc/tests/fixture/issues-7xxx/7908/input/3/1.js diff --git a/crates/swc/tests/fixture/issues-7xxx/7908/input/3/.swcrc b/crates/swc/tests/fixture/issues-7xxx/7908/input/3/.swcrc new file mode 100644 index 000000000000..2e8d9afe755a --- /dev/null +++ b/crates/swc/tests/fixture/issues-7xxx/7908/input/3/.swcrc @@ -0,0 +1,17 @@ +{ + "$schema": "https://json.schemastore.org/swcrc", + "jsc": { + "parser": { + "syntax": "typescript" + }, + "target": "es2022", + "experimental": { + "keepImportAssertions": true, + "emitAssertForImportAttributes": true + } + }, + "module": { + "type": "es6" + }, + "isModule": true +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-7xxx/7908/input/3/1.js b/crates/swc/tests/fixture/issues-7xxx/7908/input/3/1.js new file mode 100644 index 000000000000..e020128a2d7b --- /dev/null +++ b/crates/swc/tests/fixture/issues-7xxx/7908/input/3/1.js @@ -0,0 +1,3 @@ +import packageJSON from "./package.json" assert { type: "json" }; + +console.log(packageJSON) From 99564238b8d2426b15a5225c18fca11eda81630d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Sat, 23 Sep 2023 23:58:08 +0900 Subject: [PATCH 3/3] Update test refs --- crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js diff --git a/crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js b/crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js new file mode 100644 index 000000000000..39c441f4ee98 --- /dev/null +++ b/crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js @@ -0,0 +1,4 @@ +import packageJSON from "./package.json" assert { + type: "json" +}; +console.log(packageJSON);