cts, mts, cjs, mjs, etc extension support#67
Closed
weswigham wants to merge 9 commits intomodule-nodefrom
Closed
Conversation
sandersn
reviewed
Aug 12, 2021
Collaborator
sandersn
left a comment
There was a problem hiding this comment.
Initial comments -- mostly questions about the new Extension[][] structure for supported extensions.
| export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[]; | ||
| export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: readonly FileExtensionInfo[]): readonly string[] { | ||
| const supportedTSExtensionsForExtractExtension: readonly Extension[] = [Extension.Dts, Extension.Dcts, Extension.Dmts, Extension.Cts, Extension.Mts, Extension.Ts, Extension.Tsx, Extension.Cts, Extension.Mts]; | ||
| export const supportedJSExtensions: readonly Extension[][] = [[Extension.Js, Extension.Jsx], [Extension.Mjs], [Extension.Cjs]]; |
Collaborator
There was a problem hiding this comment.
I can't find where the non-flat version is used.
|
@typescript-bot pack this |
|
D'oh. |
|
Might be worth making this a separate draft PR to TypeScript so we can get |
Owner
Author
|
microsoft#45774 should track this on the TS repo and be a place where you can run bot commands (versus usefully review code) |
sandersn
approved these changes
Sep 15, 2021
|
|
||
| /** | ||
| * List of supported extensions in order of file resolution precedence. | ||
| * Groups of supported extensions in order of file resolution precedence. (eg, TS > TSX > DTS and seperately, CTS > DCTS) |
Collaborator
There was a problem hiding this comment.
Suggested change
| * Groups of supported extensions in order of file resolution precedence. (eg, TS > TSX > DTS and seperately, CTS > DCTS) | |
| * Groups of supported extensions in order of file resolution precedence. (eg, TS > TSX > DTS and separately, CTS > DCTS) |
andrewbranch
approved these changes
Sep 22, 2021
Owner
Author
|
Merged in microsoft#45884 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my first followup to
microsoft#44501 which officially adds support for loading
.mjs,.cjs,.mts,.cts,.d.mts, and.d.ctsfiles. In non-nodemoduleResolutionmodes, these are largely the same as.js,.ts, and.d.ts- the only difference being the output path mappings - a.mtsor.mjsinput always makes a.mjsand.d.mtsoutput, while a.cjsor.ctsinput always makes a.cjsand.d.ctsoutput. Innodeish module resolution modes,c-prefixed files imply a commonjs emit format, whilem-prefixed files imply an esm format. As we've discussed in design meetings, to avoid comitting to a direction, we also forbid ambiguous generic arrow functions and angle bracket type cast syntax in.ctsand.mtsfiles, so we can reserve the right to make these files parse as jsx in the future.The watch/build mode baseline tests currently don't show any changes with edits, due to the bug fixed in microsoft#44935 - that'll need to get pulled in, and, once it is, the baseline updated.