Skip to content

Commit

Permalink
feat: add v8cache option (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmkx authored Sep 13, 2021
1 parent a7e3eac commit ffdd372
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ function onError (err) {
}

module.exports = function (filename, opts) {
require('../dist/v8cache')
if (!(opts && opts.v8cache === false) && !process.env.DISABLE_V8_COMPILE_CACHE) {
// enable v8cache by default
require('../dist/v8cache')
}
const jiti = require('../dist/jiti')

opts = { dynamicImport, onError, ...opts }
Expand Down
7 changes: 4 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
export type TransformOptions = {
source: string,
filename?: string,
ts?: Boolean
retainLines?: Boolean
legacy?: Boolean
ts?: boolean
retainLines?: boolean
legacy?: boolean
[key: string]: any
}

Expand All @@ -18,6 +18,7 @@ export type JITIOptions = {
debug?: boolean,
cache?: boolean | string
requireCache?: boolean
v8cache?: boolean
interopDefault?: boolean
cacheVersion?: string
dynamicImport?: (id: string) => Promise<any>
Expand Down

0 comments on commit ffdd372

Please sign in to comment.