extensions.js 714 B

123456789101112131415161718192021222324252627282930313233
  1. var semver = require('semver'),
  2. runtimeVersion = semver.parse(process.version);
  3. /**
  4. * Get Runtime Name
  5. *
  6. * @api private
  7. */
  8. function getRuntimeName() {
  9. var runtime = process.execPath
  10. .split(/[\\/]+/).pop()
  11. .split('.').shift();
  12. return runtime === 'node' || runtime === 'nodejs' ? 'node' : runtime;
  13. }
  14. /**
  15. * Get unique name of binary for current platform
  16. *
  17. * @api private
  18. */
  19. function getBinaryIdentifiableName() {
  20. return [process.platform, '-',
  21. process.arch, '-',
  22. getRuntimeName(), '-',
  23. runtimeVersion.major, '.',
  24. runtimeVersion.minor].join('');
  25. }
  26. process.runtime = getRuntimeName();
  27. process.sassBinaryName = getBinaryIdentifiableName();