-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--moduleResolution bundler
: Require ESM for module
and remove `no…
…de` from hard-coded conditions (#52940)
- Loading branch information
1 parent
3f7bf69
commit e9868e9
Showing
78 changed files
with
635 additions
and
209 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
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
2 changes: 2 additions & 0 deletions
2
tests/baselines/reference/allowImportingTsExtensions(moduleresolution=bundler).errors.txt
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
44 changes: 44 additions & 0 deletions
44
tests/baselines/reference/bundlerConditionsExcludesNode.errors.txt
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,44 @@ | ||
error TS6504: File '/node_modules/conditions/index.node.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? | ||
The file is in the program because: | ||
Root file specified for compilation | ||
error TS6504: File '/node_modules/conditions/index.web.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? | ||
The file is in the program because: | ||
Root file specified for compilation | ||
|
||
|
||
!!! error TS6504: File '/node_modules/conditions/index.node.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? | ||
!!! error TS6504: The file is in the program because: | ||
!!! error TS6504: Root file specified for compilation | ||
!!! error TS6504: File '/node_modules/conditions/index.web.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? | ||
!!! error TS6504: The file is in the program because: | ||
!!! error TS6504: Root file specified for compilation | ||
==== /node_modules/conditions/package.json (0 errors) ==== | ||
{ | ||
"name": "conditions", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"main": "index.cjs", | ||
"types": "index.d.cts", | ||
"exports": { | ||
".": { | ||
"node": "./index.node.js", | ||
"default": "./index.web.js" | ||
} | ||
} | ||
} | ||
|
||
==== /node_modules/conditions/index.node.js (0 errors) ==== | ||
export const node = 0; | ||
|
||
==== /node_modules/conditions/index.node.d.ts (0 errors) ==== | ||
export const node: number; | ||
|
||
==== /node_modules/conditions/index.web.js (0 errors) ==== | ||
export const web = 0; | ||
|
||
==== /node_modules/conditions/index.web.d.ts (0 errors) ==== | ||
export const web: number; | ||
|
||
==== /main.ts (0 errors) ==== | ||
import { web } from "conditions"; | ||
|
35 changes: 35 additions & 0 deletions
35
tests/baselines/reference/bundlerConditionsExcludesNode.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,35 @@ | ||
//// [tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts] //// | ||
|
||
//// [package.json] | ||
{ | ||
"name": "conditions", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"main": "index.cjs", | ||
"types": "index.d.cts", | ||
"exports": { | ||
".": { | ||
"node": "./index.node.js", | ||
"default": "./index.web.js" | ||
} | ||
} | ||
} | ||
|
||
//// [index.node.js] | ||
export const node = 0; | ||
|
||
//// [index.node.d.ts] | ||
export const node: number; | ||
|
||
//// [index.web.js] | ||
export const web = 0; | ||
|
||
//// [index.web.d.ts] | ||
export const web: number; | ||
|
||
//// [main.ts] | ||
import { web } from "conditions"; | ||
|
||
|
||
//// [main.js] | ||
export {}; |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/bundlerConditionsExcludesNode.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,12 @@ | ||
=== /node_modules/conditions/index.node.d.ts === | ||
export const node: number; | ||
>node : Symbol(node, Decl(index.node.d.ts, 0, 12)) | ||
|
||
=== /node_modules/conditions/index.web.d.ts === | ||
export const web: number; | ||
>web : Symbol(web, Decl(index.web.d.ts, 0, 12)) | ||
|
||
=== /main.ts === | ||
import { web } from "conditions"; | ||
>web : Symbol(web, Decl(main.ts, 0, 8)) | ||
|
20 changes: 20 additions & 0 deletions
20
tests/baselines/reference/bundlerConditionsExcludesNode.trace.json
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,20 @@ | ||
[ | ||
"======== Resolving module 'conditions' from '/main.ts'. ========", | ||
"Explicitly specified module resolution kind: 'Bundler'.", | ||
"Resolving in CJS mode with conditions 'import', 'types'.", | ||
"File '/package.json' does not exist.", | ||
"Loading module 'conditions' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", | ||
"Found 'package.json' at '/node_modules/conditions/package.json'.", | ||
"Entering conditional exports.", | ||
"Saw non-matching condition 'node'.", | ||
"Matched 'exports' condition 'default'.", | ||
"Using 'exports' subpath '.' with target './index.web.js'.", | ||
"File name '/node_modules/conditions/index.web.js' has a '.js' extension - stripping it.", | ||
"File '/node_modules/conditions/index.web.ts' does not exist.", | ||
"File '/node_modules/conditions/index.web.tsx' does not exist.", | ||
"File '/node_modules/conditions/index.web.d.ts' exists - use it as a name resolution result.", | ||
"Resolved under condition 'default'.", | ||
"Exiting conditional exports.", | ||
"Resolving real path for '/node_modules/conditions/index.web.d.ts', result '/node_modules/conditions/index.web.d.ts'.", | ||
"======== Module name 'conditions' was successfully resolved to '/node_modules/conditions/index.web.d.ts' with Package ID 'conditions/[email protected]'. ========" | ||
] |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/bundlerConditionsExcludesNode.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,12 @@ | ||
=== /node_modules/conditions/index.node.d.ts === | ||
export const node: number; | ||
>node : number | ||
|
||
=== /node_modules/conditions/index.web.d.ts === | ||
export const web: number; | ||
>web : number | ||
|
||
=== /main.ts === | ||
import { web } from "conditions"; | ||
>web : number | ||
|
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
Oops, something went wrong.