Brak opisu

index.js 3.3KB

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