index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. const extensions = {
  2. '.babel.js': [
  3. {
  4. module: 'babel-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-core/register',
  15. register: function (module) {
  16. module({
  17. extensions: '.js'
  18. });
  19. }
  20. },
  21. {
  22. module: 'babel/register',
  23. register: function (module) {
  24. module({
  25. extensions: '.js'
  26. });
  27. }
  28. }
  29. ],
  30. '.buble.js': [
  31. {
  32. module: 'buble/register',
  33. register: function (module) {
  34. module({
  35. extensions: '.js'
  36. });
  37. }
  38. }
  39. ],
  40. '.cirru': 'cirru-script/lib/register',
  41. '.cjsx': 'node-cjsx/register',
  42. '.co': 'coco',
  43. '.coffee': ['coffee-script/register', 'coffee-script'],
  44. '.coffee.md': ['coffee-script/register', 'coffee-script'],
  45. '.csv': 'require-csv',
  46. '.eg': 'earlgrey/register',
  47. '.iced': ['iced-coffee-script/register', 'iced-coffee-script'],
  48. '.iced.md': 'iced-coffee-script/register',
  49. '.ini': 'require-ini',
  50. '.js': null,
  51. '.json': null,
  52. '.json5': 'json5/lib/require',
  53. '.jsx': [
  54. {
  55. module: 'babel-register',
  56. register: function (module) {
  57. module({
  58. extensions: '.jsx'
  59. });
  60. }
  61. },
  62. {
  63. module: 'babel-core/register',
  64. register: function (module) {
  65. module({
  66. extensions: '.jsx'
  67. });
  68. }
  69. },
  70. {
  71. module: 'babel/register',
  72. register: function (module) {
  73. module({
  74. extensions: '.jsx'
  75. });
  76. },
  77. },
  78. {
  79. module: 'node-jsx',
  80. register: function (module) {
  81. module.install({
  82. extension: '.jsx',
  83. harmony: true
  84. });
  85. }
  86. }
  87. ],
  88. '.litcoffee': ['coffee-script/register', 'coffee-script'],
  89. '.liticed': 'iced-coffee-script/register',
  90. '.ls': ['livescript', 'LiveScript'],
  91. '.node': null,
  92. '.toml': {
  93. module: 'toml-require',
  94. register: function (module) {
  95. module.install();
  96. }
  97. },
  98. '.ts': ['ts-node/register', 'typescript-node/register', 'typescript-register', 'typescript-require'],
  99. '.tsx': ['ts-node/register', 'typescript-node/register'],
  100. '.wisp': 'wisp/engine/node',
  101. '.xml': 'require-xml',
  102. '.yaml': 'require-yaml',
  103. '.yml': 'require-yaml'
  104. };
  105. const jsVariantExtensions = [
  106. '.js',
  107. '.babel.js',
  108. '.buble.js',
  109. '.cirru',
  110. '.cjsx',
  111. '.co',
  112. '.coffee',
  113. '.coffee.md',
  114. '.eg',
  115. '.iced',
  116. '.iced.md',
  117. '.jsx',
  118. '.litcoffee',
  119. '.liticed',
  120. '.ls',
  121. '.ts',
  122. '.wisp'
  123. ];
  124. module.exports = {
  125. extensions: extensions,
  126. jsVariants: jsVariantExtensions.reduce(function (result, ext) {
  127. result[ext] = extensions[ext];
  128. return result;
  129. }, {})
  130. };