@dword-design/base-config-nuxt 6.2.1 → 6.2.3

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.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { execa } from 'execa';
2
3
  import fs from 'fs-extra';
3
- import { createRequire } from 'module';
4
4
  const _require = createRequire(import.meta.url);
5
5
  const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
6
6
  export default async (options = {}) => {
package/dist/config.js CHANGED
@@ -1,16 +1,17 @@
1
- import pathLib from 'path';
2
- import { pathToFileURL } from 'url';
3
- let config;
1
+ import pathLib from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
4
3
  const moduleUrl = pathToFileURL(pathLib.join(process.cwd(), 'config.js')).href;
5
- try {
6
- config = (await import(moduleUrl)).default;
7
- } catch (error) {
4
+ const {
5
+ default: config
6
+ } = await import(moduleUrl).catch(error => {
8
7
  if (error.code === 'ERR_MODULE_NOT_FOUND' && error.url === moduleUrl) {
9
- config = {};
8
+ return {
9
+ default: {}
10
+ };
10
11
  } else {
11
12
  throw error;
12
13
  }
13
- }
14
+ });
14
15
  export default {
15
16
  name: 'Vue app',
16
17
  userScalable: true,
@@ -1,7 +1,7 @@
1
+ import P from 'node:path';
1
2
  import { filter, first, map } from '@dword-design/functions';
2
3
  import jitiBabelTransform from '@dword-design/jiti-babel-transform';
3
4
  import { createJiti } from 'jiti';
4
- import P from 'path';
5
5
  import requirePackageName from 'require-package-name';
6
6
  export default path => {
7
7
  if (P.basename(path) === 'config.js') {
@@ -14,8 +14,8 @@ export default path => {
14
14
  const config = jitiInstance('./config.js');
15
15
  const modules = [...(config.modules || []), ...(config.buildModules || [])];
16
16
  return _ref = (_ref2 = (_modules = modules, map(mod => {
17
- var _concat;
18
- return _concat = [].concat(mod), first(_concat);
17
+ var _flat;
18
+ return _flat = [mod].flat(), first(_flat);
19
19
  })(_modules)), filter(name => typeof name === 'string')(_ref2)), map(name => requirePackageName(name))(_ref);
20
20
  }
21
21
  return [];
package/dist/dev.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { execa } from 'execa';
2
- import { createRequire } from 'module';
3
3
  const _require = createRequire(import.meta.url);
4
4
  const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
5
5
  export default (options = {}) => {
@@ -0,0 +1,16 @@
1
+ import { endent } from '@dword-design/functions';
2
+ export default endent`
3
+ import config from '@dword-design/eslint-config';
4
+
5
+ import withNuxt from './.nuxt/eslint.config.mjs';
6
+
7
+ export default withNuxt(
8
+ config,
9
+ {
10
+ files: ['eslint.config.js'],
11
+ rules: {
12
+ 'import/no-extraneous-dependencies': 'off',
13
+ },
14
+ },
15
+ );
16
+ `;
package/dist/index.js CHANGED
@@ -1,65 +1,62 @@
1
+ import { createRequire } from 'node:module';
2
+ import P from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
1
4
  import depcheckParserSass from '@dword-design/depcheck-parser-sass';
2
5
  import { endent as javascript } from '@dword-design/functions';
3
6
  import packageName from 'depcheck-package-name';
4
7
  import depcheckParserVue from 'depcheck-parser-vue';
5
- import { createRequire } from 'module';
6
8
  import outputFiles from 'output-files';
7
- import P from 'path';
8
- import { fileURLToPath } from 'url';
9
9
  import analyze from "./analyze.js";
10
10
  import build from "./build.js";
11
11
  import depcheckSpecial from "./depcheck-special.js";
12
12
  import dev from "./dev.js";
13
- import getEslintConfig from "./get-eslint-config.js";
13
+ import eslintConfig from "./eslint-config.js";
14
14
  import lint from "./lint.js";
15
15
  import prepublishOnly from "./prepublish-only.js";
16
16
  import start from "./start.js";
17
17
  const __dirname = P.dirname(fileURLToPath(import.meta.url));
18
18
  const _require = createRequire(import.meta.url);
19
19
  const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
20
- export default (config = {}) => {
21
- config.importAliases = config.importAliases || [];
22
- return {
23
- allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'app.vue', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
24
- commands: {
25
- analyze,
26
- build,
27
- dev,
28
- prepublishOnly,
29
- start
20
+ export default {
21
+ allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'app.vue', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
22
+ commands: {
23
+ analyze,
24
+ build,
25
+ dev,
26
+ prepublishOnly,
27
+ start
28
+ },
29
+ depcheckConfig: {
30
+ parsers: {
31
+ '**/*.scss': depcheckParserSass,
32
+ '**/*.vue': depcheckParserVue
30
33
  },
31
- depcheckConfig: {
32
- parsers: {
33
- '**/*.scss': depcheckParserSass,
34
- '**/*.vue': depcheckParserVue
35
- },
36
- specials: [depcheckSpecial]
37
- },
38
- editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'dist', 'nuxt.config.js'],
39
- eslintConfig: getEslintConfig(config),
40
- gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/dist', '/nuxt.config.js'],
41
- lint,
42
- npmPublish: true,
43
- packageConfig: {
44
- main: 'dist/index.js'
45
- },
46
- prepare: async () => {
47
- const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
48
- const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
49
- await outputFiles({
50
- '.stylelintrc.json': `${JSON.stringify({
51
- extends: packageName`@dword-design/stylelint-config`
52
- }, undefined, 2)}\n`,
53
- 'nuxt.config.js': javascript`
54
- import config from '${configPath}';
34
+ specials: [depcheckSpecial]
35
+ },
36
+ editorIgnore: ['.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'dist', 'nuxt.config.js'],
37
+ eslintConfig,
38
+ gitignore: ['/.nuxt', '/.output', '/.stylelintcache', '/dist', '/nuxt.config.js'],
39
+ lint,
40
+ npmPublish: true,
41
+ packageConfig: {
42
+ main: 'dist/index.js'
43
+ },
44
+ prepare: async () => {
45
+ const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
46
+ const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
47
+ await outputFiles({
48
+ '.stylelintrc.json': `${JSON.stringify({
49
+ extends: packageName`@dword-design/stylelint-config`
50
+ }, undefined, 2)}\n`,
51
+ 'nuxt.config.js': javascript`
52
+ import config from '${configPath}';
55
53
 
56
- export default {
57
- extends: ['${parentConfigPath}'],
58
- ...config,
59
- };\n
60
- `
61
- });
62
- },
63
- useJobMatrix: true
64
- };
54
+ export default {
55
+ extends: ['${parentConfigPath}'],
56
+ ...config,
57
+ };\n
58
+ `
59
+ });
60
+ },
61
+ useJobMatrix: true
65
62
  };
package/dist/lint.js CHANGED
@@ -1,10 +1,13 @@
1
- import { execaCommand } from 'execa';
1
+ import { createRequire } from 'node:module';
2
+ import { execa, execaCommand } from 'execa';
3
+ const resolver = createRequire(import.meta.url);
4
+ const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
2
5
  export default async (options = {}) => {
3
6
  options = {
4
7
  log: process.env.NODE_ENV !== 'test',
5
8
  ...options
6
9
  };
7
- await execaCommand('eslint --fix --ignore-path .gitignore --ext .js,.json,.vue .', ...(options.log ? [{
10
+ await execa(nuxtWrapper, ['prepare'], ...(options.log ? [{
8
11
  stdio: 'inherit'
9
12
  }] : []));
10
13
  await execaCommand('stylelint --fix --allow-empty-input --ignore-path .gitignore **/*.{css,scss,vue}', ...(options.log ? [{
@@ -1,13 +1,14 @@
1
+ import P from 'node:path';
1
2
  import { addPlugin, createResolver, defineNuxtModule, installModule } from '@nuxt/kit';
2
3
  import packageName from 'depcheck-package-name';
3
4
  import { globby } from 'globby';
4
- import P from 'path';
5
5
  const resolver = createResolver(import.meta.url);
6
6
  export default defineNuxtModule({
7
7
  setup: async (options, nuxt) => {
8
- const locales = (await globby('*.json', {
8
+ const filenames = await globby('*.json', {
9
9
  cwd: P.join(nuxt.options.srcDir, 'i18n')
10
- })).map(filename => P.basename(filename, '.json'));
10
+ });
11
+ const locales = filenames.map(filename => P.basename(filename, '.json'));
11
12
  const defaultLocale = locales.includes('en') ? 'en' : locales[0];
12
13
  if (locales.length === 0) {
13
14
  return;
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import dotenv from '@dword-design/dotenv-json-extended';
3
- import { execa } from 'execa';
3
+ import { x } from 'tinyexec';
4
4
  dotenv.config();
5
- execa('nuxt-babel', process.argv.slice(2), {
6
- stdio: 'inherit'
5
+ x('nuxt', process.argv.slice(2), {
6
+ nodeOptions: {
7
+ stdio: 'inherit'
8
+ },
9
+ throwOnError: true
7
10
  });
@@ -1,5 +1,5 @@
1
+ import { createRequire } from 'node:module';
1
2
  import packageName from 'depcheck-package-name';
2
- import { createRequire } from 'module';
3
3
  import viteSvgLoader from 'vite-svg-loader';
4
4
  import config from "./config.js";
5
5
  const resolver = createRequire(import.meta.url);
@@ -24,6 +24,14 @@ export default {
24
24
  devtools: {
25
25
  enabled: true
26
26
  },
27
+ eslint: {
28
+ checker: {
29
+ fix: true
30
+ },
31
+ config: {
32
+ standalone: false
33
+ }
34
+ },
27
35
  i18n: {
28
36
  bundle: {
29
37
  optimizeTranslationDirective: false
@@ -37,12 +45,7 @@ export default {
37
45
  }
38
46
  }, [packageName`nuxt-basic-authentication-module`, {
39
47
  enabled: !!isBasicAuthEnabled
40
- }], [packageName`@nuxtjs/eslint-module`, {
41
- cache: false,
42
- failOnWarning: true,
43
- fix: true,
44
- lintOnStart: false
45
- }], [packageName`@nuxtjs/stylelint-module`, {
48
+ }], packageName`@nuxt/eslint`, [packageName`@nuxtjs/stylelint-module`, {
46
49
  allowEmptyInput: true,
47
50
  failOnWarning: true,
48
51
  fix: true,
@@ -1,10 +1,4 @@
1
- import build from "./build.js";
2
- import lint from "./lint.js";
3
- export default async (options = {}) => {
4
- options = {
5
- log: process.env.NODE_ENV !== 'test',
6
- ...options
7
- };
8
- await lint(options);
9
- return build(options);
10
- };
1
+ export default async function (options) {
2
+ await this.lint(options);
3
+ return this.run('build', options);
4
+ }
package/dist/start.js CHANGED
@@ -1,7 +1,7 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { execa } from 'execa';
2
- import { createRequire } from 'module';
3
- const _require = createRequire(import.meta.url);
4
- const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
3
+ const resolver = createRequire(import.meta.url);
4
+ const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
5
5
  export default (options = {}) => {
6
6
  options = {
7
7
  log: process.env.NODE_ENV !== 'test',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "6.2.1",
3
+ "version": "6.2.3",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -31,38 +31,40 @@
31
31
  "@dword-design/functions": "^6.0.2",
32
32
  "@dword-design/jiti-babel-transform": "^2.0.0",
33
33
  "@dword-design/stylelint-config": "^4.0.2",
34
- "@nuxt/kit": "^3.17.1",
35
- "@nuxtjs/eslint-module": "^4.1.0",
34
+ "@nuxt/eslint": "^1.4.1",
35
+ "@nuxt/kit": "^3.17.4",
36
36
  "@nuxtjs/i18n": "^9.5.4",
37
37
  "@nuxtjs/stylelint-module": "^5.2.1",
38
38
  "depcheck-package-name": "^3.0.1",
39
39
  "depcheck-parser-vue": "^5.0.0",
40
- "execa": "^9.5.2",
40
+ "execa": "^9.6.0",
41
41
  "fs-extra": "^11.3.0",
42
42
  "globby": "^14.1.0",
43
43
  "jiti": "^2.4.2",
44
- "nuxt": "^3.17.1",
45
- "nuxt-babel-runtime": "^5.0.12",
44
+ "nuxt": "^3.17.4",
46
45
  "nuxt-basic-authentication-module": "^0.2.1",
47
46
  "output-files": "^2.0.32",
48
47
  "require-package-name": "^2.0.1",
49
48
  "stylelint": "^16.19.1",
49
+ "tinyexec": "^1.0.1",
50
+ "vite-plugin-eslint2": "^5.0.3",
50
51
  "vite-svg-loader": "^5.1.0"
51
52
  },
52
53
  "devDependencies": {
53
- "@dword-design/base": "^11.3.3",
54
+ "@dword-design/base": "^12.0.13",
54
55
  "@dword-design/tester": "^2.0.19",
55
56
  "@dword-design/tester-plugin-tmp-dir": "^2.1.26",
56
- "@nuxtjs/sitemap": "^7.2.10",
57
+ "@nuxtjs/sitemap": "^7.3.0",
57
58
  "axios": "^1.9.0",
58
59
  "depcheck": "^1.4.7",
59
60
  "expect": "^29.7.0",
60
61
  "nuxt-dev-ready": "^3.0.0",
62
+ "p-wait-for": "^5.0.2",
61
63
  "playwright": "^1.52.0",
62
64
  "playwright-chromium": "^1.52.0",
63
65
  "port-ready": "^0.1.0",
64
66
  "tree-kill-promise": "^3.0.14",
65
- "xml-formatter": "^3.6.5"
67
+ "xml-formatter": "^3.6.6"
66
68
  },
67
69
  "peerDependencies": {
68
70
  "h3": "*"
@@ -1,26 +0,0 @@
1
- import packageName from 'depcheck-package-name';
2
- export default config => ({
3
- extends: packageName`@dword-design/eslint-config`,
4
- globals: {
5
- $fetch: 'readonly'
6
- },
7
- overrides: [{
8
- files: 'pages/**/*.vue',
9
- globals: {
10
- definePageMeta: 'readonly'
11
- }
12
- }],
13
- rules: {
14
- 'import/extensions': ['error', 'always', {
15
- ignorePackages: true,
16
- pathGroupOverrides: [{
17
- action: 'ignore',
18
- pattern: '#*/**'
19
- }]
20
- }],
21
- 'import/no-unresolved': ['error', {
22
- ignore: ['#imports', '#components', ...config.importAliases]
23
- }],
24
- 'import/no-webpack-loader-syntax': 'off'
25
- }
26
- });