/
all.js
37 lines (32 loc) · 1.02 KB
/
all.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as coffee from './coffee.js'
import * as ts from 'ts-node/esm'
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
const tsRegex = /\.ts$/;
export function resolve(specifier, context, defaultResolve) {
if (coffeeRegex.test(specifier)) {
return coffee.resolve.apply(this, arguments)
}
if (tsRegex.test(specifier)) {
return ts.resolve.apply(this, arguments)
}
return ts.resolve.apply(this, arguments);
}
export function getFormat(url, context, defaultGetFormat) {
if (coffeeRegex.test(url)) {
return coffee.getFormat.apply(this, arguments)
}
if (tsRegex.test(url)) {
return ts.getFormat.apply(this, arguments)
}
return ts.getFormat.apply(this, arguments);
}
export function transformSource(source, context, defaultTransformSource) {
const { url } = context;
if (coffeeRegex.test(url)) {
return coffee.transformSource.apply(this, arguments)
}
if (tsRegex.test(url)) {
return ts.transformSource.apply(this, arguments)
}
return ts.transformSource.apply(this, arguments);
}