esbuild-register
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -52,3 +52,11 @@ 'use strict'; | ||
} | ||
const DEFAULT_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx', '.mjs']; | ||
const FILE_LOADERS = { | ||
'.js': 'js', | ||
'.jsx': 'jsx', | ||
'.ts': 'ts', | ||
'.tsx': 'tsx', | ||
'.mjs': 'js', | ||
}; | ||
const DEFAULT_EXTENSIONS = Object.keys(FILE_LOADERS); | ||
const getLoader = (filename) => FILE_LOADERS[path.extname(filename)]; | ||
function compile(code, filename) { | ||
@@ -59,4 +67,3 @@ const options = getOptions(path.dirname(filename)); | ||
sourcemap: true, | ||
// Just use tsx for everything until we find a way to let user configure this | ||
loader: 'tsx', | ||
loader: getLoader(filename), | ||
target: options.target, | ||
@@ -63,0 +70,0 @@ jsxFactory: options.jsxFactory, |
{ | ||
"name": "esbuild-register", | ||
"description": "Transpile JSX, TypeScript and esnext features on the fly with esbuild", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"main": "register.js", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -21,4 +21,12 @@ # esbuild-register | ||
When using Yarn, you can add an npm script: | ||
```json | ||
"ts": "node -r esm -r esbuild-register" | ||
``` | ||
to shorten the command, now just run `yarn ts file.ts` instead. | ||
## License | ||
MIT © [EGOIST (Kevin Titor)](https://egoist.sh) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5466
81
32