-
Notifications
You must be signed in to change notification settings - Fork 35
Conversation
* Returns the module format that should be used when transpiling a TypeScript | ||
* file. | ||
*/ | ||
const getTSModuleFormat = async ( |
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.
This is now called getModuleFormat
in transformer.ts
.
rewrites: Map<string, string> | ||
} | ||
|
||
const getTypeScriptTransformer = async ( |
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.
This is now called getTransformer
in transformer.ts
.
path: string | ||
} | ||
|
||
export const transpileTS = async ({ bundle = false, config, format, name, path }: TranspileTSOptions) => { |
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.
This is now called transform
in transformer.ts
.
⏱ Benchmark resultsComparing with 1eccedc largeDepsEsbuild: 2.6s⬇️ 9.45% decrease vs. 1eccedc
Legend
largeDepsNft: 8.1s⬇️ 4.42% decrease vs. 1eccedc
Legend
largeDepsZisi: 15.9s⬆️ 0.06% increase vs. 1eccedc
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.
I found the diff hard to review - but I think it looks good. And since you didn't touch a lot of tests, i'm trusting this to be fine.
* feat: always bundle V2 functions * refactor: rename to `transformer` * refactor: always bundle * refactor: update conditions * chore: update tests
Summary
I realised that we were only transforming V2 functions (i.e. running them through esbuild) when the extension was a TypeScript extension. But we should also do it for JavaScript functions, since bundling local imports is essential to ensure imports between ESM and CJS work as expected.
I ended up renaming the "TS transformer" to a generic transformer, and I moved it into its own file.