Closed marco-ippolito closed 2 months ago
This will behave exactly as the one in core, and it requires --experimental-strip-types
to be enabled, so it uses node.js .ts resolution. This only overrides the swc transform function, and I would like to make it customizable.
If in the future typescript releases a major version, and has breaking changes, we might keep the amaro version in core locked. This allows users to update amaro and use it regardless of the node version
PTAL @nodejs/typescript @nodejs/loaders
There are cases in node core where source will be undefined https://github.com/nodejs/node/blob/3cbeed88d9de9231f420ba53ad0e4d4a7af9c637/lib/internal/modules/esm/get_format.js#L131-L136
There are cases in node core where source will be undefined https://github.com/nodejs/node/blob/3cbeed88d9de9231f420ba53ad0e4d4a7af9c637/lib/internal/modules/esm/get_format.js#L131-L136
IIUC that's only true for when format
is nullish; the comment explains when defaultResolve
returns a nullish format – and it doesn't matter for us, because Amaro will only deal with TS files
There are cases in node core where source will be undefined https://github.com/nodejs/node/blob/3cbeed88d9de9231f420ba53ad0e4d4a7af9c637/lib/internal/modules/esm/get_format.js#L131-L136
IIUC that's only true for when
format
is nullish; the comment explains whendefaultResolve
returns a nullish format – and it doesn't matter for us, because Amaro will only deal with TS files
Apparently it happens so I had to add the check here https://github.com/nodejs/node/blob/3cbeed88d9de9231f420ba53ad0e4d4a7af9c637/lib/internal/modules/helpers.js#L335
It is now possible to use amaro as external loader, that behaves the same way as in core, but allows to decouple the typescript version supported