prettier.cjs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env node
  2. "use strict";
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __commonJS = function(cb, mod) {
  5. return function __require() {
  6. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  7. };
  8. };
  9. // node_modules/semver-compare/index.js
  10. var require_semver_compare = __commonJS({
  11. "node_modules/semver-compare/index.js": function(exports2, module2) {
  12. module2.exports = function cmp(a, b) {
  13. var pa = a.split(".");
  14. var pb = b.split(".");
  15. for (var i = 0; i < 3; i++) {
  16. var na = Number(pa[i]);
  17. var nb = Number(pb[i]);
  18. if (na > nb)
  19. return 1;
  20. if (nb > na)
  21. return -1;
  22. if (!isNaN(na) && isNaN(nb))
  23. return 1;
  24. if (isNaN(na) && !isNaN(nb))
  25. return -1;
  26. }
  27. return 0;
  28. };
  29. }
  30. });
  31. // node_modules/please-upgrade-node/index.js
  32. var require_please_upgrade_node = __commonJS({
  33. "node_modules/please-upgrade-node/index.js": function(exports2, module2) {
  34. var semverCompare = require_semver_compare();
  35. module2.exports = function pleaseUpgradeNode2(pkg, opts) {
  36. var opts = opts || {};
  37. var requiredVersion = pkg.engines.node.replace(">=", "");
  38. var currentVersion = process.version.replace("v", "");
  39. if (semverCompare(currentVersion, requiredVersion) === -1) {
  40. if (opts.message) {
  41. console.error(opts.message(requiredVersion));
  42. } else {
  43. console.error(
  44. pkg.name + " requires at least version " + requiredVersion + " of Node, please upgrade"
  45. );
  46. }
  47. if (opts.hasOwnProperty("exitCode")) {
  48. process.exit(opts.exitCode);
  49. } else {
  50. process.exit(1);
  51. }
  52. }
  53. };
  54. }
  55. });
  56. // bin/prettier.cjs
  57. var pleaseUpgradeNode = require_please_upgrade_node();
  58. var packageJson = require("../package.json");
  59. pleaseUpgradeNode(packageJson);
  60. function runCli(cli) {
  61. return cli.run(process.argv.slice(2));
  62. }
  63. var dynamicImport = new Function("module", "return import(module)");
  64. module.exports.promise = dynamicImport("../internal/cli.mjs").then(runCli);