jiti.js 354 B

12345678910111213141516
  1. #!/usr/bin/env node
  2. const { resolve } = require("node:path");
  3. const script = process.argv.splice(2, 1)[0];
  4. if (!script) {
  5. console.error("Usage: jiti <path> [...arguments]");
  6. process.exit(1);
  7. }
  8. const pwd = process.cwd();
  9. const jiti = require("..")(pwd);
  10. const resolved = (process.argv[1] = jiti.resolve(resolve(pwd, script)));
  11. jiti(resolved);