From c49f9ca648ce743216430d4ec606f532839dcd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C3=ABl=20Guilloux?= Date: Tue, 19 Oct 2021 16:55:02 +0200 Subject: [PATCH] fix(kit): improve `ScanDir` type (#1238) --- packages/kit/src/types/components.ts | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/packages/kit/src/types/components.ts b/packages/kit/src/types/components.ts index 0154263842..ac3fbf0c47 100644 --- a/packages/kit/src/types/components.ts +++ b/packages/kit/src/types/components.ts @@ -20,22 +20,65 @@ export interface Component { } 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 + /** + * Accept Pattern that will be run against specified path. + */ pattern?: string | string[] + /** + * Ignore patterns that will be run against specified path. + */ ignore?: string[] + /** + * Prefix all matched components. + */ prefix?: string + /** + * Prefix component name by it's path. + */ pathPrefix?: boolean + /** + * Level is used to define a hint when overwriting the components which have the same name in two different directories. + */ 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 + /** + * 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 + /** + * 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) + /** @deprecated */ global?: boolean | 'dev' } export interface ComponentsDir extends ScanDir { + /** + * Watch specified path for changes, including file additions and file deletions. + */ watch?: boolean + /** + * Extensions supported by Nuxt builder. + */ 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 }