From 4b4a0a244deef02a86165b8fd0a070408abfa654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 19 Jan 2024 12:39:42 +0900 Subject: [PATCH] test(es/module): Add a test for a fixed issue (#8521) **Related issue:** - Closes #8375 --- .../fixture/issues-8xxx/8375/1/input/.swcrc | 35 +++++++++++++++++++ .../fixture/issues-8xxx/8375/1/input/index.ts | 5 +++ .../8375/1/input/src/hello/index.ts | 3 ++ .../issues-8xxx/8375/1/output/index.ts | 9 +++++ .../8375/1/output/src/hello/index.ts | 13 +++++++ 5 files changed, 65 insertions(+) create mode 100644 crates/swc/tests/fixture/issues-8xxx/8375/1/input/.swcrc create mode 100644 crates/swc/tests/fixture/issues-8xxx/8375/1/input/index.ts create mode 100644 crates/swc/tests/fixture/issues-8xxx/8375/1/input/src/hello/index.ts create mode 100644 crates/swc/tests/fixture/issues-8xxx/8375/1/output/index.ts create mode 100644 crates/swc/tests/fixture/issues-8xxx/8375/1/output/src/hello/index.ts diff --git a/crates/swc/tests/fixture/issues-8xxx/8375/1/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/.swcrc new file mode 100644 index 000000000000..daccaa9add2c --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/.swcrc @@ -0,0 +1,35 @@ +{ + "jsc": { + "keepClassNames": true, + "output": { + "preamble": "" + }, + "parser": { + "syntax": "typescript" + }, + "baseUrl": ".", + "paths": { + "*": [ + "src/*" + ] + }, + "preserveAllComments": true, + "target": "es2022", + "transform": { + "decoratorMetadata": false, + "legacyDecorator": false + } + }, + "minify": false, + "module": { + "allowTopLevelThis": false, + "ignoreDynamic": false, + "lazy": false, + "noInterop": false, + "preserveImportMeta": false, + "resolveFully": false, + "strict": false, + "strictMode": true, + "type": "commonjs" + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8375/1/input/index.ts b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/index.ts new file mode 100644 index 000000000000..780e46a5d812 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/index.ts @@ -0,0 +1,5 @@ +import { helloWorld } from "hello"; +import * as Sentry from '@sentry/node'; + +Sentry; +helloWorld("SWC"); \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8375/1/input/src/hello/index.ts b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/src/hello/index.ts new file mode 100644 index 000000000000..b602b35254a5 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8375/1/input/src/hello/index.ts @@ -0,0 +1,3 @@ +export function helloWorld(name: string) { + console.log(`Hello, ${name}`); +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8375/1/output/index.ts b/crates/swc/tests/fixture/issues-8xxx/8375/1/output/index.ts new file mode 100644 index 000000000000..6b20956a05c5 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8375/1/output/index.ts @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +const _interop_require_wildcard = require("src/@swc/helpers/_/_interop_require_wildcard"); +const _hello = require("./src/hello"); +const _node = _interop_require_wildcard._(require("src/@sentry/node")); +_node; +(0, _hello.helloWorld)("SWC"); /*#__PURE__*/ diff --git a/crates/swc/tests/fixture/issues-8xxx/8375/1/output/src/hello/index.ts b/crates/swc/tests/fixture/issues-8xxx/8375/1/output/src/hello/index.ts new file mode 100644 index 000000000000..40ce8e0e514a --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8375/1/output/src/hello/index.ts @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "helloWorld", { + enumerable: true, + get: function() { + return helloWorld; + } +}); +function helloWorld(name) { + console.log(`Hello, ${name}`); +}