@dword-design/base-config-nuxt 6.1.2 → 6.1.4

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/LICENSE.md CHANGED
@@ -14,8 +14,17 @@ MIT License
14
14
 
15
15
  Copyright (c) <year> <copyright holders>
16
16
 
17
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
18
+ associated documentation files (the "Software"), to deal in the Software without restriction, including
19
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
21
+ following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all copies or substantial
24
+ portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
27
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
28
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
29
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
30
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/analyze.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import { execaCommand } from 'execa';
2
- export default (() => execaCommand('nuxt build --analyze'));
2
+ export default () => execaCommand('nuxt build --analyze');
package/dist/config.js CHANGED
@@ -1,15 +1,11 @@
1
- import jitiBabelTransform from '@dword-design/jiti-babel-transform';
2
- import jiti from 'jiti';
1
+ import pathLib from 'path';
2
+ import { pathToFileURL } from 'url';
3
3
  let config;
4
4
  try {
5
- const jitiInstance = jiti(process.cwd(), {
6
- esmResolve: true,
7
- interopDefault: true,
8
- transform: jitiBabelTransform
9
- });
10
- config = jitiInstance('./config.js');
5
+ const modulePath = pathLib.join(process.cwd(), 'config.js');
6
+ config = (await import(pathToFileURL(modulePath).href)).default;
11
7
  } catch (error) {
12
- if (error.message.startsWith("Cannot find module './config.js'\n")) {
8
+ if (error.code === 'ERR_MODULE_NOT_FOUND') {
13
9
  config = {};
14
10
  } else {
15
11
  throw error;
@@ -1,12 +1,12 @@
1
1
  import { filter, first, map } from '@dword-design/functions';
2
2
  import jitiBabelTransform from '@dword-design/jiti-babel-transform';
3
- import jiti from 'jiti';
3
+ import { createJiti } from 'jiti';
4
4
  import P from 'path';
5
5
  import requirePackageName from 'require-package-name';
6
- export default (path => {
6
+ export default path => {
7
7
  if (P.basename(path) === 'config.js') {
8
8
  var _ref, _ref2, _modules;
9
- const jitiInstance = jiti(process.cwd(), {
9
+ const jitiInstance = createJiti(process.cwd(), {
10
10
  esmResolve: true,
11
11
  interopDefault: true,
12
12
  transform: jitiBabelTransform
@@ -19,4 +19,4 @@ export default (path => {
19
19
  })(_modules)), filter(name => typeof name === 'string')(_ref2)), map(name => requirePackageName(name))(_ref);
20
20
  }
21
21
  return [];
22
- });
22
+ };
package/dist/dev.js CHANGED
@@ -2,7 +2,7 @@ import { execa } from 'execa';
2
2
  import { createRequire } from 'module';
3
3
  const _require = createRequire(import.meta.url);
4
4
  const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
5
- export default ((options = {}) => {
5
+ export default (options = {}) => {
6
6
  options = {
7
7
  log: process.env.NODE_ENV !== 'test',
8
8
  ...options
@@ -10,4 +10,4 @@ export default ((options = {}) => {
10
10
  return execa(nuxtWrapper, ['dev'], {
11
11
  [options.log ? 'stdio' : 'stderr']: 'inherit'
12
12
  });
13
- });
13
+ };
@@ -1,5 +1,5 @@
1
1
  import packageName from 'depcheck-package-name';
2
- export default (config => ({
2
+ export default config => ({
3
3
  extends: packageName`@dword-design/eslint-config`,
4
4
  globals: {
5
5
  $fetch: 'readonly'
@@ -11,9 +11,16 @@ export default (config => ({
11
11
  }
12
12
  }],
13
13
  rules: {
14
+ 'import/extensions': ['error', 'always', {
15
+ ignorePackages: true,
16
+ pathGroupOverrides: [{
17
+ action: 'ignore',
18
+ pattern: '#*/**'
19
+ }]
20
+ }],
14
21
  'import/no-unresolved': ['error', {
15
22
  ignore: ['#imports', '#components', ...config.importAliases]
16
23
  }],
17
24
  'import/no-webpack-loader-syntax': 'off'
18
25
  }
19
- }));
26
+ });
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import start from "./start.js";
16
16
  const __dirname = P.dirname(fileURLToPath(import.meta.url));
17
17
  const _require = createRequire(import.meta.url);
18
18
  const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
19
- export default ((config = {}) => {
19
+ export default (config = {}) => {
20
20
  config.importAliases = config.importAliases || [];
21
21
  return {
22
22
  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'],
@@ -49,14 +49,15 @@ export default ((config = {}) => {
49
49
  extends: packageName`@dword-design/stylelint-config`
50
50
  }, undefined, 2)}\n`,
51
51
  'nuxt.config.js': javascript`
52
- import deepmerge from '${packageName`deepmerge`}'
53
- import config from '${configPath}'
54
- import parentConfig from '${parentConfigPath}'
52
+ import config from '${configPath}';
55
53
 
56
- export default deepmerge(parentConfig, config)\n
54
+ export default {
55
+ extends: ['${parentConfigPath}'],
56
+ ...config,
57
+ };\n
57
58
  `
58
59
  });
59
60
  },
60
61
  useJobMatrix: true
61
62
  };
62
- });
63
+ };
package/dist/lint.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execaCommand } from 'execa';
2
- export default (async (options = {}) => {
2
+ export default async (options = {}) => {
3
3
  options = {
4
4
  log: process.env.NODE_ENV !== 'test',
5
5
  ...options
@@ -10,4 +10,4 @@ export default (async (options = {}) => {
10
10
  await execaCommand('stylelint --fix --allow-empty-input --ignore-path .gitignore **/*.{css,scss,vue}', ...(options.log ? [{
11
11
  stdio: 'inherit'
12
12
  }] : []));
13
- });
13
+ };
@@ -0,0 +1,48 @@
1
+ import { addPlugin, createResolver, defineNuxtModule, installModule } from '@nuxt/kit';
2
+ import packageName from 'depcheck-package-name';
3
+ import { globby } from 'globby';
4
+ import P from 'path';
5
+ const resolver = createResolver(import.meta.url);
6
+ export default defineNuxtModule({
7
+ setup: async (options, nuxt) => {
8
+ const locales = (await globby('*.json', {
9
+ cwd: P.join(nuxt.options.srcDir, 'i18n')
10
+ })).map(filename => P.basename(filename, '.json'));
11
+ const defaultLocale = locales.includes('en') ? 'en' : locales[0];
12
+ if (locales.length === 0) {
13
+ return;
14
+ }
15
+
16
+ /**
17
+ * @nuxtjs/i18n won't be able to merge the locales because it will not be in the layer configs
18
+ * since we install it via @nuxtjs/i18n (see applyLayerOptions calling getLayerI18n).
19
+ * So we add the locales via the hook.
20
+ */
21
+ nuxt.hook('i18n:registerModule', register => register({
22
+ langDir: P.join(nuxt.options.srcDir, 'i18n'),
23
+ // Set to '.' when passed directly as inline module options
24
+ locales: locales.map(locale => ({
25
+ code: locale,
26
+ file: `${locale}.json`,
27
+ language: locale
28
+ }))
29
+ }));
30
+ await installModule(packageName`@nuxtjs/i18n`, {
31
+ defaultLocale,
32
+ detectBrowserLanguage: locales.length === 1 ? false : {
33
+ fallbackLocale: defaultLocale,
34
+ redirectOn: 'no prefix',
35
+ useCookie: false
36
+ },
37
+ lazy: true,
38
+ strategy: `${locales.length === 1 ? 'no_' : ''}prefix`,
39
+ ...(process.env.BASE_URL && {
40
+ baseUrl: process.env.BASE_URL
41
+ })
42
+ });
43
+ addPlugin(resolver.resolve('./plugin.js'), {
44
+ append: true
45
+ });
46
+ await installModule(resolver.resolve('../locale-link/index.js'));
47
+ }
48
+ });
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <nuxt-link v-bind="$attrs" :to="localePath(to)">
3
+ <slot />
4
+ </nuxt-link>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { useLocalePath } from '#imports';
9
+
10
+ defineProps({ to: { required: true } });
11
+ const localePath = useLocalePath();
12
+ </script>
@@ -0,0 +1,8 @@
1
+ import { addComponent, createResolver, defineNuxtModule } from '@nuxt/kit';
2
+ const resolver = createResolver(import.meta.url);
3
+ export default defineNuxtModule({
4
+ setup: () => addComponent({
5
+ filePath: resolver.resolve('./component.vue'),
6
+ name: 'NuxtLocaleLink'
7
+ })
8
+ });
@@ -1,5 +1,6 @@
1
1
  import packageName from 'depcheck-package-name';
2
2
  import { createRequire } from 'module';
3
+ import viteSvgLoader from 'vite-svg-loader';
3
4
  import config from "./config.js";
4
5
  const resolver = createRequire(import.meta.url);
5
6
  const isBasicAuthEnabled = process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASSWORD;
@@ -23,6 +24,12 @@ export default {
23
24
  devtools: {
24
25
  enabled: true
25
26
  },
27
+ i18n: {
28
+ bundle: {
29
+ optimizeTranslationDirective: false
30
+ }
31
+ },
32
+ // @nuxtjs/i18n only checks global options, not inline options, so it needs to be declared here.
26
33
  modules: [(options, nuxt) => {
27
34
  if (!config.userScalable) {
28
35
  const viewportMeta = nuxt.options.app.head.meta.find(meta => meta.name === 'viewport');
@@ -40,7 +47,7 @@ export default {
40
47
  failOnWarning: true,
41
48
  fix: true,
42
49
  lintOnStart: false
43
- }], resolver.resolve('./modules/i18n/index.js'), resolver.resolve('./modules/locale-link/index.js'), resolver.resolve('./modules/svg.js')],
50
+ }], resolver.resolve('./manually-installed-modules/i18n/index.js')],
44
51
  plugins: [resolver.resolve('./plugins/title.js')],
45
52
  router: {
46
53
  options: {
@@ -50,6 +57,9 @@ export default {
50
57
  runtimeConfig: {
51
58
  public: {
52
59
  name: config.name,
60
+ site: {
61
+ url: 'https://example.com'
62
+ },
53
63
  title: config.title
54
64
  },
55
65
  ...(isBasicAuthEnabled && {
@@ -58,7 +68,10 @@ export default {
58
68
  [process.env.BASIC_AUTH_USER]: process.env.BASIC_AUTH_PASSWORD
59
69
  }
60
70
  }
61
- })
71
+ }),
72
+ site: {
73
+ url: 'https://example.com'
74
+ }
62
75
  },
63
76
  vite: {
64
77
  css: {
@@ -66,6 +79,7 @@ export default {
66
79
  localsConvention: 'camelCaseOnly'
67
80
  }
68
81
  },
82
+ plugins: [viteSvgLoader()],
69
83
  vue: {
70
84
  template: {
71
85
  transformAssetUrls: false
@@ -4,7 +4,7 @@ import { createRequire } from 'module';
4
4
  import lint from "./lint.js";
5
5
  const _require = createRequire(import.meta.url);
6
6
  const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
7
- export default (async (options = {}) => {
7
+ export default async (options = {}) => {
8
8
  options = {
9
9
  log: process.env.NODE_ENV !== 'test',
10
10
  ...options
@@ -29,4 +29,4 @@ export default (async (options = {}) => {
29
29
  }] : []));
30
30
  }
31
31
  return nuxt;
32
- });
32
+ };
package/dist/start.js CHANGED
@@ -2,7 +2,7 @@ import { execa } from 'execa';
2
2
  import { createRequire } from 'module';
3
3
  const _require = createRequire(import.meta.url);
4
4
  const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
5
- export default ((options = {}) => {
5
+ export default (options = {}) => {
6
6
  options = {
7
7
  log: process.env.NODE_ENV !== 'test',
8
8
  ...options
@@ -10,4 +10,4 @@ export default ((options = {}) => {
10
10
  return execa(nuxtWrapper, ['start'], ...(options.log ? [{
11
11
  stdio: 'inherit'
12
12
  }] : []));
13
- });
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "6.1.2",
3
+ "version": "6.1.4",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -28,47 +28,46 @@
28
28
  "dependencies": {
29
29
  "@dword-design/depcheck-parser-sass": "^4.0.4",
30
30
  "@dword-design/dotenv-json-extended": "^2.0.25",
31
- "@dword-design/functions": "^6.0.1",
31
+ "@dword-design/functions": "^6.0.2",
32
32
  "@dword-design/jiti-babel-transform": "^2.0.0",
33
- "@dword-design/stylelint-config": "^4.0.0",
34
- "@nuxt/kit": "^3.12.4",
33
+ "@dword-design/stylelint-config": "^4.0.1",
34
+ "@nuxt/kit": "^3.16.2",
35
35
  "@nuxtjs/eslint-module": "^4.1.0",
36
- "@nuxtjs/i18n": "npm:@dword-design/nuxt-i18n@^0.0.5",
37
- "@nuxtjs/stylelint-module": "^5.2.0",
38
- "deepmerge": "^4.3.1",
36
+ "@nuxtjs/i18n": "^9.5.3",
37
+ "@nuxtjs/stylelint-module": "^5.2.1",
39
38
  "depcheck-package-name": "^3.0.1",
40
39
  "depcheck-parser-vue": "^5.0.0",
41
- "execa": "^9.3.1",
42
- "fs-extra": "^11.2.0",
43
- "globby": "^14.0.2",
44
- "jiti": "^1.21.6",
45
- "nuxt": "^3.12.4",
46
- "nuxt-babel-runtime": "^5.0.6",
40
+ "execa": "^9.5.2",
41
+ "fs-extra": "^11.3.0",
42
+ "globby": "^14.1.0",
43
+ "jiti": "^2.4.2",
44
+ "nuxt": "^3.16.2",
45
+ "nuxt-babel-runtime": "^5.0.10",
47
46
  "nuxt-basic-authentication-module": "^0.2.1",
48
47
  "output-files": "^2.0.32",
49
48
  "require-package-name": "^2.0.1",
50
- "stylelint": "^16.8.2",
49
+ "stylelint": "^16.18.0",
51
50
  "vite-svg-loader": "^5.1.0"
52
51
  },
53
52
  "devDependencies": {
54
- "@dword-design/base": "^11.2.3",
55
- "@dword-design/puppeteer": "^7.0.2",
53
+ "@dword-design/base": "^11.2.10",
56
54
  "@dword-design/tester": "^2.0.19",
57
- "@dword-design/tester-plugin-puppeteer": "^3.0.3",
58
55
  "@dword-design/tester-plugin-tmp-dir": "^2.1.26",
59
- "@funken-studio/sitemap-nuxt-3": "^4.0.4",
60
- "axios": "^1.7.4",
56
+ "@nuxtjs/sitemap": "^7.2.10",
57
+ "axios": "^1.8.4",
61
58
  "depcheck": "^1.4.7",
62
59
  "expect": "^29.7.0",
63
60
  "nuxt-dev-ready": "^3.0.0",
61
+ "playwright": "^1.51.1",
62
+ "playwright-chromium": "^1.51.1",
64
63
  "port-ready": "^0.1.0",
65
64
  "tree-kill-promise": "^3.0.14",
66
- "xml-formatter": "^3.6.3"
65
+ "xml-formatter": "^3.6.5"
67
66
  },
68
67
  "peerDependencies": {
69
68
  "h3": "*"
70
69
  },
71
- "packageManager": "pnpm@9.7.1+sha512.faf344af2d6ca65c4c5c8c2224ea77a81a5e8859cbc4e06b1511ddce2f0151512431dd19e6aff31f2c6a8f5f2aced9bd2273e1fed7dd4de1868984059d2c4247",
70
+ "packageManager": "pnpm@10.8.0+sha512.0e82714d1b5b43c74610193cb20734897c1d00de89d0e18420aebc5977fa13d780a9cb05734624e81ebd81cc876cd464794850641c48b9544326b5622ca29971",
72
71
  "engines": {
73
72
  "node": ">=18"
74
73
  },
@@ -1,36 +0,0 @@
1
- import { addPlugin, createResolver, installModule } from '@nuxt/kit';
2
- import packageName from 'depcheck-package-name';
3
- import { globby } from 'globby';
4
- import P from 'path';
5
- const resolver = createResolver(import.meta.url);
6
- export default (async (options, nuxt) => {
7
- const locales = (await globby('*.json', {
8
- cwd: P.join(nuxt.options.srcDir, 'i18n')
9
- })).map(filename => P.basename(filename, '.json'));
10
- const defaultLocale = locales.includes('en') ? 'en' : locales[0];
11
- if (locales.length === 0) {
12
- return;
13
- }
14
- await installModule(packageName`@nuxtjs/i18n`, {
15
- defaultLocale,
16
- detectBrowserLanguage: locales.length === 1 ? false : {
17
- fallbackLocale: defaultLocale,
18
- redirectOn: 'no prefix',
19
- useCookie: false
20
- },
21
- langDir: 'i18n',
22
- lazy: true,
23
- locales: locales.map(locale => ({
24
- code: locale,
25
- file: `${locale}.json`,
26
- iso: locale
27
- })),
28
- strategy: `${locales.length === 1 ? 'no_' : ''}prefix`,
29
- ...(process.env.BASE_URL && {
30
- baseUrl: process.env.BASE_URL
31
- })
32
- });
33
- addPlugin(resolver.resolve('./plugin.js'), {
34
- append: true
35
- });
36
- });
@@ -1,9 +0,0 @@
1
- <template>
2
- <nuxt-link v-bind="$attrs" :to="localePath(to)">
3
- <slot />
4
- </nuxt-link>
5
- </template>
6
-
7
- <script>
8
- export default { props: { to: { required: true } } };
9
- </script>
@@ -1,16 +0,0 @@
1
- import { addPlugin, addTemplate, createResolver } from '@nuxt/kit';
2
- import P from 'path';
3
- const resolver = createResolver(import.meta.url);
4
- export default (() => {
5
- addTemplate({
6
- filename: P.join('nuxt-locale-link', 'component.vue'),
7
- src: resolver.resolve('./component.vue'),
8
- write: true
9
- });
10
- addPlugin({
11
- filename: P.join('nuxt-locale-link', 'plugin.js'),
12
- src: resolver.resolve('./plugin')
13
- }, {
14
- append: true
15
- });
16
- });
@@ -1,5 +0,0 @@
1
- import svgLoader from 'vite-svg-loader';
2
- export default ((moduleOptions, nuxt) => {
3
- nuxt.options.vite.plugins = nuxt.options.vite.plugins || [];
4
- nuxt.options.vite.plugins.push(svgLoader());
5
- });