-
Notifications
You must be signed in to change notification settings - Fork 35
fix: infer TS module format from package.json
#1580
Conversation
⏱ Benchmark resultsComparing with 7aeed4d largeDepsEsbuild: 3.2s⬆️ 7.19% increase vs. 7aeed4d
Legend
largeDepsNft: 9.3s⬇️ 0.92% decrease vs. 7aeed4d
Legend
largeDepsZisi: 18.3s⬆️ 1.77% increase vs. 7aeed4d
Legend
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, that's what I meant in Slack
// Returns the module format that should be used when transpiling a TypeScript | ||
// file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: comments for functions/methods or variables should always be JSDoc as the IntelliSense can pick them up. A regular code block comment should be just used inside functions as it is not part of the AST
// Returns the module format that should be used when transpiling a TypeScript | |
// file. | |
/** | |
* Returns the module format that should be used when transpiling a TypeScript | |
* file. | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 99f27ba.
src/runtimes/node/utils/tsconfig.ts
Outdated
// Looks for a `tsconfig.json` file on a given path and, if one exists, returns | ||
// the module format inferred from the `module` property. If no file is found | ||
// or if no `module` property is defined, the function returns `undefined`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Looks for a `tsconfig.json` file on a given path and, if one exists, returns | |
// the module format inferred from the `module` property. If no file is found | |
// or if no `module` property is defined, the function returns `undefined`. | |
/** | |
* Looks for a `tsconfig.json` file on a given path and, if one exists, returns | |
* the module format inferred from the `module` property. If no file is found | |
* or if no `module` property is defined, the function returns `undefined`. | |
*/ |
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 99f27ba.
…hip-it#1580) * fix: infer TS module format from `package.json` * chore: typo * chore: update comments
Summary
Currently we're only looking at
tsconfig.json
to infer the module type. We need to also look atpackage.json
as a fallback.