interpret icon indicating copy to clipboard operation
interpret copied to clipboard

feat: add jiti support

Open folliehiyuki opened this issue 10 months ago • 2 comments

This PR adds https://github.com/unjs/jiti as a supported loader.

folliehiyuki avatar Mar 15 '25 09:03 folliehiyuki

Sorry for the noisy ping, @pi0! As the maintainer of jiti, can you help me integrate it into gulpjs? I can't figure out why gulp doesn't do anything after loading jiti-register module.

Also, unlike other loaders listed in the index.js file, I can't find another way to supply custom options to jiti, except by setting environment variables. All those process.env calls seem pretty hacky (on top of them not working yet).

A simple setup for testing:

// package.json
///////////////////////////////
{
  "dependencies": {
    "gulp": "^5.0.0",
    "gulp-cli" "^3.0.0",
    "jiti": "^2.4.2"
  },
  "overrides": {
    "gulp-cli": {
      "interpret": "git+https://github.com/folliehiyuki/interpret#jiti-loader"
    }
  }
}

// gulpfile.ts
////////////////////////////////
function defaultTask(cb: any) {
  // place code for your default task here
  cb();
}

export default defaultTask;

Executing npm exec gulp should return nothing and succeed. Right now, it loads jiti module but still fails to recognize Typescript syntax.

folliehiyuki avatar Mar 15 '25 16:03 folliehiyuki

Hi @folliehiyuki can you please clarify what specific options are currently not possible to be set via env variables? (and using loader approach, how to you see alternatives? feel free to create discussion upstream also 👍🏼 )

pi0 avatar Mar 17 '25 09:03 pi0