text.js 418 B

12345678910111213141516
  1. /*
  2. Text plugin
  3. */
  4. exports.translate = function(load) {
  5. load.metadata.format = 'amd';
  6. return 'def' + 'ine(function() {\nreturn "' + load.source
  7. .replace(/(["\\])/g, '\\$1')
  8. .replace(/[\f]/g, "\\f")
  9. .replace(/[\b]/g, "\\b")
  10. .replace(/[\n]/g, "\\n")
  11. .replace(/[\t]/g, "\\t")
  12. .replace(/[\r]/g, "\\r")
  13. .replace(/[\u2028]/g, "\\u2028")
  14. .replace(/[\u2029]/g, "\\u2029")
  15. + '";\n});';
  16. }