index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const extensions = {
  2. '.babel.js': [
  3. {
  4. module: 'babel-core/register',
  5. register: function (module) {
  6. module({
  7. // register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353
  8. // which only captures the final extension (.babel.js -> .js)
  9. extensions: '.js'
  10. });
  11. }
  12. },
  13. {
  14. module: 'babel/register',
  15. register: function (module) {
  16. module({
  17. extensions: '.js'
  18. });
  19. }
  20. }
  21. ],
  22. '.cirru': 'cirru-script/lib/register',
  23. '.cjsx': 'node-cjsx/register',
  24. '.co': 'coco',
  25. '.coffee': ['coffee-script/register', 'coffee-script'],
  26. '.coffee.md': ['coffee-script/register', 'coffee-script'],
  27. '.csv': 'require-csv',
  28. '.eg': 'earlgrey/register',
  29. '.iced': ['iced-coffee-script/register', 'iced-coffee-script'],
  30. '.iced.md': 'iced-coffee-script/register',
  31. '.ini': 'require-ini',
  32. '.js': null,
  33. '.json': null,
  34. '.json5': 'json5/lib/require',
  35. '.jsx': [
  36. {
  37. module: 'babel-core/register',
  38. register: function (module) {
  39. module({
  40. extensions: '.jsx'
  41. });
  42. }
  43. },
  44. {
  45. module: 'babel/register',
  46. register: function (module) {
  47. module({
  48. extensions: '.jsx'
  49. });
  50. },
  51. },
  52. {
  53. module: 'node-jsx',
  54. register: function (module) {
  55. module.install({
  56. extension: '.jsx',
  57. harmony: true
  58. });
  59. }
  60. }
  61. ],
  62. '.litcoffee': ['coffee-script/register', 'coffee-script'],
  63. '.liticed': 'iced-coffee-script/register',
  64. '.ls': ['livescript', 'LiveScript'],
  65. '.node': null,
  66. '.toml': {
  67. module: 'toml-require',
  68. register: function (module) {
  69. module.install();
  70. }
  71. },
  72. '.ts': ['ts-node/register', 'typescript-node/register', 'typescript-register', 'typescript-require'],
  73. '.tsx': ['ts-node/register', 'typescript-node/register'],
  74. '.wisp': 'wisp/engine/node',
  75. '.xml': 'require-xml',
  76. '.yaml': 'require-yaml',
  77. '.yml': 'require-yaml'
  78. };
  79. const jsVariantExtensions = [
  80. '.js',
  81. '.babel.js',
  82. '.cirru',
  83. '.cjsx',
  84. '.co',
  85. '.coffee',
  86. '.coffee.md',
  87. '.eg',
  88. '.iced',
  89. '.iced.md',
  90. '.jsx',
  91. '.litcoffee',
  92. '.liticed',
  93. '.ls',
  94. '.ts',
  95. '.wisp'
  96. ];
  97. module.exports = {
  98. extensions: extensions,
  99. jsVariants: jsVariantExtensions.reduce(function (result, ext) {
  100. result[ext] = extensions[ext];
  101. return result;
  102. }, {})
  103. };