Skip to content

Commit a031a4d

Browse files
committed
feat(plugin-vue): add compiler cache options
1 parent 5d3313f commit a031a4d

File tree

3 files changed

+275
-74
lines changed

3 files changed

+275
-74
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"typescript-eslint": "^8.43.0",
6363
"vite": "catalog:",
6464
"vitest": "^3.2.4",
65-
"vue": "catalog:"
65+
"vue": "https://pkg.pr.new/vue@13926"
6666
},
6767
"simple-git-hooks": {
6868
"pre-commit": "pnpm exec lint-staged --concurrent false"

packages/plugin-vue/src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ export interface Options {
158158
isProduction: boolean | undefined,
159159
getHash: (text: string) => string,
160160
) => string)
161+
162+
/**
163+
* LRUCache options for the compiler.
164+
* see https://isaacs.github.io/node-lru-cache/
165+
*/
166+
compilerCacheOptions?: {
167+
parse?: Record<string, any>
168+
templateUsageCheck?: Record<string, any>
169+
tsConfig?: Record<string, any>
170+
fileToScope?: Record<string, any>
171+
}
161172
}
162173

163174
/**
@@ -389,6 +400,14 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
389400
compiler.invalidateTypeCache(file)
390401
})
391402
}
403+
404+
// @ts-expect-error required 3.6+
405+
if (compiler.configureCacheOptions) {
406+
// @ts-expect-error required 3.6+
407+
compiler.configureCacheOptions(
408+
options.value.features?.compilerCacheOptions,
409+
)
410+
}
392411
},
393412

394413
resolveId: {

0 commit comments

Comments
 (0)