fix(kit): improve ScanDir type (#1238)

This commit is contained in:
Yaël Guilloux 2021-10-19 16:55:02 +02:00 committed by GitHub
parent 2256b2b86a
commit c49f9ca648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,22 +20,65 @@ export interface Component {
} }
export interface ScanDir { export interface ScanDir {
/**
* Path (absolute or relative) to the directory containing your components.
* You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use a npm package path similar to require.
*/
path: string path: string
/**
* Accept Pattern that will be run against specified path.
*/
pattern?: string | string[] pattern?: string | string[]
/**
* Ignore patterns that will be run against specified path.
*/
ignore?: string[] ignore?: string[]
/**
* Prefix all matched components.
*/
prefix?: string prefix?: string
/**
* Prefix component name by it's path.
*/
pathPrefix?: boolean pathPrefix?: boolean
/**
* Level is used to define a hint when overwriting the components which have the same name in two different directories.
*/
level?: number level?: number
/**
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by Wepack via its magic comments.
* Learn more on Webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments
*/
prefetch?: boolean prefetch?: boolean
/**
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by Wepack via its magic comments.
* Learn more on Webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments
*/
preload?: boolean preload?: boolean
/**
* This flag indicates, component should be loaded async (with a seperate chunk) regardless of using Lazy prefix or not.
*/
isAsync?: boolean
extendComponent?: (component: Component) => Promise<Component | void> | (Component | void) extendComponent?: (component: Component) => Promise<Component | void> | (Component | void)
/** @deprecated */ /** @deprecated */
global?: boolean | 'dev' global?: boolean | 'dev'
} }
export interface ComponentsDir extends ScanDir { export interface ComponentsDir extends ScanDir {
/**
* Watch specified path for changes, including file additions and file deletions.
*/
watch?: boolean watch?: boolean
/**
* Extensions supported by Nuxt builder.
*/
extensions?: string[] extensions?: string[]
/**
* Transpile specified path using build.transpile.
* By default ('auto') it will set transpile: true if node_modules/ is in path.
*/
transpile?: 'auto' | boolean transpile?: 'auto' | boolean
} }