mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add a new compiler option moduleSuffixes to expand the node module resolver's search algorithm (#48189)
* Add moduleSuffixes compiler option and related tests. Update baselines for compiler options tests. * Add a flag to the command-line parser which allows "list" params to preserve "falsy" values such as empty strings. Falsy values are normally stripped out. * Add tests. Rework resolver logic to only run module-suffix code when needed. * PR feedback * Add test * Remove unnecessary conditional.
This commit is contained in:
@@ -884,6 +884,18 @@ namespace ts {
|
||||
description: Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
||||
defaultValueDescription: false,
|
||||
},
|
||||
{
|
||||
name: "moduleSuffixes",
|
||||
type: "list",
|
||||
element: {
|
||||
name: "suffix",
|
||||
type: "string",
|
||||
},
|
||||
listPreserveFalsyValues: true,
|
||||
affectsModuleResolution: true,
|
||||
category: Diagnostics.Modules,
|
||||
description: Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module,
|
||||
},
|
||||
|
||||
// Source Maps
|
||||
{
|
||||
@@ -3192,7 +3204,7 @@ namespace ts {
|
||||
if (option.type === "list") {
|
||||
const listOption = option;
|
||||
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
|
||||
return filter(map(value, v => normalizeOptionValue(listOption.element, basePath, v)), v => !!v) as CompilerOptionsValue;
|
||||
return filter(map(value, v => normalizeOptionValue(listOption.element, basePath, v)), v => listOption.listPreserveFalsyValues ? true : !!v) as CompilerOptionsValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -3233,7 +3245,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function convertJsonOptionOfListType(option: CommandLineOptionOfListType, values: readonly any[], basePath: string, errors: Push<Diagnostic>): any[] {
|
||||
return filter(map(values, v => convertJsonOption(option.element, v, basePath, errors)), v => !!v);
|
||||
return filter(map(values, v => convertJsonOption(option.element, v, basePath, errors)), v => option.listPreserveFalsyValues ? true : !!v);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5878,6 +5878,10 @@
|
||||
"category": "Message",
|
||||
"code": 6930
|
||||
},
|
||||
"List of file name suffixes to search when resolving a module." : {
|
||||
"category": "Error",
|
||||
"code": 6931
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -1576,6 +1576,16 @@ namespace ts {
|
||||
|
||||
/** Return the file if it exists. */
|
||||
function tryFile(fileName: string, onlyRecordFailures: boolean, state: ModuleResolutionState): string | undefined {
|
||||
if (!state.compilerOptions.moduleSuffixes?.length) {
|
||||
return tryFileLookup(fileName, onlyRecordFailures, state);
|
||||
}
|
||||
|
||||
const ext = tryGetExtensionFromPath(fileName) ?? "";
|
||||
const fileNameNoExtension = ext ? removeExtension(fileName, ext) : fileName;
|
||||
return forEach(state.compilerOptions.moduleSuffixes, suffix => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
||||
}
|
||||
|
||||
function tryFileLookup(fileName: string, onlyRecordFailures: boolean, state: ModuleResolutionState): string | undefined {
|
||||
if (!onlyRecordFailures) {
|
||||
if (state.host.fileExists(fileName)) {
|
||||
if (state.traceEnabled) {
|
||||
|
||||
@@ -6149,6 +6149,7 @@ namespace ts {
|
||||
maxNodeModuleJsDepth?: number;
|
||||
module?: ModuleKind;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
moduleSuffixes?: string[];
|
||||
moduleDetection?: ModuleDetectionKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
@@ -6453,6 +6454,7 @@ namespace ts {
|
||||
export interface CommandLineOptionOfListType extends CommandLineOptionBase {
|
||||
type: "list";
|
||||
element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption;
|
||||
listPreserveFalsyValues?: boolean;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
@@ -420,6 +420,70 @@ namespace ts {
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [".ios", ""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [".ios", ""]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [""]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert trailing-whitespace string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [" "]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [" "]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: []
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: []
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert incorrectly format tsconfig.json to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
|
||||
@@ -2977,6 +2977,7 @@ declare namespace ts {
|
||||
maxNodeModuleJsDepth?: number;
|
||||
module?: ModuleKind;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
moduleSuffixes?: string[];
|
||||
moduleDetection?: ModuleDetectionKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
|
||||
@@ -2977,6 +2977,7 @@ declare namespace ts {
|
||||
maxNodeModuleJsDepth?: number;
|
||||
module?: ModuleKind;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
moduleSuffixes?: string[];
|
||||
moduleDetection?: ModuleDetectionKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_empty.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { base } from "./foo";
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : Symbol(base, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_notSpecified.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { base } from "./foo";
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : Symbol(base, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "./foo";
|
||||
//// [foo.ios.ts]
|
||||
export function ios() {}
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.ios = void 0;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : Symbol(ios, Decl(foo.ios.ts, 0, 0))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ios.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo.ios.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : () => void
|
||||
|
||||
=== /foo.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_oneBlank.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { base } from "./foo";
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : Symbol(base, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/index.ts(1,21): error TS2307: Cannot find module './foo' or its corresponding type declarations.
|
||||
|
||||
|
||||
==== /tsconfig.json (0 errors) ====
|
||||
// moduleSuffixes has one entry but there isn't a matching file. Module resolution should fail.
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
==== /index.ts (1 errors) ====
|
||||
import { ios } from "./foo";
|
||||
~~~~~~~
|
||||
!!! error TS2307: Cannot find module './foo' or its corresponding type declarations.
|
||||
==== /foo.ts (0 errors) ====
|
||||
export function base() {}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_oneNotFound.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "./foo";
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ios.ts' does not exist.",
|
||||
"File '/foo.ios.tsx' does not exist.",
|
||||
"File '/foo.ios.d.ts' does not exist.",
|
||||
"Directory '/foo' does not exist, skipping all lookups in it.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'JavaScript'.",
|
||||
"File '/foo.ios.js' does not exist.",
|
||||
"File '/foo.ios.jsx' does not exist.",
|
||||
"Directory '/foo' does not exist, skipping all lookups in it.",
|
||||
"======== Module name './foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : any
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_dirModuleWithIndex.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "./foo";
|
||||
//// [index.ios.ts]
|
||||
export function ios() {}
|
||||
//// [index.ts]
|
||||
export function base() {}
|
||||
|
||||
//// [index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.ios = void 0;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo/index.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : Symbol(ios, Decl(index.ios.ts, 0, 0))
|
||||
|
||||
=== /foo/index.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(index.ts, 0, 0))
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo.ios.ts' does not exist.",
|
||||
"File '/foo.ios.tsx' does not exist.",
|
||||
"File '/foo.ios.d.ts' does not exist.",
|
||||
"File '/foo/package.json' does not exist.",
|
||||
"File '/foo/index.ios.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo/index.ios.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : () => void
|
||||
|
||||
=== /foo/index.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
=== /foo/index.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule.ts] ////
|
||||
|
||||
//// [index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
//// [index.ios.d.ts]
|
||||
export declare function ios(): void;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
//// [index.d.ts]
|
||||
export declare function base(): void;
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "some-library";
|
||||
|
||||
|
||||
//// [/bin/node_modules/some-library/index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [/bin/node_modules/some-library/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [/bin/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,44 @@
|
||||
=== /node_modules/some-library/index.ios.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
|
||||
function ios() {}
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 1, 26))
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>exports : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/index.ios.d.ts ===
|
||||
export declare function ios(): void;
|
||||
>ios : Symbol(ios, Decl(index.ios.d.ts, 0, 0))
|
||||
|
||||
=== /node_modules/some-library/index.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
|
||||
function base() {}
|
||||
>base : Symbol(base, Decl(index.js, 1, 26))
|
||||
|
||||
exports.base = base;
|
||||
>exports.base : Symbol(base, Decl(index.js, 2, 18))
|
||||
>exports : Symbol(base, Decl(index.js, 2, 18))
|
||||
>base : Symbol(base, Decl(index.js, 2, 18))
|
||||
>base : Symbol(base, Decl(index.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/index.d.ts ===
|
||||
export declare function base(): void;
|
||||
>base : Symbol(base, Decl(index.d.ts, 0, 0))
|
||||
|
||||
=== /index.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
"======== Resolving module 'some-library' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'some-library' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/package.json' does not exist.",
|
||||
"File '/node_modules/some-library.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library.ios.d.ts' does not exist.",
|
||||
"File '/node_modules/some-library/index.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/index.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/index.ios.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/node_modules/some-library/index.ios.d.ts', result '/node_modules/some-library/index.ios.d.ts'.",
|
||||
"======== Module name 'some-library' was successfully resolved to '/node_modules/some-library/index.ios.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,54 @@
|
||||
=== /node_modules/some-library/index.ios.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/index.ios")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios = ios : () => void
|
||||
>exports.ios : () => void
|
||||
>exports : typeof import("/node_modules/some-library/index.ios")
|
||||
>ios : () => void
|
||||
>ios : () => void
|
||||
|
||||
=== /node_modules/some-library/index.ios.d.ts ===
|
||||
export declare function ios(): void;
|
||||
>ios : () => void
|
||||
|
||||
=== /node_modules/some-library/index.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/index")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function base() {}
|
||||
>base : () => void
|
||||
|
||||
exports.base = base;
|
||||
>exports.base = base : () => void
|
||||
>exports.base : () => void
|
||||
>exports : typeof import("/node_modules/some-library/index")
|
||||
>base : () => void
|
||||
>base : () => void
|
||||
|
||||
=== /node_modules/some-library/index.d.ts ===
|
||||
export declare function base(): void;
|
||||
>base : () => void
|
||||
|
||||
=== /index.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : () => void
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModulePath.ts] ////
|
||||
|
||||
//// [foo.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function iosfoo() {}
|
||||
exports.iosfoo = iosfoo;
|
||||
//// [foo.ios.d.ts]
|
||||
export declare function iosfoo(): void;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function basefoo() {}
|
||||
exports.basefoo = basefoo;
|
||||
//// [foo.d.ts]
|
||||
export declare function basefoo(): void;
|
||||
|
||||
//// [index.ts]
|
||||
import { iosfoo } from "some-library/foo";
|
||||
|
||||
|
||||
//// [/bin/node_modules/some-library/foo.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function iosfoo() { }
|
||||
exports.iosfoo = iosfoo;
|
||||
//// [/bin/node_modules/some-library/foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function basefoo() { }
|
||||
exports.basefoo = basefoo;
|
||||
//// [/bin/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,44 @@
|
||||
=== /node_modules/some-library/foo.ios.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
|
||||
function iosfoo() {}
|
||||
>iosfoo : Symbol(iosfoo, Decl(foo.ios.js, 1, 26))
|
||||
|
||||
exports.iosfoo = iosfoo;
|
||||
>exports.iosfoo : Symbol(iosfoo, Decl(foo.ios.js, 2, 20))
|
||||
>exports : Symbol(iosfoo, Decl(foo.ios.js, 2, 20))
|
||||
>iosfoo : Symbol(iosfoo, Decl(foo.ios.js, 2, 20))
|
||||
>iosfoo : Symbol(iosfoo, Decl(foo.ios.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/foo.ios.d.ts ===
|
||||
export declare function iosfoo(): void;
|
||||
>iosfoo : Symbol(iosfoo, Decl(foo.ios.d.ts, 0, 0))
|
||||
|
||||
=== /node_modules/some-library/foo.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
|
||||
function basefoo() {}
|
||||
>basefoo : Symbol(basefoo, Decl(foo.js, 1, 26))
|
||||
|
||||
exports.basefoo = basefoo;
|
||||
>exports.basefoo : Symbol(basefoo, Decl(foo.js, 2, 21))
|
||||
>exports : Symbol(basefoo, Decl(foo.js, 2, 21))
|
||||
>basefoo : Symbol(basefoo, Decl(foo.js, 2, 21))
|
||||
>basefoo : Symbol(basefoo, Decl(foo.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/foo.d.ts ===
|
||||
export declare function basefoo(): void;
|
||||
>basefoo : Symbol(basefoo, Decl(foo.d.ts, 0, 0))
|
||||
|
||||
=== /index.ts ===
|
||||
import { iosfoo } from "some-library/foo";
|
||||
>iosfoo : Symbol(iosfoo, Decl(index.ts, 0, 8))
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[
|
||||
"======== Resolving module 'some-library/foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'some-library/foo' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/package.json' does not exist.",
|
||||
"File '/node_modules/some-library/foo.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/foo.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/foo.ios.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/node_modules/some-library/foo.ios.d.ts', result '/node_modules/some-library/foo.ios.d.ts'.",
|
||||
"======== Module name 'some-library/foo' was successfully resolved to '/node_modules/some-library/foo.ios.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,54 @@
|
||||
=== /node_modules/some-library/foo.ios.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/foo.ios")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function iosfoo() {}
|
||||
>iosfoo : () => void
|
||||
|
||||
exports.iosfoo = iosfoo;
|
||||
>exports.iosfoo = iosfoo : () => void
|
||||
>exports.iosfoo : () => void
|
||||
>exports : typeof import("/node_modules/some-library/foo.ios")
|
||||
>iosfoo : () => void
|
||||
>iosfoo : () => void
|
||||
|
||||
=== /node_modules/some-library/foo.ios.d.ts ===
|
||||
export declare function iosfoo(): void;
|
||||
>iosfoo : () => void
|
||||
|
||||
=== /node_modules/some-library/foo.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/foo")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function basefoo() {}
|
||||
>basefoo : () => void
|
||||
|
||||
exports.basefoo = basefoo;
|
||||
>exports.basefoo = basefoo : () => void
|
||||
>exports.basefoo : () => void
|
||||
>exports : typeof import("/node_modules/some-library/foo")
|
||||
>basefoo : () => void
|
||||
>basefoo : () => void
|
||||
|
||||
=== /node_modules/some-library/foo.d.ts ===
|
||||
export declare function basefoo(): void;
|
||||
>basefoo : () => void
|
||||
|
||||
=== /index.ts ===
|
||||
import { iosfoo } from "some-library/foo";
|
||||
>iosfoo : () => void
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.ts] ////
|
||||
|
||||
//// [index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
//// [index.ios.d.ts]
|
||||
export declare function ios(): void;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
//// [index.d.ts]
|
||||
export declare function base(): void;
|
||||
|
||||
//// [test.ts]
|
||||
import { ios } from "some-library";
|
||||
import { ios as ios2 } from "some-library/index";
|
||||
import { ios as ios3 } from "some-library/index.js";
|
||||
|
||||
|
||||
//// [/bin/node_modules/some-library/lib/index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [/bin/node_modules/some-library/lib/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [/bin/test.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
=== /node_modules/some-library/lib/index.ios.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(index.ios.js, 0, 13))
|
||||
|
||||
function ios() {}
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 1, 26))
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>exports : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(index.ios.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/lib/index.ios.d.ts ===
|
||||
export declare function ios(): void;
|
||||
>ios : Symbol(ios, Decl(index.ios.d.ts, 0, 0))
|
||||
|
||||
=== /node_modules/some-library/lib/index.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(index.js, 0, 13))
|
||||
|
||||
function base() {}
|
||||
>base : Symbol(base, Decl(index.js, 1, 26))
|
||||
|
||||
exports.base = base;
|
||||
>exports.base : Symbol(base, Decl(index.js, 2, 18))
|
||||
>exports : Symbol(base, Decl(index.js, 2, 18))
|
||||
>base : Symbol(base, Decl(index.js, 2, 18))
|
||||
>base : Symbol(base, Decl(index.js, 1, 26))
|
||||
|
||||
=== /node_modules/some-library/lib/index.d.ts ===
|
||||
export declare function base(): void;
|
||||
>base : Symbol(base, Decl(index.d.ts, 0, 0))
|
||||
|
||||
=== /test.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : Symbol(ios, Decl(test.ts, 0, 8))
|
||||
|
||||
import { ios as ios2 } from "some-library/index";
|
||||
>ios : Symbol(ios, Decl(index.ios.d.ts, 0, 0))
|
||||
>ios2 : Symbol(ios2, Decl(test.ts, 1, 8))
|
||||
|
||||
import { ios as ios3 } from "some-library/index.js";
|
||||
>ios : Symbol(ios, Decl(index.ios.d.ts, 0, 0))
|
||||
>ios3 : Symbol(ios3, Decl(test.ts, 2, 8))
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
[
|
||||
"======== Resolving module 'some-library' from '/test.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/', using this value to resolve non-relative module name 'some-library'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'some-library'.",
|
||||
"Module name 'some-library', matched pattern 'some-library'.",
|
||||
"Trying substitution 'node_modules/some-library/lib', candidate module location: 'node_modules/some-library/lib'.",
|
||||
"Loading module as file / folder, candidate module location '/node_modules/some-library/lib', target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/lib.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/lib.ios.d.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib/package.json' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name 'some-library' was successfully resolved to '/node_modules/some-library/lib/index.ios.d.ts'. ========",
|
||||
"======== Resolving module 'some-library/index' from '/test.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/', using this value to resolve non-relative module name 'some-library/index'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'some-library/index'.",
|
||||
"Module name 'some-library/index', matched pattern 'some-library/*'.",
|
||||
"Trying substitution 'node_modules/some-library/lib/*', candidate module location: 'node_modules/some-library/lib/index'.",
|
||||
"Loading module as file / folder, candidate module location '/node_modules/some-library/lib/index', target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/lib/index.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.d.ts' exist - use it as a name resolution result.",
|
||||
"File '/node_modules/some-library/package.json' does not exist.",
|
||||
"======== Module name 'some-library/index' was successfully resolved to '/node_modules/some-library/lib/index.ios.d.ts'. ========",
|
||||
"======== Resolving module 'some-library/index.js' from '/test.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"'baseUrl' option is set to '/', using this value to resolve non-relative module name 'some-library/index.js'.",
|
||||
"'paths' option is specified, looking for a pattern to match module name 'some-library/index.js'.",
|
||||
"Module name 'some-library/index.js', matched pattern 'some-library/*'.",
|
||||
"Trying substitution 'node_modules/some-library/lib/*', candidate module location: 'node_modules/some-library/lib/index.js'.",
|
||||
"Loading module as file / folder, candidate module location '/node_modules/some-library/lib/index.js', target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/lib/index.js.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.js.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.js.ios.d.ts' does not exist.",
|
||||
"File name '/node_modules/some-library/lib/index.js' has a '.js' extension - stripping it.",
|
||||
"File '/node_modules/some-library/lib/index.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library/lib/index.ios.d.ts' exist - use it as a name resolution result.",
|
||||
"File '/node_modules/some-library/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Module name 'some-library/index.js' was successfully resolved to '/node_modules/some-library/lib/index.ios.d.ts'. ========"
|
||||
]
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
=== /node_modules/some-library/lib/index.ios.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/lib/index.ios")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios = ios : () => void
|
||||
>exports.ios : () => void
|
||||
>exports : typeof import("/node_modules/some-library/lib/index.ios")
|
||||
>ios : () => void
|
||||
>ios : () => void
|
||||
|
||||
=== /node_modules/some-library/lib/index.ios.d.ts ===
|
||||
export declare function ios(): void;
|
||||
>ios : () => void
|
||||
|
||||
=== /node_modules/some-library/lib/index.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/node_modules/some-library/lib/index")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function base() {}
|
||||
>base : () => void
|
||||
|
||||
exports.base = base;
|
||||
>exports.base = base : () => void
|
||||
>exports.base : () => void
|
||||
>exports : typeof import("/node_modules/some-library/lib/index")
|
||||
>base : () => void
|
||||
>base : () => void
|
||||
|
||||
=== /node_modules/some-library/lib/index.d.ts ===
|
||||
export declare function base(): void;
|
||||
>base : () => void
|
||||
|
||||
=== /test.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : () => void
|
||||
|
||||
import { ios as ios2 } from "some-library/index";
|
||||
>ios : () => void
|
||||
>ios2 : () => void
|
||||
|
||||
import { ios as ios3 } from "some-library/index.js";
|
||||
>ios : () => void
|
||||
>ios3 : () => void
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_externalTSModule.ts] ////
|
||||
|
||||
//// [index.ios.ts]
|
||||
export function ios() {}
|
||||
//// [index.ts]
|
||||
export function base() {}
|
||||
//// [test.ts]
|
||||
import { ios } from "some-library";
|
||||
|
||||
|
||||
//// [/bin/node_modules/some-library/index.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.ios = void 0;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [/bin/node_modules/some-library/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [/bin/test.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /node_modules/some-library/index.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : Symbol(ios, Decl(index.ios.ts, 0, 0))
|
||||
|
||||
=== /node_modules/some-library/index.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(index.ts, 0, 0))
|
||||
|
||||
=== /test.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : Symbol(ios, Decl(test.ts, 0, 8))
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[
|
||||
"======== Resolving module 'some-library' from '/test.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module 'some-library' from 'node_modules' folder, target file type 'TypeScript'.",
|
||||
"File '/node_modules/some-library/package.json' does not exist.",
|
||||
"File '/node_modules/some-library.ios.ts' does not exist.",
|
||||
"File '/node_modules/some-library.ios.tsx' does not exist.",
|
||||
"File '/node_modules/some-library.ios.d.ts' does not exist.",
|
||||
"File '/node_modules/some-library/index.ios.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/node_modules/some-library/index.ios.ts', result '/node_modules/some-library/index.ios.ts'.",
|
||||
"======== Module name 'some-library' was successfully resolved to '/node_modules/some-library/index.ios.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /node_modules/some-library/index.ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
=== /node_modules/some-library/index.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
=== /test.ts ===
|
||||
import { ios } from "some-library";
|
||||
>ios : () => void
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_jsModule.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "./foo.js";
|
||||
//// [foo.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
|
||||
|
||||
//// [/bin/foo.ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [/bin/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [/bin/foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,36 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo.js";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ios.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(foo.ios.js, 0, 13))
|
||||
|
||||
function ios() {}
|
||||
>ios : Symbol(ios, Decl(foo.ios.js, 1, 26))
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios : Symbol(ios, Decl(foo.ios.js, 2, 17))
|
||||
>exports : Symbol(ios, Decl(foo.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(foo.ios.js, 2, 17))
|
||||
>ios : Symbol(ios, Decl(foo.ios.js, 1, 26))
|
||||
|
||||
=== /foo.js ===
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
>exports : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
>__esModule : Symbol(__esModule, Decl(foo.js, 0, 13))
|
||||
|
||||
function base() {}
|
||||
>base : Symbol(base, Decl(foo.js, 1, 26))
|
||||
|
||||
exports.base = base;
|
||||
>exports.base : Symbol(base, Decl(foo.js, 2, 18))
|
||||
>exports : Symbol(base, Decl(foo.js, 2, 18))
|
||||
>base : Symbol(base, Decl(foo.js, 2, 18))
|
||||
>base : Symbol(base, Decl(foo.js, 1, 26))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[
|
||||
"======== Resolving module './foo.js' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo.js', target file type 'TypeScript'.",
|
||||
"File '/foo.js.ios.ts' does not exist.",
|
||||
"File '/foo.js.ios.tsx' does not exist.",
|
||||
"File '/foo.js.ios.d.ts' does not exist.",
|
||||
"File name '/foo.js' has a '.js' extension - stripping it.",
|
||||
"File '/foo.ios.ts' does not exist.",
|
||||
"File '/foo.ios.tsx' does not exist.",
|
||||
"File '/foo.ios.d.ts' does not exist.",
|
||||
"Directory '/foo.js' does not exist, skipping all lookups in it.",
|
||||
"Loading module as file / folder, candidate module location '/foo.js', target file type 'JavaScript'.",
|
||||
"File '/foo.js.ios.js' does not exist.",
|
||||
"File '/foo.js.ios.jsx' does not exist.",
|
||||
"File name '/foo.js' has a '.js' extension - stripping it.",
|
||||
"File '/foo.ios.js' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo.js' was successfully resolved to '/foo.ios.js'. ========"
|
||||
]
|
||||
@@ -0,0 +1,46 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo.js";
|
||||
>ios : () => void
|
||||
|
||||
=== /foo.ios.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/foo.ios")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
exports.ios = ios;
|
||||
>exports.ios = ios : () => void
|
||||
>exports.ios : () => void
|
||||
>exports : typeof import("/foo.ios")
|
||||
>ios : () => void
|
||||
>ios : () => void
|
||||
|
||||
=== /foo.js ===
|
||||
"use strict";
|
||||
>"use strict" : "use strict"
|
||||
|
||||
exports.__esModule = true;
|
||||
>exports.__esModule = true : true
|
||||
>exports.__esModule : true
|
||||
>exports : typeof import("/foo")
|
||||
>__esModule : true
|
||||
>true : true
|
||||
|
||||
function base() {}
|
||||
>base : () => void
|
||||
|
||||
exports.base = base;
|
||||
>exports.base = base : () => void
|
||||
>exports.base : () => void
|
||||
>exports : typeof import("/foo")
|
||||
>base : () => void
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_one_jsonModule.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import foo from "./foo.json";
|
||||
console.log(foo.ios);
|
||||
//// [foo.ios.json]
|
||||
{
|
||||
"ios": "platform ios"
|
||||
}
|
||||
//// [foo.json]
|
||||
{
|
||||
"base": "platform base"
|
||||
}
|
||||
|
||||
|
||||
//// [/bin/foo.ios.json]
|
||||
{
|
||||
"ios": "platform ios"
|
||||
}
|
||||
//// [/bin/index.js]
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
exports.__esModule = true;
|
||||
var foo_json_1 = __importDefault(require("./foo.json"));
|
||||
console.log(foo_json_1["default"].ios);
|
||||
@@ -0,0 +1,17 @@
|
||||
=== /index.ts ===
|
||||
import foo from "./foo.json";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 6))
|
||||
|
||||
console.log(foo.ios);
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>foo.ios : Symbol("ios", Decl(foo.ios.json, 0, 1))
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 6))
|
||||
>ios : Symbol("ios", Decl(foo.ios.json, 0, 1))
|
||||
|
||||
=== /foo.ios.json ===
|
||||
{
|
||||
"ios": "platform ios"
|
||||
>"ios" : Symbol("ios", Decl(foo.ios.json, 0, 1))
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
[
|
||||
"======== Resolving module './foo.json' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo.json', target file type 'TypeScript'.",
|
||||
"File '/foo.json.ios.ts' does not exist.",
|
||||
"File '/foo.json.ios.tsx' does not exist.",
|
||||
"File '/foo.json.ios.d.ts' does not exist.",
|
||||
"File name '/foo.json' has a '.json' extension - stripping it.",
|
||||
"File '/foo.json.ios.d.ts' does not exist.",
|
||||
"Directory '/foo.json' does not exist, skipping all lookups in it.",
|
||||
"Loading module as file / folder, candidate module location '/foo.json', target file type 'JavaScript'.",
|
||||
"File '/foo.json.ios.js' does not exist.",
|
||||
"File '/foo.json.ios.jsx' does not exist.",
|
||||
"File name '/foo.json' has a '.json' extension - stripping it.",
|
||||
"File '/foo.ios.json' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo.json' was successfully resolved to '/foo.ios.json'. ========"
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
=== /index.ts ===
|
||||
import foo from "./foo.json";
|
||||
>foo : { ios: string; }
|
||||
|
||||
console.log(foo.ios);
|
||||
>console.log(foo.ios) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>foo.ios : string
|
||||
>foo : { ios: string; }
|
||||
>ios : string
|
||||
|
||||
=== /foo.ios.json ===
|
||||
{
|
||||
>{ "ios": "platform ios"} : { ios: string; }
|
||||
|
||||
"ios": "platform ios"
|
||||
>"ios" : string
|
||||
>"platform ios" : "platform ios"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_threeLastIsBlank1.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { ios } from "./foo";
|
||||
//// [foo-ios.ts]
|
||||
export function ios() {}
|
||||
//// [foo__native.ts]
|
||||
export function native() {}
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo-ios.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.ios = void 0;
|
||||
function ios() { }
|
||||
exports.ios = ios;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [foo__native.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.native = void 0;
|
||||
function native() { }
|
||||
exports.native = native;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,16 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : Symbol(ios, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo-ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : Symbol(ios, Decl(foo-ios.ts, 0, 0))
|
||||
|
||||
=== /foo__native.ts ===
|
||||
export function native() {}
|
||||
>native : Symbol(native, Decl(foo__native.ts, 0, 0))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo-ios.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo-ios.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
=== /index.ts ===
|
||||
import { ios } from "./foo";
|
||||
>ios : () => void
|
||||
|
||||
=== /foo-ios.ts ===
|
||||
export function ios() {}
|
||||
>ios : () => void
|
||||
|
||||
=== /foo__native.ts ===
|
||||
export function native() {}
|
||||
>native : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_threeLastIsBlank2.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { native } from "./foo";
|
||||
//// [foo__native.ts]
|
||||
export function native() {}
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo__native.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.native = void 0;
|
||||
function native() { }
|
||||
exports.native = native;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { native } from "./foo";
|
||||
>native : Symbol(native, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo__native.ts ===
|
||||
export function native() {}
|
||||
>native : Symbol(native, Decl(foo__native.ts, 0, 0))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo-ios.ts' does not exist.",
|
||||
"File '/foo__native.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo__native.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
=== /index.ts ===
|
||||
import { native } from "./foo";
|
||||
>native : () => void
|
||||
|
||||
=== /foo__native.ts ===
|
||||
export function native() {}
|
||||
>native : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/moduleResolutionWithSuffixes_threeLastIsBlank3.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
import { base } from "./foo";
|
||||
//// [foo.ts]
|
||||
export function base() {}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.base = void 0;
|
||||
function base() { }
|
||||
exports.base = base;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : Symbol(base, Decl(index.ts, 0, 8))
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : Symbol(base, Decl(foo.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo-ios.ts' does not exist.",
|
||||
"File '/foo__native.ts' does not exist.",
|
||||
"File '/foo.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './foo' was successfully resolved to '/foo.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : () => void
|
||||
|
||||
=== /foo.ts ===
|
||||
export function base() {}
|
||||
>base : () => void
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/index.ts(1,22): error TS2307: Cannot find module './foo' or its corresponding type declarations.
|
||||
|
||||
|
||||
==== /tsconfig.json (0 errors) ====
|
||||
// moduleSuffixes has three entries, and the last one is blank. Module resolution should fail.
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": ["-ios", "__native", ""]
|
||||
}
|
||||
}
|
||||
|
||||
==== /index.ts (1 errors) ====
|
||||
import { base } from "./foo";
|
||||
~~~~~~~
|
||||
!!! error TS2307: Cannot find module './foo' or its corresponding type declarations.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [index.ts]
|
||||
import { base } from "./foo";
|
||||
|
||||
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : Symbol(base, Decl(index.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[
|
||||
"======== Resolving module './foo' from '/index.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.",
|
||||
"File '/foo-ios.ts' does not exist.",
|
||||
"File '/foo__native.ts' does not exist.",
|
||||
"File '/foo.ts' does not exist.",
|
||||
"File '/foo-ios.tsx' does not exist.",
|
||||
"File '/foo__native.tsx' does not exist.",
|
||||
"File '/foo.tsx' does not exist.",
|
||||
"File '/foo-ios.d.ts' does not exist.",
|
||||
"File '/foo__native.d.ts' does not exist.",
|
||||
"File '/foo.d.ts' does not exist.",
|
||||
"Directory '/foo' does not exist, skipping all lookups in it.",
|
||||
"Loading module as file / folder, candidate module location '/foo', target file type 'JavaScript'.",
|
||||
"File '/foo-ios.js' does not exist.",
|
||||
"File '/foo__native.js' does not exist.",
|
||||
"File '/foo.js' does not exist.",
|
||||
"File '/foo-ios.jsx' does not exist.",
|
||||
"File '/foo__native.jsx' does not exist.",
|
||||
"File '/foo.jsx' does not exist.",
|
||||
"Directory '/foo' does not exist, skipping all lookups in it.",
|
||||
"======== Module name './foo' was not resolved. ========"
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
=== /index.ts ===
|
||||
import { base } from "./foo";
|
||||
>base : any
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleSuffixes": []
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
"types": ["jquery","mocha"], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ interface Array<T> { length: number; [n: number]: T; }
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// moduleSuffixes is empty. Normal module resolution should occur.
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": []
|
||||
}
|
||||
}
|
||||
// @filename: /index.ts
|
||||
import { base } from "./foo";
|
||||
// @filename: /foo.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,12 @@
|
||||
// moduleSuffixes is not specified. Normal module resolution should occur.
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
}
|
||||
}
|
||||
// @filename: /index.ts
|
||||
import { base } from "./foo";
|
||||
// @filename: /foo.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,17 @@
|
||||
// moduleSuffixes has one entry and there's a matching file.
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
import { ios } from "./foo";
|
||||
// @filename: /foo.ios.ts
|
||||
export function ios() {}
|
||||
// @filename: /foo.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,15 @@
|
||||
// moduleSuffixes has one blank entry. Normal module resolution should occur.
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [""]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
import { base } from "./foo";
|
||||
// @filename: /foo.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,15 @@
|
||||
// moduleSuffixes has one entry but there isn't a matching file. Module resolution should fail.
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
import { ios } from "./foo";
|
||||
// @filename: /foo.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,17 @@
|
||||
// moduleSuffixes has one entry and there's a matching dir with an index file.
|
||||
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
import { ios } from "./foo";
|
||||
// @filename: /foo/index.ios.ts
|
||||
export function ios() {}
|
||||
// @filename: /foo/index.ts
|
||||
export function base() {}
|
||||
@@ -0,0 +1,31 @@
|
||||
// moduleSuffixes has one entry and there's a matching package.
|
||||
// @fullEmitPaths: true
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
"outDir": "bin",
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /node_modules/some-library/index.ios.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
// @filename: /node_modules/some-library/index.ios.d.ts
|
||||
export declare function ios(): void;
|
||||
// @filename: /node_modules/some-library/index.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
// @filename: /node_modules/some-library/index.d.ts
|
||||
export declare function base(): void;
|
||||
|
||||
// @filename: /index.ts
|
||||
import { ios } from "some-library";
|
||||
@@ -0,0 +1,31 @@
|
||||
// moduleSuffixes has one entry and there's a matching package with a specific path.
|
||||
// @fullEmitPaths: true
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
"outDir": "bin",
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /node_modules/some-library/foo.ios.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function iosfoo() {}
|
||||
exports.iosfoo = iosfoo;
|
||||
// @filename: /node_modules/some-library/foo.ios.d.ts
|
||||
export declare function iosfoo(): void;
|
||||
// @filename: /node_modules/some-library/foo.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function basefoo() {}
|
||||
exports.basefoo = basefoo;
|
||||
// @filename: /node_modules/some-library/foo.d.ts
|
||||
export declare function basefoo(): void;
|
||||
|
||||
// @filename: /index.ts
|
||||
import { iosfoo } from "some-library/foo";
|
||||
@@ -0,0 +1,38 @@
|
||||
// moduleSuffixes has one entry and there's a matching package. use the 'paths' option to map the package.
|
||||
// @fullEmitPaths: true
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
"outDir": "bin",
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"],
|
||||
"baseUrl": "/",
|
||||
"paths": {
|
||||
"some-library": ["node_modules/some-library/lib"],
|
||||
"some-library/*": ["node_modules/some-library/lib/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /node_modules/some-library/lib/index.ios.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
// @filename: /node_modules/some-library/lib/index.ios.d.ts
|
||||
export declare function ios(): void;
|
||||
// @filename: /node_modules/some-library/lib/index.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
// @filename: /node_modules/some-library/lib/index.d.ts
|
||||
export declare function base(): void;
|
||||
|
||||
// @filename: /test.ts
|
||||
import { ios } from "some-library";
|
||||
import { ios as ios2 } from "some-library/index";
|
||||
import { ios as ios3 } from "some-library/index.js";
|
||||
@@ -0,0 +1,18 @@
|
||||
// moduleSuffixes has one entry and there's a matching package with TS files.
|
||||
// @fullEmitPaths: true
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "bin",
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /node_modules/some-library/index.ios.ts
|
||||
export function ios() {}
|
||||
// @filename: /node_modules/some-library/index.ts
|
||||
export function base() {}
|
||||
// @filename: /test.ts
|
||||
import { ios } from "some-library";
|
||||
@@ -0,0 +1,26 @@
|
||||
// moduleSuffixes has one entry and there's a matching file. module name explicitly includes JS file extension.
|
||||
// @fullEmitPaths: true
|
||||
// @filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
"outDir": "bin",
|
||||
"moduleResolution": "node",
|
||||
"traceResolution": true,
|
||||
"moduleSuffixes": [".ios"]
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /index.ts
|
||||
import { ios } from "./foo.js";
|
||||
// @filename: /foo.ios.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function ios() {}
|
||||
exports.ios = ios;
|
||||
// @filename: /foo.js
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function base() {}
|
||||
exports.base = base;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user