Skip to content

Commit

Permalink
feat: bun (#359)
Browse files Browse the repository at this point in the history
* feat: bun

* Update src/lib/strategies/LoaderStrategy.ts

Co-authored-by: Jeroen Claassens <support@favware.tech>

---------

Co-authored-by: Jeroen Claassens <support@favware.tech>
  • Loading branch information
vladfrangu and favna committed Dec 9, 2023
1 parent 6d6919c commit 2f862f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/strategies/LoaderStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ export class LoaderStrategy<T extends Piece> implements ILoaderStrategy<T> {

public constructor() {
/**
* If {@linkplain https://github.com/TypeStrong/ts-node ts-node} is being used
* we conditionally need to register files ending in the `.ts` file extension.
* If either {@linkplain https://github.com/TypeStrong/ts-node ts-node} or {@linkplain https://bun.sh bun}
* are being used we conditionally need to register files ending in the `.ts` file extension.
*
* This is because `ts-node` builds files into memory, so we have to scan the
* For `ts-node` this is because it loads files into memory, so we have to scan the
* source `.ts` files, rather than files emitted with any of the JavaScript
* extensions.
*
* For `bun` this is because it natively supports TypeScript, so we also want to check TypeScript files.
*/
if (Reflect.has(process, Symbol.for('ts-node.register.instance')) || !isNullish(process.env.TS_NODE_DEV)) {
if (Reflect.has(process, Symbol.for('ts-node.register.instance')) || !isNullish(process.env.TS_NODE_DEV) || 'bun' in process.versions) {
this.supportedExtensions.push('.ts', '.cts', '.mts');
this.filterDtsFiles = true;
}
Expand Down

0 comments on commit 2f862f4

Please sign in to comment.