forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick PR microsoft#46156 into release-4.5
Component commits: 7e3a80a Modify synthetic default generation code for dual-mode module resolution
- Loading branch information
1 parent
bcd0773
commit 1444688
Showing
14 changed files
with
236 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node12).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//// [tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts] //// | ||
|
||
//// [index.ts] | ||
// cjs format file | ||
export const a = 1; | ||
//// [index.ts] | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
mod; | ||
//// [package.json] | ||
{ | ||
"name": "package", | ||
"private": true, | ||
"type": "module" | ||
} | ||
//// [package.json] | ||
{ | ||
"type": "commonjs" | ||
} | ||
|
||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.a = void 0; | ||
// cjs format file | ||
exports.a = 1; | ||
//// [index.js] | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
mod; | ||
|
||
|
||
//// [index.d.ts] | ||
export declare const a = 1; | ||
//// [index.d.ts] | ||
export {}; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node12).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/conformance/node/subfolder/index.ts === | ||
// cjs format file | ||
export const a = 1; | ||
>a : Symbol(a, Decl(index.ts, 1, 12)) | ||
|
||
=== tests/cases/conformance/node/index.ts === | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
>mod : Symbol(mod, Decl(index.ts, 1, 6)) | ||
|
||
mod; | ||
>mod : Symbol(mod, Decl(index.ts, 1, 6)) | ||
|
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node12).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/node/subfolder/index.ts === | ||
// cjs format file | ||
export const a = 1; | ||
>a : 1 | ||
>1 : 1 | ||
|
||
=== tests/cases/conformance/node/index.ts === | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
>mod : typeof mod | ||
|
||
mod; | ||
>mod : typeof mod | ||
|
36 changes: 36 additions & 0 deletions
36
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//// [tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts] //// | ||
|
||
//// [index.ts] | ||
// cjs format file | ||
export const a = 1; | ||
//// [index.ts] | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
mod; | ||
//// [package.json] | ||
{ | ||
"name": "package", | ||
"private": true, | ||
"type": "module" | ||
} | ||
//// [package.json] | ||
{ | ||
"type": "commonjs" | ||
} | ||
|
||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.a = void 0; | ||
// cjs format file | ||
exports.a = 1; | ||
//// [index.js] | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
mod; | ||
|
||
|
||
//// [index.d.ts] | ||
export declare const a = 1; | ||
//// [index.d.ts] | ||
export {}; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/conformance/node/subfolder/index.ts === | ||
// cjs format file | ||
export const a = 1; | ||
>a : Symbol(a, Decl(index.ts, 1, 12)) | ||
|
||
=== tests/cases/conformance/node/index.ts === | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
>mod : Symbol(mod, Decl(index.ts, 1, 6)) | ||
|
||
mod; | ||
>mod : Symbol(mod, Decl(index.ts, 1, 6)) | ||
|
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/conformance/node/subfolder/index.ts === | ||
// cjs format file | ||
export const a = 1; | ||
>a : 1 | ||
>1 : 1 | ||
|
||
=== tests/cases/conformance/node/index.ts === | ||
// esm format file | ||
import mod from "./subfolder/index.js"; | ||
>mod : typeof mod | ||
|
||
mod; | ||
>mod : typeof mod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.