mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 14:05:47 -05:00
Add test case for #30429
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
//// [tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts] ////
|
||||
|
||||
//// [package.json]
|
||||
{
|
||||
"name": "troublesome-lib",
|
||||
"version": "1.17.1"
|
||||
}
|
||||
//// [Compactable.d.ts]
|
||||
import { Option } from './Option';
|
||||
export class Compactable {
|
||||
option: Option;
|
||||
}
|
||||
//// [Option.d.ts]
|
||||
export class Option {
|
||||
someProperty: string;
|
||||
}
|
||||
//// [app.d.ts]
|
||||
import { Option } from "troublesome-lib/lib/Option";
|
||||
export class SharedOption extends Option { }
|
||||
export const makeSharedOption: () => SharedOption;
|
||||
//// [index.d.ts]
|
||||
import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable
|
||||
//// [package.json]
|
||||
{
|
||||
"name": "troublesome-lib",
|
||||
"version": "1.17.1"
|
||||
}
|
||||
//// [Compactable.d.ts]
|
||||
import { Option } from './Option';
|
||||
export class Compactable {
|
||||
option: Option;
|
||||
}
|
||||
//// [Option.d.ts]
|
||||
export class Option {
|
||||
someProperty: string;
|
||||
}
|
||||
//// [app.ts]
|
||||
import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory
|
||||
import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder
|
||||
|
||||
|
||||
//// [/project/src/app.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,48 @@
|
||||
=== /project/src/app.ts ===
|
||||
import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory
|
||||
>t : Symbol(t, Decl(app.ts, 0, 6))
|
||||
|
||||
import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder
|
||||
>makeSharedOption : Symbol(makeSharedOption, Decl(app.ts, 1, 8))
|
||||
|
||||
=== /shared/node_modules/troublesome-lib/lib/Option.d.ts ===
|
||||
export class Option {
|
||||
>Option : Symbol(Option, Decl(Option.d.ts, 0, 0))
|
||||
|
||||
someProperty: string;
|
||||
>someProperty : Symbol(Option.someProperty, Decl(Option.d.ts, 0, 21))
|
||||
}
|
||||
=== /shared/lib/app.d.ts ===
|
||||
import { Option } from "troublesome-lib/lib/Option";
|
||||
>Option : Symbol(Option, Decl(app.d.ts, 0, 8))
|
||||
|
||||
export class SharedOption extends Option { }
|
||||
>SharedOption : Symbol(SharedOption, Decl(app.d.ts, 0, 52))
|
||||
>Option : Symbol(Option, Decl(app.d.ts, 0, 8))
|
||||
|
||||
export const makeSharedOption: () => SharedOption;
|
||||
>makeSharedOption : Symbol(makeSharedOption, Decl(app.d.ts, 2, 12))
|
||||
>SharedOption : Symbol(SharedOption, Decl(app.d.ts, 0, 52))
|
||||
|
||||
=== /project/node_modules/anotherLib/index.d.ts ===
|
||||
import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable
|
||||
>Compactable : Symbol(Compactable, Decl(index.d.ts, 0, 8))
|
||||
|
||||
=== /project/node_modules/troublesome-lib/lib/Compactable.d.ts ===
|
||||
import { Option } from './Option';
|
||||
>Option : Symbol(Option, Decl(Compactable.d.ts, 0, 8))
|
||||
|
||||
export class Compactable {
|
||||
>Compactable : Symbol(Compactable, Decl(Compactable.d.ts, 0, 34))
|
||||
|
||||
option: Option;
|
||||
>option : Symbol(Compactable.option, Decl(Compactable.d.ts, 1, 26))
|
||||
>Option : Symbol(Option, Decl(Compactable.d.ts, 0, 8))
|
||||
}
|
||||
=== /project/node_modules/troublesome-lib/lib/Option.d.ts ===
|
||||
export class Option {
|
||||
>Option : Symbol(Option, Decl(Option.d.ts, 0, 0))
|
||||
|
||||
someProperty: string;
|
||||
>someProperty : Symbol(Option.someProperty, Decl(Option.d.ts, 0, 21))
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
[
|
||||
"======== Resolving module 'anotherLib' from '/project/src/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'anotherLib'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'anotherLib'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'anotherLib'.",
|
||||
"Resolving module name 'anotherLib' relative to base url '/project' - '/project/anotherLib'.",
|
||||
"Loading module as file / folder, candidate module location '/project/anotherLib', target file type 'TypeScript'.",
|
||||
"File '/project/anotherLib.ts' does not exist.",
|
||||
"File '/project/anotherLib.tsx' does not exist.",
|
||||
"File '/project/anotherLib.d.ts' does not exist.",
|
||||
"Directory '/project/anotherLib' does not exist, skipping all lookups in it.",
|
||||
"Loading module 'anotherLib' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"Directory '/project/src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"File '/project/node_modules/anotherLib/package.json' does not exist.",
|
||||
"File '/project/node_modules/anotherLib.ts' does not exist.",
|
||||
"File '/project/node_modules/anotherLib.tsx' does not exist.",
|
||||
"File '/project/node_modules/anotherLib.d.ts' does not exist.",
|
||||
"File '/project/node_modules/anotherLib/index.ts' does not exist.",
|
||||
"File '/project/node_modules/anotherLib/index.tsx' does not exist.",
|
||||
"File '/project/node_modules/anotherLib/index.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/project/node_modules/anotherLib/index.d.ts', result '/project/node_modules/anotherLib/index.d.ts'.",
|
||||
"======== Module name 'anotherLib' was successfully resolved to '/project/node_modules/anotherLib/index.d.ts'. ========",
|
||||
"======== Resolving module '@shared/lib/app' from '/project/src/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name '@shared/lib/app'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name '@shared/lib/app'.",
|
||||
"Module name '@shared/lib/app', matched pattern '@shared/*'.",
|
||||
"Trying substitution '../shared/*', candidate module location: '../shared/lib/app'.",
|
||||
"Loading module as file / folder, candidate module location '/shared/lib/app', target file type 'TypeScript'.",
|
||||
"File '/shared/lib/app.ts' does not exist.",
|
||||
"File '/shared/lib/app.tsx' does not exist.",
|
||||
"File '/shared/lib/app.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name '@shared/lib/app' was successfully resolved to '/shared/lib/app.d.ts'. ========",
|
||||
"======== Resolving module 'troublesome-lib/lib/Compactable' from '/project/node_modules/anotherLib/index.d.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Compactable'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'troublesome-lib/lib/Compactable'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Compactable'.",
|
||||
"Resolving module name 'troublesome-lib/lib/Compactable' relative to base url '/project' - '/project/troublesome-lib/lib/Compactable'.",
|
||||
"Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Compactable', target file type 'TypeScript'.",
|
||||
"Loading module 'troublesome-lib/lib/Compactable' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"Directory '/project/node_modules/anotherLib/node_modules' does not exist, skipping all lookups in it.",
|
||||
"'package.json' does not have a 'typesVersions' field.",
|
||||
"Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Compactable/index.d.ts@1.17.1'.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Compactable.ts' does not exist.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Compactable.tsx' does not exist.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/project/node_modules/troublesome-lib/lib/Compactable.d.ts', result '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'.",
|
||||
"======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========",
|
||||
"======== Resolving module './Option' from '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/project/node_modules/troublesome-lib/lib/Option', target file type 'TypeScript'.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Option.ts' does not exist.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Option.tsx' does not exist.",
|
||||
"File '/project/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.",
|
||||
"'package.json' does not have a 'typesVersions' field.",
|
||||
"Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option.d.ts@1.17.1'.",
|
||||
"======== Module name './Option' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Option.d.ts'. ========",
|
||||
"======== Resolving module 'troublesome-lib/lib/Option' from '/shared/lib/app.d.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Option'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'troublesome-lib/lib/Option'.",
|
||||
"'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Option'.",
|
||||
"Resolving module name 'troublesome-lib/lib/Option' relative to base url '/project' - '/project/troublesome-lib/lib/Option'.",
|
||||
"Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Option', target file type 'TypeScript'.",
|
||||
"Loading module 'troublesome-lib/lib/Option' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"Directory '/shared/lib/node_modules' does not exist, skipping all lookups in it.",
|
||||
"'package.json' does not have a 'typesVersions' field.",
|
||||
"Found 'package.json' at '/shared/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option/index.d.ts@1.17.1'.",
|
||||
"File '/shared/node_modules/troublesome-lib/lib/Option.ts' does not exist.",
|
||||
"File '/shared/node_modules/troublesome-lib/lib/Option.tsx' does not exist.",
|
||||
"File '/shared/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/shared/node_modules/troublesome-lib/lib/Option.d.ts', result '/shared/node_modules/troublesome-lib/lib/Option.d.ts'.",
|
||||
"======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,46 @@
|
||||
=== /project/src/app.ts ===
|
||||
import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory
|
||||
>t : typeof t
|
||||
|
||||
import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder
|
||||
>makeSharedOption : () => import("/shared/lib/app").SharedOption
|
||||
|
||||
=== /shared/node_modules/troublesome-lib/lib/Option.d.ts ===
|
||||
export class Option {
|
||||
>Option : Option
|
||||
|
||||
someProperty: string;
|
||||
>someProperty : string
|
||||
}
|
||||
=== /shared/lib/app.d.ts ===
|
||||
import { Option } from "troublesome-lib/lib/Option";
|
||||
>Option : typeof Option
|
||||
|
||||
export class SharedOption extends Option { }
|
||||
>SharedOption : SharedOption
|
||||
>Option : Option
|
||||
|
||||
export const makeSharedOption: () => SharedOption;
|
||||
>makeSharedOption : () => SharedOption
|
||||
|
||||
=== /project/node_modules/anotherLib/index.d.ts ===
|
||||
import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable
|
||||
>Compactable : typeof Compactable
|
||||
|
||||
=== /project/node_modules/troublesome-lib/lib/Compactable.d.ts ===
|
||||
import { Option } from './Option';
|
||||
>Option : typeof Option
|
||||
|
||||
export class Compactable {
|
||||
>Compactable : Compactable
|
||||
|
||||
option: Option;
|
||||
>option : Option
|
||||
}
|
||||
=== /project/node_modules/troublesome-lib/lib/Option.d.ts ===
|
||||
export class Option {
|
||||
>Option : Option
|
||||
|
||||
someProperty: string;
|
||||
>someProperty : string
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// @noImplicitReferences: true
|
||||
// @fullEmitPaths: true
|
||||
// @traceResolution: true
|
||||
// @filename: /shared/node_modules/troublesome-lib/package.json
|
||||
{
|
||||
"name": "troublesome-lib",
|
||||
"version": "1.17.1"
|
||||
}
|
||||
// @filename: /shared/node_modules/troublesome-lib/lib/Compactable.d.ts
|
||||
import { Option } from './Option';
|
||||
export class Compactable {
|
||||
option: Option;
|
||||
}
|
||||
// @filename: /shared/node_modules/troublesome-lib/lib/Option.d.ts
|
||||
export class Option {
|
||||
someProperty: string;
|
||||
}
|
||||
// @filename: /shared/lib/app.d.ts
|
||||
import { Option } from "troublesome-lib/lib/Option";
|
||||
export class SharedOption extends Option { }
|
||||
export const makeSharedOption: () => SharedOption;
|
||||
// @filename: /project/node_modules/anotherLib/index.d.ts
|
||||
import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable
|
||||
// @filename: /project/node_modules/troublesome-lib/package.json
|
||||
{
|
||||
"name": "troublesome-lib",
|
||||
"version": "1.17.1"
|
||||
}
|
||||
// @filename: /project/node_modules/troublesome-lib/lib/Compactable.d.ts
|
||||
import { Option } from './Option';
|
||||
export class Compactable {
|
||||
option: Option;
|
||||
}
|
||||
// @filename: /project/node_modules/troublesome-lib/lib/Option.d.ts
|
||||
export class Option {
|
||||
someProperty: string;
|
||||
}
|
||||
// @filename: /project/src/app.ts
|
||||
import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory
|
||||
import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder
|
||||
|
||||
// @filename: /project/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@shared/*": ["../shared/*"]
|
||||
}
|
||||
},
|
||||
//"files": ["src/app.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user