mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(node): resolve file.d specifiers in npm packages (#20918)
Makes type checking octokit work. Closes #20854
This commit is contained in:
parent
bd238be4b5
commit
cb70c4d0c4
8 changed files with 24 additions and 1 deletions
|
@ -433,6 +433,13 @@ itest!(types_no_types_entry {
|
|||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(types_d_ext {
|
||||
args: "check --all npm/d_ext/main.ts",
|
||||
output: "npm/d_ext/main.out",
|
||||
envs: env_vars_for_npm_tests(),
|
||||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(typescript_file_in_package {
|
||||
args: "run npm/typescript_file_in_package/main.ts",
|
||||
output: "npm/typescript_file_in_package/main.out",
|
||||
|
|
3
cli/tests/testdata/npm/d_ext/main.out
vendored
Normal file
3
cli/tests/testdata/npm/d_ext/main.out
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
Download http://localhost:4545/npm/registry/@denotest/d-ext
|
||||
Download http://localhost:4545/npm/registry/@denotest/d-ext/1.0.0.tgz
|
||||
Check file:///[WILDCARD]/npm/d_ext/main.ts
|
3
cli/tests/testdata/npm/d_ext/main.ts
vendored
Normal file
3
cli/tests/testdata/npm/d_ext/main.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { test } from "npm:@denotest/d-ext";
|
||||
|
||||
console.log(test);
|
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/index.d.ts
vendored
Normal file
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/index.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export const test: typeof import("./types.d").value;
|
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/index.js
vendored
Normal file
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/index.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports.test = 5;
|
5
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/package.json
vendored
Normal file
5
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/package.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "d-ext",
|
||||
"version": "1.0.0",
|
||||
"main": "./index.js"
|
||||
}
|
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/types.d.ts
vendored
Normal file
1
cli/tests/testdata/npm/registry/@denotest/d-ext/1.0.0/types.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export const value: 5;
|
|
@ -1378,7 +1378,9 @@ fn is_relative_specifier(specifier: &str) -> bool {
|
|||
/// Alternate `PathBuf::with_extension` that will handle known extensions
|
||||
/// more intelligently.
|
||||
fn with_known_extension(path: &Path, ext: &str) -> PathBuf {
|
||||
const NON_DECL_EXTS: &[&str] = &["cjs", "js", "json", "jsx", "mjs", "tsx"];
|
||||
const NON_DECL_EXTS: &[&str] = &[
|
||||
"cjs", "js", "json", "jsx", "mjs", "tsx", /* ex. types.d */ "d",
|
||||
];
|
||||
const DECL_EXTS: &[&str] = &["cts", "mts", "ts"];
|
||||
|
||||
let file_name = match path.file_name() {
|
||||
|
|
Loading…
Reference in a new issue