From 9c279b802b6a615fdba33a6f81866ce3ef606676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 20 Apr 2023 16:33:29 +0900 Subject: [PATCH] fix(es/modules): Support `jsc.baseUrl` without `jsc.paths` (#7302) **Related issue:** - Closes #1324. --- crates/swc/src/config/mod.rs | 11 +++--- crates/swc_ecma_loader/src/resolvers/node.rs | 2 +- crates/swc_ecma_loader/src/resolvers/tsc.rs | 32 +++++++++++------ .../tests/path_node.rs | 34 ++++++++++++++----- .../1-respect-base-url/input/config.json | 4 +++ .../input/src/folder/file1.ts | 3 ++ .../input/src/folder/file2.ts | 1 + .../1-respect-base-url/input/src/index.ts | 3 ++ .../2-check-file-existence/input/config.json | 4 +++ .../input/src/folder/file1.ts | 3 ++ .../input/src/folder/file2.ts | 1 + .../2-check-file-existence/input/src/index.ts | 3 ++ .../3-exact-pattern/input/config.json | 4 +++ .../3-exact-pattern/input/src/index.ts | 4 +++ .../tests/paths/issue-4532/input/config.json | 5 +++ .../tests/paths/issue-4532/input/paths.json | 3 -- .../tests/paths/issue-4585/input/config.json | 5 +++ .../tests/paths/issue-4585/input/paths.json | 3 -- .../paths/issue-4605/1/input/config.json | 5 +++ .../tests/paths/issue-4605/1/input/paths.json | 3 -- .../paths/issue-4605/2/input/config.json | 5 +++ .../tests/paths/issue-4605/2/input/paths.json | 3 -- .../tests/paths/issue-4607/input/config.json | 6 ++++ .../tests/paths/issue-4607/input/paths.json | 8 ----- .../paths/issue-4619/1/input/config.json | 5 +++ .../tests/paths/issue-4619/1/input/paths.json | 3 -- .../paths/issue-4619/2/input/config.json | 5 +++ .../tests/paths/issue-4619/2/input/paths.json | 3 -- .../tests/paths/issue-6159/input/config.json | 5 +++ .../tests/paths/issue-6159/input/paths.json | 5 --- .../paths/issue-6779/1/input/config.json | 5 +++ .../tests/paths/issue-6779/1/input/paths.json | 3 -- .../paths/issue-6779/2/input/config.json | 5 +++ .../tests/paths/issue-6779/2/input/paths.json | 3 -- 34 files changed, 136 insertions(+), 61 deletions(-) create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/config.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file1.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file2.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/index.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/config.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file1.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file2.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/index.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/config.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/src/index.ts create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/paths.json create mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/config.json delete mode 100644 crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/paths.json diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 81d56b6d1b3..6654ddc17d3 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -1438,10 +1438,11 @@ impl ModuleConfig { } _ => base.clone(), }; + let skip_resolver = base_url.as_os_str().is_empty() && paths.is_empty(); match config { None | Some(ModuleConfig::Es6) | Some(ModuleConfig::NodeNext) => { - if paths.is_empty() { + if skip_resolver { Box::new(noop()) } else { let resolver = build_resolver(base_url, paths); @@ -1450,7 +1451,7 @@ impl ModuleConfig { } } Some(ModuleConfig::CommonJs(config)) => { - if paths.is_empty() { + if skip_resolver { Box::new(modules::common_js::common_js( unresolved_mark, config, @@ -1470,7 +1471,7 @@ impl ModuleConfig { } } Some(ModuleConfig::Umd(config)) => { - if paths.is_empty() { + if skip_resolver { Box::new(modules::umd::umd( cm, unresolved_mark, @@ -1493,7 +1494,7 @@ impl ModuleConfig { } } Some(ModuleConfig::Amd(config)) => { - if paths.is_empty() { + if skip_resolver { Box::new(modules::amd::amd( unresolved_mark, config, @@ -1514,7 +1515,7 @@ impl ModuleConfig { } } Some(ModuleConfig::SystemJs(config)) => { - if paths.is_empty() { + if skip_resolver { Box::new(modules::system_js::system_js(unresolved_mark, config)) } else { let resolver = build_resolver(base_url, paths); diff --git a/crates/swc_ecma_loader/src/resolvers/node.rs b/crates/swc_ecma_loader/src/resolvers/node.rs index 286e8e9aae1..daee06d91ec 100644 --- a/crates/swc_ecma_loader/src/resolvers/node.rs +++ b/crates/swc_ecma_loader/src/resolvers/node.rs @@ -474,7 +474,7 @@ impl Resolve for NodeModulesResolver { } else { self.resolve_node_modules(base_dir, target) .and_then(|path| { - let file_path = path.context("Impossible to get the node_modules path"); + let file_path = path.context("failed to get the node_modules path"); let current_directory = current_dir()?; let relative_path = diff_paths(file_path?, current_directory); self.wrap(relative_path) diff --git a/crates/swc_ecma_loader/src/resolvers/tsc.rs b/crates/swc_ecma_loader/src/resolvers/tsc.rs index 3de635b4a83..995afaf87a8 100644 --- a/crates/swc_ecma_loader/src/resolvers/tsc.rs +++ b/crates/swc_ecma_loader/src/resolvers/tsc.rs @@ -25,6 +25,7 @@ where { inner: R, base_url: PathBuf, + base_url_filename: FileName, paths: Vec<(Pattern, Vec)>, } @@ -93,6 +94,7 @@ where Self { inner, + base_url_filename: FileName::Real(base_url.clone()), base_url, paths, } @@ -103,7 +105,7 @@ impl Resolve for TsConfigResolver where R: Resolve, { - fn resolve(&self, base: &FileName, src: &str) -> Result { + fn resolve(&self, base: &FileName, module_specifier: &str) -> Result { let _tracing = if cfg!(debug_assertions) { Some( tracing::span!( @@ -111,7 +113,7 @@ where "tsc.resolve", base_url = tracing::field::display(self.base_url.display()), base = tracing::field::display(base), - src = tracing::field::display(src), + src = tracing::field::display(module_specifier), ) .entered(), ) @@ -119,11 +121,14 @@ where None }; - if src.starts_with('.') && (src == ".." || src.starts_with("./") || src.starts_with("../")) + if module_specifier.starts_with('.') + && (module_specifier == ".." + || module_specifier.starts_with("./") + || module_specifier.starts_with("../")) { return self .inner - .resolve(base, src) + .resolve(base, module_specifier) .context("not processed by tsc resolver because it's relative import"); } @@ -136,7 +141,7 @@ where Component::Normal(v) => v == "node_modules", _ => false, }) { - return self.inner.resolve(base, src).context( + return self.inner.resolve(base, module_specifier).context( "not processed by tsc resolver because base module is in node_modules", ); } @@ -146,7 +151,7 @@ where for (from, to) in &self.paths { match from { Pattern::Wildcard { prefix } => { - let extra = src.strip_prefix(prefix); + let extra = module_specifier.strip_prefix(prefix); let extra = match extra { Some(v) => v, None => { @@ -169,7 +174,7 @@ where let res = self.inner.resolve(base, &rel).with_context(|| { format!( "failed to resolve `{}`, which is expanded from `{}`", - replaced, src + replaced, module_specifier ) }); @@ -192,14 +197,14 @@ where bail!( "`{}` matched `{}` (from tsconfig.paths) but failed to resolve:\n{:?}", - src, + module_specifier, prefix, errors ) } Pattern::Exact(from) => { // Should be exactly matched - if src == from { + if module_specifier == from { let replaced = self.base_url.join(&to[0]); if replaced.exists() { return Ok(FileName::Real(replaced)); @@ -219,6 +224,13 @@ where } } - self.inner.resolve(base, src) + if let Ok(v) = self + .inner + .resolve(&self.base_url_filename, module_specifier) + { + return Ok(v); + } + + self.inner.resolve(base, module_specifier) } } diff --git a/crates/swc_ecma_transforms_module/tests/path_node.rs b/crates/swc_ecma_transforms_module/tests/path_node.rs index 4a46fddb6be..7f4544a909d 100644 --- a/crates/swc_ecma_transforms_module/tests/path_node.rs +++ b/crates/swc_ecma_transforms_module/tests/path_node.rs @@ -4,6 +4,7 @@ use std::{ }; use indexmap::IndexMap; +use serde::Deserialize; use swc_common::FileName; use swc_ecma_loader::resolvers::{node::NodeModulesResolver, tsc::TsConfigResolver}; use swc_ecma_parser::Syntax; @@ -96,29 +97,46 @@ fn paths_resolver( base_url: impl AsRef, rules: Vec<(String, Vec)>, ) -> JscPathsProvider { + let base_url = base_url.as_ref().to_path_buf(); + dbg!(&base_url); + NodeImportResolver::new(TsConfigResolver::new( NodeModulesResolver::new(swc_ecma_loader::TargetEnv::Node, Default::default(), true), - base_url.as_ref().to_path_buf(), + base_url, rules, )) } +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct TestConfig { + #[serde(default)] + base_url: Option, + + #[serde(default)] + input_file: Option, + + #[serde(default)] + paths: IndexMap>, +} + #[testing::fixture("tests/paths/**/input")] fn fixture(input_dir: PathBuf) { let output_dir = input_dir.parent().unwrap().join("output"); - let index_path = input_dir.join("index.ts"); + let paths_json_path = input_dir.join("config.json"); + let paths_json = std::fs::read_to_string(paths_json_path).unwrap(); + let config = serde_json::from_str::(&paths_json).unwrap(); + + let index_path = input_dir.join(config.input_file.as_deref().unwrap_or("index.ts")); test_fixture( Syntax::default(), &|_| { - let paths_json_path = input_dir.join("paths.json"); - let paths_json = std::fs::read_to_string(paths_json_path).unwrap(); - let paths = serde_json::from_str::>>(&paths_json).unwrap(); + let rules = config.paths.clone().into_iter().collect(); - let rules = paths.into_iter().collect(); - - let resolver = paths_resolver(&input_dir, rules); + let resolver = + paths_resolver(config.base_url.clone().unwrap_or(input_dir.clone()), rules); import_rewriter(FileName::Real(index_path.clone()), resolver) }, diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/config.json new file mode 100644 index 00000000000..6f4093485d5 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/config.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "src", + "inputFile": "src/index.ts" +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file1.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file1.ts new file mode 100644 index 00000000000..a8c015e504d --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file1.ts @@ -0,0 +1,3 @@ +import jq from "jquery"; +import file from "folder/file2"; +console.log(jq, file); diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file2.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file2.ts new file mode 100644 index 00000000000..0d4957e7af3 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/folder/file2.ts @@ -0,0 +1 @@ +export default 'used' \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/index.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/index.ts new file mode 100644 index 00000000000..66be9ccaa1d --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/1-respect-base-url/input/src/index.ts @@ -0,0 +1,3 @@ +import jq from "jquery"; +import file from "./folder/file2"; +console.log(jq, file); \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/config.json new file mode 100644 index 00000000000..6f4093485d5 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/config.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "src", + "inputFile": "src/index.ts" +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file1.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file1.ts new file mode 100644 index 00000000000..71d4347e040 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file1.ts @@ -0,0 +1,3 @@ +import jq from "../jquery"; +import file from "./file2"; +console.log(jq, file); \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file2.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file2.ts new file mode 100644 index 00000000000..0d4957e7af3 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/folder/file2.ts @@ -0,0 +1 @@ +export default 'used' \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/index.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/index.ts new file mode 100644 index 00000000000..68bc3bc4e88 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/2-check-file-existence/input/src/index.ts @@ -0,0 +1,3 @@ +import jq from "./jquery"; +import file from "./folder/file2"; +console.log(jq, file); \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/config.json new file mode 100644 index 00000000000..6f4093485d5 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/config.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "src", + "inputFile": "src/index.ts" +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/src/index.ts b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/src/index.ts new file mode 100644 index 00000000000..bacd9c8ec7f --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/.issue-6530/3-exact-pattern/input/src/index.ts @@ -0,0 +1,4 @@ +import jq from 'jquery'; +import file from "folder/file2"; + +console.log(jq, file) diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/config.json new file mode 100644 index 00000000000..5325127617c --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@src/*": ["./*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/paths.json deleted file mode 100644 index 751a6a66c87..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4532/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@src/*": ["./*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/config.json new file mode 100644 index 00000000000..cfd95c9346a --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@lib/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/paths.json deleted file mode 100644 index ac25ca7ab12..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4585/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@lib/*": ["./src/*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/config.json new file mode 100644 index 00000000000..8443415b25e --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@src/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/paths.json deleted file mode 100644 index 08ae2f83af9..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@src/*": ["./src/*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/config.json new file mode 100644 index 00000000000..8443415b25e --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@src/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/paths.json deleted file mode 100644 index 08ae2f83af9..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@src/*": ["./src/*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/config.json new file mode 100644 index 00000000000..137e44e95cb --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/config.json @@ -0,0 +1,6 @@ +{ + "paths": { + "shared/*": ["./src/shared/*"], + "utils/*": ["./src/utils/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/paths.json deleted file mode 100644 index 1e75c97bed9..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4607/input/paths.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "shared/*": [ - "./src/shared/*" - ], - "utils/*": [ - "./src/utils/*" - ] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/config.json new file mode 100644 index 00000000000..8443415b25e --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@src/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/paths.json deleted file mode 100644 index 08ae2f83af9..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@src/*": ["./src/*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/config.json new file mode 100644 index 00000000000..8443415b25e --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@src/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/paths.json deleted file mode 100644 index 08ae2f83af9..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@src/*": ["./src/*"] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/config.json new file mode 100644 index 00000000000..8f785502529 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@/*": ["./src/*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json deleted file mode 100644 index 0550ae42012..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-6159/input/paths.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "@/*": [ - "./src/*" - ] -} \ No newline at end of file diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/config.json new file mode 100644 index 00000000000..ed8686c2a50 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@/utils/*": ["./*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/paths.json deleted file mode 100644 index 2490afa044a..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/1/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@/utils/*": ["./*"] -} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/config.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/config.json new file mode 100644 index 00000000000..ed8686c2a50 --- /dev/null +++ b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/config.json @@ -0,0 +1,5 @@ +{ + "paths": { + "@/utils/*": ["./*"] + } +} diff --git a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/paths.json b/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/paths.json deleted file mode 100644 index 2490afa044a..00000000000 --- a/crates/swc_ecma_transforms_module/tests/paths/issue-6779/2/input/paths.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "@/utils/*": ["./*"] -}