@dword-design/base-config-nuxt 7.0.6 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.d.ts CHANGED
@@ -1 +1,9 @@
1
- export default function (options: any): Promise<import("execa").Result<any>>;
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): Promise<import("execa").Result<{
3
+ cwd: string;
4
+ env: {
5
+ [x: string]: any;
6
+ };
7
+ stderr: any;
8
+ stdout?: "inherit" | undefined;
9
+ }>>;
package/dist/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import dotenv from "@dword-design/dotenv-json-extended";
2
2
  import { execaCommand } from "execa";
3
3
  import resolveAliases from "./resolve-aliases.js";
4
- export default async function (options) {
4
+ export default async function (options = {}) {
5
5
  options = {
6
6
  env: {},
7
7
  log: process.env.NODE_ENV !== "test",
package/dist/dev.d.ts CHANGED
@@ -1 +1,10 @@
1
- export default function (options: any): import("execa").ResultPromise<any>;
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): import("execa").ResultPromise<{
3
+ cwd: string;
4
+ env: {
5
+ [x: string]: any;
6
+ };
7
+ reject: boolean;
8
+ stderr: any;
9
+ stdout?: "inherit" | undefined;
10
+ }>;
package/dist/dev.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dotenv from "@dword-design/dotenv-json-extended";
2
2
  import { execaCommand } from "execa";
3
- export default function (options) {
3
+ export default function (options = {}) {
4
4
  options = {
5
5
  env: {},
6
6
  log: process.env.NODE_ENV !== "test",
@@ -1,4 +1,4 @@
1
1
  declare const _default: ({ cwd }: {
2
2
  cwd?: string | undefined;
3
- }) => (path: any) => Promise<any[]>;
3
+ }) => (path: string) => Promise<any[]>;
4
4
  export default _default;
@@ -9,7 +9,7 @@ export default ({
9
9
  const config = await jiti.import("./config.ts", {
10
10
  default: true
11
11
  });
12
- const modules = [...(config.modules || []), ...(config.buildModules || [])];
12
+ const modules = config.modules || [];
13
13
  return modules.map(mod => [mod].flat()[0]).filter(name => typeof name === "string").map(name => requirePackageName(name));
14
14
  }
15
15
  return [];
@@ -1,5 +1,5 @@
1
1
  declare const _default: ({ virtualImports, ignore }?: {
2
2
  virtualImports?: never[] | undefined;
3
3
  ignore?: never[] | undefined;
4
- }) => any;
4
+ }) => string;
5
5
  export default _default;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
+ import type { Base, Config } from '@dword-design/base';
1
2
  import build from './build';
2
3
  import dev from './dev';
3
4
  import lint from './lint';
4
5
  import prepublishOnly from './prepublish-only';
5
6
  import start from './start';
6
- export default function (config: any): {
7
+ import typecheck from './typecheck';
8
+ type ConfigNuxt = Config & {
9
+ virtualImports?: string[];
10
+ };
11
+ declare const _default: (this: Base, config: ConfigNuxt) => {
7
12
  allowedMatches: string[];
8
13
  commands: {
9
14
  analyze: () => import("execa").ResultPromise<{}>;
@@ -14,13 +19,13 @@ export default function (config: any): {
14
19
  };
15
20
  depcheckConfig: {
16
21
  parsers: {
17
- '**/*.scss': any;
22
+ '**/*.scss': (filePath: any) => any;
18
23
  '**/*.vue': any;
19
24
  };
20
- specials: ((path: any) => Promise<any[]>)[];
25
+ specials: ((path: string) => Promise<any[]>)[];
21
26
  };
22
27
  editorIgnore: string[];
23
- eslintConfig: any;
28
+ eslintConfig: string;
24
29
  gitignore: string[];
25
30
  hasTypescriptConfigRootAlias: boolean;
26
31
  lint: typeof lint;
@@ -29,9 +34,14 @@ export default function (config: any): {
29
34
  main: string;
30
35
  };
31
36
  prepare: () => Promise<void>;
37
+ typecheck: typeof typecheck;
32
38
  typescriptConfig: {
39
+ compilerOptions: {
40
+ declaration: boolean;
41
+ };
33
42
  extends: string;
34
43
  };
35
44
  useJobMatrix: boolean;
36
45
  };
46
+ export default _default;
37
47
  export { default as getEslintConfig } from './get-eslint-config';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
- import P from "node:path";
2
+ import pathLib from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
+ import { defineBaseConfig } from "@dword-design/base";
4
5
  import depcheckParserSass from "@dword-design/depcheck-parser-sass";
5
6
  import depcheck from "depcheck";
6
7
  import packageName from "depcheck-package-name";
@@ -15,10 +16,11 @@ import getEslintConfig from "./get-eslint-config.js";
15
16
  import lint from "./lint.js";
16
17
  import prepublishOnly from "./prepublish-only.js";
17
18
  import start from "./start.js";
18
- const __dirname = P.dirname(fileURLToPath(import.meta.url));
19
+ import typecheck from "./typecheck.js";
20
+ const __dirname = pathLib.dirname(fileURLToPath(import.meta.url));
19
21
  const resolver = createRequire(import.meta.url);
20
- const isInNodeModules = __dirname.split(P.sep).includes("node_modules");
21
- export default function (config) {
22
+ const isInNodeModules = __dirname.split(pathLib.sep).includes("node_modules");
23
+ export default defineBaseConfig(function (config) {
22
24
  return {
23
25
  allowedMatches: [".stylelintignore", ".stylelintrc.json", "server/api/**/*.ts", "server/plugins/**/*.ts", "server/routes/**/*.ts", "server/middleware/**/*.ts", "app.vue", "assets", "components", "composables", "content", "i18n", "layouts", "middleware", "model", "modules", "config.ts", "pages", "plugins", "public", "store", "types"],
24
26
  commands: {
@@ -47,8 +49,8 @@ export default function (config) {
47
49
  main: "dist/index.js"
48
50
  },
49
51
  prepare: async () => {
50
- const configPath = isInNodeModules ? "@dword-design/base-config-nuxt/config" : `./${P.relative(this.cwd, resolver.resolve("./config")).split(P.sep).join("/")}`;
51
- const parentConfigPath = isInNodeModules ? "@dword-design/base-config-nuxt/nuxt.config" : `./${P.relative(this.cwd, resolver.resolve("./nuxt.config")).split(P.sep).join("/")}`;
52
+ const configPath = isInNodeModules ? "@dword-design/base-config-nuxt/config" : `./${pathLib.relative(this.cwd, resolver.resolve("./config").slice(0, -".ts".length)).split(pathLib.sep).join("/")}`;
53
+ const parentConfigPath = isInNodeModules ? "@dword-design/base-config-nuxt/nuxt.config" : `./${pathLib.relative(this.cwd, resolver.resolve("./nuxt.config").slice(0, -".ts".length)).split(pathLib.sep).join("/")}`;
52
54
  await outputFiles(this.cwd, {
53
55
  ".stylelintignore": "/.nuxt\n",
54
56
  // For Tailwind directives inside .nuxt folder
@@ -66,10 +68,15 @@ export default function (config) {
66
68
  `
67
69
  });
68
70
  },
71
+ typecheck,
69
72
  typescriptConfig: {
73
+ compilerOptions: {
74
+ declaration: false
75
+ // TypeScript errors that declaration cannot be generated for private router types. Comes from the Nuxt-generated TypeScript config.
76
+ },
70
77
  extends: "./.nuxt/tsconfig.json"
71
78
  },
72
79
  useJobMatrix: true
73
80
  };
74
- }
81
+ });
75
82
  export { default as getEslintConfig } from "./get-eslint-config.js";
package/dist/lint.d.ts CHANGED
@@ -1 +1,2 @@
1
- export default function (options: any): Promise<void>;
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): Promise<void>;
package/dist/lint.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execaCommand } from "execa";
2
- export default async function (options) {
2
+ export default async function (options = {}) {
3
3
  options = {
4
4
  log: process.env.NODE_ENV !== "test",
5
5
  stderr: "inherit",
@@ -34,6 +34,9 @@ declare const _default: {
34
34
  pairs: {};
35
35
  } | undefined;
36
36
  };
37
+ typescript: {
38
+ strict: boolean;
39
+ };
37
40
  vite: {
38
41
  css: {
39
42
  modules: {
@@ -1,7 +1,12 @@
1
+ import { defineNuxtModule } from "@nuxt/kit";
1
2
  import packageName from "depcheck-package-name";
3
+ import ts from "typescript";
2
4
  import viteSvgLoader from "vite-svg-loader";
3
5
  import config from "./config.js";
4
6
  const isBasicAuthEnabled = process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASSWORD;
7
+ const {
8
+ config: typescriptConfig
9
+ } = ts.readConfigFile("tsconfig.json", ts.sys.readFile);
5
10
  export default {
6
11
  app: {
7
12
  head: {
@@ -30,12 +35,14 @@ export default {
30
35
  standalone: false
31
36
  }
32
37
  },
33
- modules: [(options, nuxt) => {
34
- if (!config.userScalable) {
35
- const viewportMeta = nuxt.options.app.head.meta.find(meta => meta.name === "viewport");
36
- viewportMeta.content += ", user-scalable=0";
38
+ modules: [defineNuxtModule({
39
+ setup: (options, nuxt) => {
40
+ if (!config.userScalable) {
41
+ const viewportMeta = nuxt.options.app.head.meta.find(meta => meta.name === "viewport");
42
+ viewportMeta.content += ", user-scalable=0";
43
+ }
37
44
  }
38
- }, [packageName`nuxt-basic-authentication-module`, {
45
+ }), [packageName`nuxt-basic-authentication-module`, {
39
46
  enabled: !!isBasicAuthEnabled
40
47
  }], packageName`@nuxt/eslint`, [packageName`@nuxtjs/stylelint-module`, {
41
48
  allowEmptyInput: true,
@@ -64,6 +71,9 @@ export default {
64
71
  }
65
72
  })
66
73
  },
74
+ typescript: {
75
+ strict: !!typescriptConfig.compilerOptions.strict
76
+ },
67
77
  vite: {
68
78
  css: {
69
79
  modules: {
@@ -1 +1,2 @@
1
- export default function (options: any): Promise<any>;
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): Promise<any>;
@@ -1,4 +1,5 @@
1
- export default async function (options) {
1
+ export default async function (options = {}) {
2
2
  await this.lint(options);
3
+ await this.typecheck(options);
3
4
  return this.run("build", options);
4
5
  }
package/dist/start.d.ts CHANGED
@@ -1 +1,10 @@
1
- export default function (options: any): import("execa").ResultPromise<any>;
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): import("execa").ResultPromise<{
3
+ cwd: string;
4
+ env: {
5
+ [x: string]: any;
6
+ };
7
+ reject: boolean;
8
+ stderr: any;
9
+ stdout?: "inherit" | undefined;
10
+ }>;
package/dist/start.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dotenv from "@dword-design/dotenv-json-extended";
2
2
  import { execaCommand } from "execa";
3
- export default function (options) {
3
+ export default function (options = {}) {
4
4
  options = {
5
5
  env: {},
6
6
  log: process.env.NODE_ENV !== "test",
@@ -0,0 +1,2 @@
1
+ import type { Base, PartialCommandOptions } from '@dword-design/base';
2
+ export default function (this: Base, options?: PartialCommandOptions): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import { execaCommand } from "execa";
2
+ export default async function (options = {}) {
3
+ options = {
4
+ log: process.env.NODE_ENV !== "test",
5
+ stderr: "inherit",
6
+ ...options
7
+ };
8
+ await execaCommand("nuxi prepare", {
9
+ ...(options.log && {
10
+ stdout: "inherit"
11
+ }),
12
+ cwd: this.cwd,
13
+ stderr: options.stderr
14
+ });
15
+ }
@@ -0,0 +1,11 @@
1
+ declare module 'port-ready' {
2
+ interface PortReadyOptions {
3
+ host?: string;
4
+ port: number;
5
+ timeout?: number;
6
+ }
7
+ function portReady(port: number): Promise<number>;
8
+ function portReady(options: PortReadyOptions): Promise<number>;
9
+
10
+ export = portReady;
11
+ }
@@ -0,0 +1,18 @@
1
+ declare module 'require-package-name' {
2
+ /**
3
+ * Extract package name from a require/import string
4
+ * @param str - The require/import string (e.g., 'lodash/isString', '@babel/core/package.json')
5
+ * @returns The package name or null if not found
6
+ */
7
+ function requirePackageName(str: string): string | null;
8
+ namespace requirePackageName {
9
+ /**
10
+ * Extract base package name (without scope) from a require/import string
11
+ * @param str - The require/import string
12
+ * @returns The base package name or null if not found
13
+ */
14
+ function base(str: string): string | null;
15
+ }
16
+
17
+ export = requirePackageName;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "7.0.6",
3
+ "version": "8.0.1",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -28,53 +28,61 @@
28
28
  "lint": "base lint",
29
29
  "prepare": "base prepare",
30
30
  "prepublishOnly": "base prepublishOnly",
31
- "test": "base test"
31
+ "test": "base test",
32
+ "typecheck": "base typecheck",
33
+ "verify": "base verify"
32
34
  },
33
35
  "dependencies": {
34
- "@babel/core": "^7.27.4",
35
- "@dword-design/depcheck-parser-sass": "^4.0.4",
36
- "@dword-design/dotenv-json-extended": "^3.0.3",
36
+ "@babel/core": "^7.28.0",
37
+ "@dword-design/base": "^15.1.0",
38
+ "@dword-design/depcheck-parser-sass": "^5.0.0",
39
+ "@dword-design/dotenv-json-extended": "^4.0.1",
37
40
  "@dword-design/nuxt-i18n": "^1.0.1",
38
41
  "@dword-design/nuxt-page-title": "^1.0.0",
39
- "@dword-design/stylelint-config": "^4.0.2",
40
- "@nuxt/eslint": "^1.4.1",
42
+ "@dword-design/stylelint-config": "^4.1.0",
43
+ "@nuxt/eslint": "^1.6.0",
44
+ "@nuxt/kit": "^4.0.0",
41
45
  "@nuxtjs/stylelint-module": "^5.2.1",
42
46
  "babel-plugin-add-import-extension": "^1.6.0",
43
47
  "babel-plugin-module-resolver": "^5.0.2",
44
48
  "depcheck": "^1.4.7",
45
- "depcheck-package-name": "^3.0.1",
46
- "endent": "npm:@dword-design/endent@^1.4.1",
49
+ "depcheck-package-name": "^4.0.0",
50
+ "endent": "npm:@dword-design/endent@^1.4.7",
47
51
  "execa": "^9.6.0",
48
52
  "fs-extra": "^11.3.0",
49
53
  "globby": "^14.1.0",
50
54
  "jiti": "^2.4.2",
51
55
  "lodash-es": "^4.17.21",
52
- "nuxt": "^3.17.5",
56
+ "nuxt": "3.17.5",
53
57
  "nuxt-basic-authentication-module": "^0.2.1",
54
- "output-files": "^2.0.32",
58
+ "output-files": "^3.0.0",
55
59
  "require-package-name": "^2.0.1",
56
- "stylelint": "^16.20.0",
57
- "vite-plugin-eslint2": "^5.0.3",
60
+ "stylelint": "^16.22.0",
61
+ "typescript": "^5.8.3",
62
+ "vite-plugin-eslint2": "^5.0.4",
58
63
  "vite-svg-loader": "^5.1.0"
59
64
  },
60
65
  "devDependencies": {
61
- "@dword-design/base": "^13.0.7",
62
- "@nuxtjs/sitemap": "^7.4.0",
66
+ "@dword-design/defu": "^1.0.3",
67
+ "@nuxtjs/sitemap": "^7.4.3",
63
68
  "@nuxtjs/tailwindcss": "7.0.0-beta.0",
64
- "@playwright/test": "^1.53.0",
69
+ "@playwright/test": "^1.54.1",
70
+ "@types/babel__core": "^7.20.5",
71
+ "@types/fs-extra": "^11.0.4",
72
+ "@types/lodash-es": "^4.17.12",
65
73
  "axios": "^1.10.0",
66
74
  "delay": "^6.0.0",
67
75
  "get-port": "^7.1.0",
68
- "nuxt-dev-ready": "^4.0.0",
69
- "playwright": "^1.53.0",
70
- "playwright-chromium": "^1.53.0",
76
+ "nuxt-dev-ready": "^5.0.0",
77
+ "playwright": "^1.54.1",
78
+ "playwright-chromium": "^1.54.1",
71
79
  "port-ready": "^0.1.0",
72
- "tree-kill-promise": "^3.0.14",
80
+ "tree-kill-promise": "^4.0.0",
73
81
  "xml-formatter": "^3.6.6"
74
82
  },
75
83
  "packageManager": "pnpm@10.8.1+sha512.c50088ba998c67b8ca8c99df8a5e02fd2ae2e2b29aaf238feaa9e124248d3f48f9fb6db2424949ff901cffbb5e0f0cc1ad6aedb602cd29450751d11c35023677",
76
84
  "engines": {
77
- "node": ">=18"
85
+ "node": ">=20"
78
86
  },
79
87
  "publishConfig": {
80
88
  "access": "public"