From bcabf6240c84e449b3a85fb4dc67be8b63ca2952 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 21:30:31 +0600 Subject: [PATCH 01/31] refactor: remove comma in schema imports --- packages/schema/src/types/imports.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/src/types/imports.ts b/packages/schema/src/types/imports.ts index 666cf9fe77c..45d6f22a5d8 100644 --- a/packages/schema/src/types/imports.ts +++ b/packages/schema/src/types/imports.ts @@ -2,7 +2,7 @@ import { UnimportOptions } from 'unimport' export interface AutoImportsOptions extends UnimportOptions { dirs?: string[] - global?: boolean, + global?: boolean transform?: { exclude?: RegExp[] include?: RegExp[] From cdf714727dae6c92f0dfe7aa37b9406b77d93883 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 21:42:55 +0600 Subject: [PATCH 02/31] refactor: grammar typos --- packages/schema/src/types/components.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/schema/src/types/components.ts b/packages/schema/src/types/components.ts index 8380fecc6e1..5b1c189e662 100644 --- a/packages/schema/src/types/components.ts +++ b/packages/schema/src/types/components.ts @@ -23,7 +23,7 @@ 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. + * You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use an npm package path similar to require. */ path: string /** @@ -39,7 +39,7 @@ export interface ScanDir { */ prefix?: string /** - * Prefix component name by it's path. + * Prefix component name by its path. */ pathPrefix?: boolean /** @@ -62,7 +62,7 @@ export interface ScanDir { */ preload?: boolean /** - * This flag indicates, component should be loaded async (with a seperate chunk) regardless of using Lazy prefix or not. + * This flag indicates, component should be loaded async (with a separate chunk) regardless of using Lazy prefix or not. */ isAsync?: boolean From f1409425908e633af29bad6c4eee8eabb3cbf53a Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 21:45:31 +0600 Subject: [PATCH 03/31] refactor: missing periods in schema/compatibility --- packages/schema/src/types/compatibility.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/schema/src/types/compatibility.ts b/packages/schema/src/types/compatibility.ts index e6c0b592599..dabc01b1f08 100644 --- a/packages/schema/src/types/compatibility.ts +++ b/packages/schema/src/types/compatibility.ts @@ -10,8 +10,8 @@ export interface NuxtCompatibility { /** * Bridge constraint for Nuxt 2 support. * - * - `true`: When using Nuxt 2, using bridge module is required - * - `false`: When using Nuxt 2, using bridge module is not supported + * - `true`: When using Nuxt 2, using bridge module is required. + * - `false`: When using Nuxt 2, using bridge module is not supported. */ bridge?: boolean } @@ -23,7 +23,7 @@ export interface NuxtCompatibilityIssue { export interface NuxtCompatibilityIssues extends Array { /** - * Return formatted error message + * Return formatted error message. */ toString(): string } From 891285edf84aac0c4f260a0b6ab8e3f94f84ce81 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 22:03:05 +0600 Subject: [PATCH 04/31] refactor: schema/module grammar and typos --- packages/schema/src/types/module.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/schema/src/types/module.ts b/packages/schema/src/types/module.ts index dd2f855581a..4b8c3ef16a4 100644 --- a/packages/schema/src/types/module.ts +++ b/packages/schema/src/types/module.ts @@ -3,10 +3,10 @@ import type { Nuxt, NuxtTemplate } from "./nuxt" import type { NuxtCompatibility } from './compatibility' export interface ModuleMeta { - /** Module name */ + /** Module name. */ name?: string - /** Module version */ + /** Module version. */ version?: string /** @@ -16,17 +16,17 @@ export interface ModuleMeta { configKey?: string /** - * Constraints for the versions of Nuxt or features this module requires + * Constraints for the versions of Nuxt or features this module requires. */ compatibility?: NuxtCompatibility [key: string]: any } -/** The options received */ +/** The options received. */ export type ModuleOptions = Record -/** Input module passed to defineNuxtModule */ +/** Input module passed to defineNuxtModule. */ export interface ModuleDefinition { meta?: ModuleMeta defaults?: T | ((nuxt: Nuxt) => T) @@ -35,7 +35,7 @@ export interface ModuleDefinition { setup?: (this: void, resolvedOptions: T, nuxt: Nuxt) => void | Promise } -/** Nuxt modules are always a simple function */ +/** Nuxt modules are always a simple function. */ export interface NuxtModule { (this: void, inlineOptions: T, nuxt: Nuxt): void | Promise getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise @@ -58,10 +58,10 @@ export interface ModuleContainer { /** Renders given template using lodash template during build into the project buildDir (`.nuxt`).*/ addTemplate(template: string | NuxtTemplate): NuxtTemplate - /** Register a custom layout. If its name is 'error' it will override the default error layout. */ + /** Registers a custom layout. If its name is 'error' it will override the default error layout. */ addLayout(tmpl: NuxtTemplate, name: string): any - /** Set the layout that will render Nuxt errors. It should already have been added via addLayout or addTemplate. */ + /** Sets the layout that will render Nuxt errors. It should already have been added via addLayout or addTemplate. */ addErrorLayout(dst: string): void /** Adds a new server middleware to the end of the server middleware array. */ @@ -73,9 +73,9 @@ export interface ModuleContainer { /** Allows extending routes by chaining `options.router.extendRoutes` function. */ extendRoutes(fn): void - /** Registers a module */ + /** Registers a module. */ requireModule(installOptions: any, opts: any): Promise - /** Registers a module */ + /** Registers a module. */ addModule(installOptions: any, opts: any): Promise } From 7211dc5bcee127cfdd48f406437fe2f97cf359d9 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 22:05:56 +0600 Subject: [PATCH 05/31] refactor: `instead` typo --- packages/schema/src/types/nuxt.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/schema/src/types/nuxt.ts b/packages/schema/src/types/nuxt.ts index b5c21a067ca..efc429666e0 100644 --- a/packages/schema/src/types/nuxt.ts +++ b/packages/schema/src/types/nuxt.ts @@ -4,7 +4,7 @@ import type { NuxtHooks, NuxtLayout, NuxtMiddleware } from './hooks' import type { NuxtOptions } from './config' export interface Nuxt { - // Private fields + // Private fields. _version: string _ignore?: Ignore @@ -18,7 +18,7 @@ export interface Nuxt { ready: () => Promise close: () => Promise - /** The production or development server */ + /** The production or development server. */ server?: any vfs: Record @@ -37,7 +37,7 @@ export interface NuxtTemplate { options?: Record /** The resolved path to the source file to be template */ src?: string - /** Provided compile option intead of src */ + /** Provided compile option instead of src */ getContents?: (data: Record) => string | Promise /** Write to filesystem */ write?: boolean From 047056684063b6f31aee6ed59dbcb393a5388b06 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 22:14:12 +0600 Subject: [PATCH 06/31] Update webpack.ts --- packages/schema/src/config/webpack.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/schema/src/config/webpack.ts b/packages/schema/src/config/webpack.ts index 25811bd077c..5ebec9597d2 100644 --- a/packages/schema/src/config/webpack.ts +++ b/packages/schema/src/config/webpack.ts @@ -35,7 +35,7 @@ export default { * * It is normally enabled by CLI argument `--profile`. * - * @see [webpackbar](https://github.com/unjs/webpackbar#profile) + * @see [webpackbar](https://github.com/unjs/webpackbar#profile). */ profile: process.argv.includes('--profile'), @@ -91,7 +91,7 @@ export default { extractCSS: true, /** - * Enables CSS source map support (defaults to true in development) + * Enables CSS source map support (defaults to true in development). */ cssSourceMap: { $resolve: (val, get) => val ?? get('dev') @@ -211,7 +211,7 @@ export default { * * Set to false to disable this plugin, or pass an object of options. * - * @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin) + * @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin). * * @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at * the end of each output file if webpack `config.devtool` is set to `source-map`. @@ -246,7 +246,7 @@ export default { */ optimization: { runtimeChunk: 'single', - /** Set minimize to false to disable all minimizers. (It is disabled in development by default) */ + /** Set minimize to `false` to disable all minimizers (It is disabled in development by default). */ minimize: { $resolve: (val, get) => val ?? !get('dev') }, /** You can set minimizer to a customized array of plugins. */ minimizer: undefined, @@ -288,7 +288,7 @@ export default { */ hotMiddleware: {}, /** - * Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin) + * Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin). */ friendlyErrors: true, /** From 35226767313965c7ca2d250a6caf016aac3f0e54 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 22:26:07 +0600 Subject: [PATCH 07/31] refactor: format --- packages/schema/src/config/vite.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/schema/src/config/vite.ts b/packages/schema/src/config/vite.ts index 2c16b49d373..0a194fa57a1 100644 --- a/packages/schema/src/config/vite.ts +++ b/packages/schema/src/config/vite.ts @@ -13,10 +13,10 @@ export default { */ vite: { root: { - $resolve: (val, get) => val ?? get('srcDir'), + $resolve: (val, get) => val ?? get('srcDir') }, mode: { - $resolve: (val, get) => val ?? (get('dev') ? 'development' : 'production'), + $resolve: (val, get) => val ?? (get('dev') ? 'development' : 'production') }, logLevel: 'warn', define: { @@ -26,27 +26,29 @@ export default { }) }, resolve: { - extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], + extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] }, publicDir: { - $resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public), + $resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public) }, vue: { isProduction: { - $resolve: (val, get) => val ?? !get('dev'), - }, - template: { compilerOptions: { - $resolve: (val, get) => val ?? get('vue').compilerOptions } + $resolve: (val, get) => val ?? !get('dev') }, + template: { + compilerOptions: { + $resolve: (val, get) => val ?? get('vue').compilerOptions + } + } }, optimizeDeps: { exclude: { $resolve: (val, get) => [ ...val || [], - ...get('build.transpile').filter(i => typeof i === 'string'), - 'vue-demi' - ], - }, + ...get('build.transpile').filter((i) => typeof i === 'string'), + 'vue-demi' + ] + } }, esbuild: { jsxFactory: 'h', @@ -56,9 +58,9 @@ export default { clearScreen: false, build: { assetsDir: { - $resolve: (val, get) => val ?? withoutLeadingSlash(get('app').buildAssetsDir), + $resolve: (val, get) => val ?? withoutLeadingSlash(get('app').buildAssetsDir) }, - emptyOutDir: false, + emptyOutDir: false }, server: { fs: { From 4e3a56983b604e3f2a7cea2e118481fa364985c3 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Tue, 9 Aug 2022 22:28:46 +0600 Subject: [PATCH 08/31] missing period --- packages/schema/src/config/typescript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/src/config/typescript.ts b/packages/schema/src/config/typescript.ts index ae9d5dea771..ad4c77e11f4 100644 --- a/packages/schema/src/config/typescript.ts +++ b/packages/schema/src/config/typescript.ts @@ -23,7 +23,7 @@ export default { typeCheck: false, /** - * You can extend generated `.nuxt/tsconfig.json` using this option + * You can extend generated `.nuxt/tsconfig.json` using this option. * @type {typeof import('pkg-types')['readPackageJSON']} */ tsConfig: {}, From 31c38b391e357771b81b0fbe8b499db22398a320 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Wed, 10 Aug 2022 00:24:50 +0600 Subject: [PATCH 09/31] docs(schema): router typos and backticks --- packages/schema/src/config/router.ts | 31 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/schema/src/config/router.ts b/packages/schema/src/config/router.ts index 16c307be2d6..ebaec960c23 100644 --- a/packages/schema/src/config/router.ts +++ b/packages/schema/src/config/router.ts @@ -2,31 +2,30 @@ import { normalizeURL, withTrailingSlash } from 'ufo' export default { /** - * Additional options passed to vue-router + * Additional options passed to vue-router. * * Note: Only JSON serializable options should be passed by nuxt config. * * For more control, you can use `app/router.optionts.ts` file. * - * @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html) + * @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html). * @type {import('../src/types/router').RouterConfigSerializable} * * @version 3 */ options: {}, - /** * Configure the router mode. * - * For server-side rendering it is not recommended to change it./** + * For server-side rendering it is not recommended to change it. * @version 2 */ mode: 'history', /** * The base URL of the app. For example, if the entire single page application is - * served under /app/, then base should use the value '/app/'. + * served under `/app/`, then base should use the value '/app/'. * * This can be useful if you need to serve Nuxt as a different context root, from * within a bigger web site. @@ -75,7 +74,7 @@ export default { linkExactActiveClass: 'nuxt-link-exact-active', /** - * Globally configure `` default prefetch class (feature disabled by default) + * Globally configure `` default prefetch class (feature disabled by default). * @version 2 */ linkPrefetchedClass: false, @@ -105,9 +104,9 @@ export default { /** * The `scrollBehavior` option lets you define a custom behavior for the scroll * position between the routes. This method is called every time a page is - * rendered. To learn more about it. + * rendered. To learn more about it, see the `vue-router` documentation. * - * @see [vue-router `scrollBehavior` documentation](https://router.vuejs.org/guide/advanced/scroll-behavior.html) + * @see [vue-router `scrollBehavior` documentation](https://router.vuejs.org/guide/advanced/scroll-behavior.html). * @version 2 */ scrollBehavior: { @@ -130,9 +129,9 @@ export default { /** * Controls whether the router should fall back to hash mode when the browser - * does not support history.pushState but mode is set to history. + * does not support history.pushState, but mode is set to history. * - * Setting this to false essentially makes every router-link navigation a full + * Setting this to `false` essentially makes every router-link navigation a full * page refresh in IE9. This is useful when the app is server-rendered and needs * to work in IE9, because a hash mode URL does not work with SSR. * @version 2 @@ -147,7 +146,7 @@ export default { prefetchLinks: true, /** - * When using nuxt generate with target: 'static', Nuxt will generate a + * When using `nuxt generate` with target: 'static', Nuxt will generate a * payload.js for each page. * * With this option enabled, Nuxt will automatically prefetch the payload of the @@ -157,15 +156,15 @@ export default { prefetchPayloads: true, /** - * If this option is set to true, trailing slashes will be appended to every - * route. If set to false, they'll be removed. + * If this option is set to `true`, trailing slashes will be appended to every + * route. If set to `false`, they'll be removed. * * @warning This option should not be set without preparation and has to * be tested thoroughly. When setting `trailingSlash` to something else than - * undefined, the opposite route will stop working. Thus 301 redirects should + * `undefined`, the opposite route will stop working. Thus, 301 redirects should * be in place and your internal linking has to be adapted correctly. If you set - * `trailingSlash` to true, then only example.com/abc/ will work but not - * example.com/abc. On false, it's vice-versa + * `trailingSlash` to `true`, then only `example.com/abc/` will work, but not + * `example.com/abc`. On `false`, it's vice-versa * @version 2 */ trailingSlash: undefined From 9b477e6707948520b61ae9ac93801af5059b371c Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Wed, 10 Aug 2022 00:42:23 +0600 Subject: [PATCH 10/31] docs(schema/render ): fix typos --- packages/schema/src/config/render.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/schema/src/config/render.ts b/packages/schema/src/config/render.ts index b44f7c2f31a..2c575a8b777 100644 --- a/packages/schema/src/config/render.ts +++ b/packages/schema/src/config/render.ts @@ -30,21 +30,21 @@ export default { /** * Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. * - * This option is automatically set based on global ssr value if not provided. + * This option is automatically set based on global SSR value if not provided. * This can be useful to dynamically enable/disable SSR on runtime after image builds - * (with docker for example). + * (with docker, for example). */ ssr: undefined, /** - * Forward server-side logs to the browser for better debugging (only available in development) + * Forward server-side logs to the browser for better debugging (only available in development). * - * Set to `collapsed` to collapse the logs, or false to disable. + * Set to `collapsed` to collapse the logs, or `false` to disable. */ ssrLog: { $resolve: (val, get) => get('dev') ? Boolean(val) : false }, /** - * Configuration for HTTP2 push headers + * Configuration for HTTP2 push headers. */ http2: { /** Set to true to enable HTTP2 push headers */ @@ -142,7 +142,7 @@ export default { * to serve your SSR application. * * **Updating settings**: - * These settings are read by the Nuxt server directly from `nuxt.config.js`. + * These settings are read by the Nuxt server directly from `nuxt.config`. * This means changes to these settings take effect when the server is restarted. * There is no need to rebuild the application to update CSP settings. * @@ -169,7 +169,7 @@ export default { * for logging and analytic tracking. * * Review [this blog on Sentry.io](https://blog.sentry.io/2018/09/04/how-sentry-captures-csp-violations) - * To learn what tracking link you should use. + * to learn what tracking link you should use. * @example * ```js * // PRIMARY_HOSTS = `loc.example-website.com` @@ -226,7 +226,7 @@ export default { */ addMeta: Boolean(get('target') === 'static'), /** - * Set option `unsafeInlineCompatibility` to true if you want both hashes and + * Set option `unsafeInlineCompatibility` to `true` if you want both hashes and * 'unsafe-inline' for CSPv1 compatibility. In that case the `` tag will * still only contain the hashes of the inline `