1 |
3a515b92
|
cagy
|
var extensions = {
|
2 |
|
|
'.babel.js': [
|
3 |
|
|
{
|
4 |
|
|
module: '@babel/register',
|
5 |
|
|
register: function(hook) {
|
6 |
|
|
// register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353
|
7 |
|
|
// which only captures the final extension (.babel.js -> .js)
|
8 |
|
|
hook({ extensions: '.js' });
|
9 |
|
|
},
|
10 |
|
|
},
|
11 |
|
|
{
|
12 |
|
|
module: 'babel-register',
|
13 |
|
|
register: function(hook) {
|
14 |
|
|
hook({ extensions: '.js' });
|
15 |
|
|
},
|
16 |
|
|
},
|
17 |
|
|
{
|
18 |
|
|
module: 'babel-core/register',
|
19 |
|
|
register: function(hook) {
|
20 |
|
|
hook({ extensions: '.js' });
|
21 |
|
|
},
|
22 |
|
|
},
|
23 |
|
|
{
|
24 |
|
|
module: 'babel/register',
|
25 |
|
|
register: function(hook) {
|
26 |
|
|
hook({ extensions: '.js' });
|
27 |
|
|
},
|
28 |
|
|
},
|
29 |
|
|
],
|
30 |
|
|
'.babel.ts': [
|
31 |
|
|
{
|
32 |
|
|
module: '@babel/register',
|
33 |
|
|
register: function(hook) {
|
34 |
|
|
hook({ extensions: '.ts' });
|
35 |
|
|
},
|
36 |
|
|
},
|
37 |
|
|
],
|
38 |
|
|
'.buble.js': 'buble/register',
|
39 |
|
|
'.cirru': 'cirru-script/lib/register',
|
40 |
|
|
'.cjsx': 'node-cjsx/register',
|
41 |
|
|
'.co': 'coco',
|
42 |
|
|
'.coffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'],
|
43 |
|
|
'.coffee.md': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'],
|
44 |
|
|
'.csv': 'require-csv',
|
45 |
|
|
'.eg': 'earlgrey/register',
|
46 |
|
|
'.esm.js': {
|
47 |
|
|
module: 'esm',
|
48 |
|
|
register: function(hook) {
|
49 |
|
|
// register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353
|
50 |
|
|
// which only captures the final extension (.babel.js -> .js)
|
51 |
|
|
var esmLoader = hook(module);
|
52 |
|
|
require.extensions['.js'] = esmLoader('module')._extensions['.js'];
|
53 |
|
|
},
|
54 |
|
|
},
|
55 |
|
|
'.iced': ['iced-coffee-script/register', 'iced-coffee-script'],
|
56 |
|
|
'.iced.md': 'iced-coffee-script/register',
|
57 |
|
|
'.ini': 'require-ini',
|
58 |
|
|
'.js': null,
|
59 |
|
|
'.json': null,
|
60 |
|
|
'.json5': 'json5/lib/require',
|
61 |
|
|
'.jsx': [
|
62 |
|
|
{
|
63 |
|
|
module: '@babel/register',
|
64 |
|
|
register: function(hook) {
|
65 |
|
|
hook({ extensions: '.jsx' });
|
66 |
|
|
},
|
67 |
|
|
},
|
68 |
|
|
{
|
69 |
|
|
module: 'babel-register',
|
70 |
|
|
register: function(hook) {
|
71 |
|
|
hook({ extensions: '.jsx' });
|
72 |
|
|
},
|
73 |
|
|
},
|
74 |
|
|
{
|
75 |
|
|
module: 'babel-core/register',
|
76 |
|
|
register: function(hook) {
|
77 |
|
|
hook({ extensions: '.jsx' });
|
78 |
|
|
},
|
79 |
|
|
},
|
80 |
|
|
{
|
81 |
|
|
module: 'babel/register',
|
82 |
|
|
register: function(hook) {
|
83 |
|
|
hook({ extensions: '.jsx' });
|
84 |
|
|
},
|
85 |
|
|
},
|
86 |
|
|
{
|
87 |
|
|
module: 'node-jsx',
|
88 |
|
|
register: function(hook) {
|
89 |
|
|
hook.install({ extension: '.jsx', harmony: true });
|
90 |
|
|
},
|
91 |
|
|
},
|
92 |
|
|
],
|
93 |
|
|
'.litcoffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'],
|
94 |
|
|
'.liticed': 'iced-coffee-script/register',
|
95 |
|
|
'.ls': ['livescript', 'LiveScript'],
|
96 |
|
|
'.node': null,
|
97 |
|
|
'.toml': {
|
98 |
|
|
module: 'toml-require',
|
99 |
|
|
register: function(hook) {
|
100 |
|
|
hook.install();
|
101 |
|
|
},
|
102 |
|
|
},
|
103 |
|
|
'.ts': [
|
104 |
|
|
'ts-node/register',
|
105 |
|
|
'typescript-node/register',
|
106 |
|
|
'typescript-register',
|
107 |
|
|
'typescript-require',
|
108 |
|
|
{
|
109 |
|
|
module: '@babel/register',
|
110 |
|
|
register: function(hook) {
|
111 |
|
|
hook({ extensions: '.ts' });
|
112 |
|
|
},
|
113 |
|
|
},
|
114 |
|
|
],
|
115 |
|
|
'.tsx': [
|
116 |
|
|
'ts-node/register',
|
117 |
|
|
'typescript-node/register',
|
118 |
|
|
{
|
119 |
|
|
module: '@babel/register',
|
120 |
|
|
register: function(hook) {
|
121 |
|
|
hook({ extensions: '.tsx' });
|
122 |
|
|
},
|
123 |
|
|
},
|
124 |
|
|
],
|
125 |
|
|
'.wisp': 'wisp/engine/node',
|
126 |
|
|
'.xml': 'require-xml',
|
127 |
|
|
'.yaml': 'require-yaml',
|
128 |
|
|
'.yml': 'require-yaml',
|
129 |
|
|
};
|
130 |
|
|
|
131 |
|
|
var jsVariantExtensions = [
|
132 |
|
|
'.js',
|
133 |
|
|
'.babel.js',
|
134 |
|
|
'.babel.ts',
|
135 |
|
|
'.buble.js',
|
136 |
|
|
'.cirru',
|
137 |
|
|
'.cjsx',
|
138 |
|
|
'.co',
|
139 |
|
|
'.coffee',
|
140 |
|
|
'.coffee.md',
|
141 |
|
|
'.eg',
|
142 |
|
|
'.esm.js',
|
143 |
|
|
'.iced',
|
144 |
|
|
'.iced.md',
|
145 |
|
|
'.jsx',
|
146 |
|
|
'.litcoffee',
|
147 |
|
|
'.liticed',
|
148 |
|
|
'.ls',
|
149 |
|
|
'.ts',
|
150 |
|
|
'.tsx',
|
151 |
|
|
'.wisp',
|
152 |
|
|
];
|
153 |
|
|
|
154 |
|
|
module.exports = {
|
155 |
|
|
extensions: extensions,
|
156 |
|
|
jsVariants: jsVariantExtensions.reduce(function(result, ext) {
|
157 |
|
|
result[ext] = extensions[ext];
|
158 |
|
|
return result;
|
159 |
|
|
}, {}),
|
160 |
|
|
};
|