-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-plugins.ts
27 lines (24 loc) · 943 Bytes
/
load-plugins.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* @file Utilities - loadPlugins
* @module tsconfig-utils/utils/loadPlugins
*/
import type { LoadTsconfigOptions } from '#src/interfaces'
import type mlly from '@flex-development/mlly'
import type { Plugin } from '@flex-development/tsconfig-types'
import { get } from '@flex-development/tutils'
import loadCompilerOptions from './load-compiler-options'
/**
* Loads [language service plugin configurations][1] from a [tsconfig][2] file.
*
* [1]: https://www.typescriptlang.org/tsconfig#plugins
* [2]: https://www.typescriptlang.org/tsconfig
*
* @param {mlly.ModuleId} tsconfig - Module id of tsconfig file
* @param {LoadTsconfigOptions?} [options] - Tsconfig loading options
* @return {Plugin[]} Language service plugin configurations array
*/
const loadPlugins = (
tsconfig: mlly.ModuleId,
options?: LoadTsconfigOptions
): Plugin[] => get(loadCompilerOptions(tsconfig, options), 'plugins', [])
export default loadPlugins