@dword-design/base-config-nuxt 5.0.5 → 5.0.7

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.
@@ -1,13 +1,19 @@
1
1
  import packageName from 'depcheck-package-name';
2
- export default {
2
+ export default (config => ({
3
3
  extends: packageName`@dword-design/eslint-config`,
4
4
  globals: {
5
5
  $fetch: 'readonly'
6
6
  },
7
+ overrides: [{
8
+ files: 'pages/**/*.vue',
9
+ globals: {
10
+ definePageMeta: 'readonly'
11
+ }
12
+ }],
7
13
  rules: {
8
14
  'import/no-unresolved': ['error', {
9
- ignore: ['#imports']
15
+ ignore: ['#imports', '#components', ...config.importAliases]
10
16
  }],
11
17
  'import/no-webpack-loader-syntax': 'off'
12
18
  }
13
- };
19
+ }));
package/dist/index.js CHANGED
@@ -11,78 +11,81 @@ import { fileURLToPath } from 'url';
11
11
  import analyze from "./analyze.js";
12
12
  import depcheckSpecial from "./depcheck-special.js";
13
13
  import dev from "./dev.js";
14
- import eslintConfig from "./eslint.config.js";
14
+ import getEslintConfig from "./get-eslint-config.js";
15
15
  import lint from "./lint.js";
16
16
  import prepublishOnly from "./prepublish-only.js";
17
17
  import start from "./start.js";
18
18
  const __dirname = P.dirname(fileURLToPath(import.meta.url));
19
19
  const _require = createRequire(import.meta.url);
20
20
  const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
21
- export default {
22
- allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
23
- commands: {
24
- analyze,
25
- dev,
26
- prepublishOnly,
27
- start
28
- },
29
- depcheckConfig: {
30
- parsers: {
31
- '**/*.scss': depcheckParserSass,
32
- '**/*.vue': depcheckParserVue
21
+ export default ((config = {}) => {
22
+ config.importAliases = config.importAliases || [];
23
+ return {
24
+ allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
25
+ commands: {
26
+ analyze,
27
+ dev,
28
+ prepublishOnly,
29
+ start
33
30
  },
34
- specials: [depcheckSpecial]
35
- },
36
- editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'app.vue', 'dist', 'nuxt.config.js'],
37
- eslintConfig,
38
- gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/app.vue', '/dist', '/nuxt.config.js'],
39
- lint,
40
- nodeVersion: 18,
41
- npmPublish: true,
42
- packageConfig: {
43
- main: 'dist/index.js'
44
- },
45
- prepare: async () => {
46
- const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
47
- const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
48
- const translations = await globby('i18n/*.json');
49
- const hasI18n = translations.length > 0;
50
- await outputFiles({
51
- '.stylelintrc.json': `${JSON.stringify({
52
- extends: packageName`@dword-design/stylelint-config`
53
- }, undefined, 2)}\n`,
54
- 'app.vue': endent`
55
- <template>
56
- <NuxtLayout>
57
- <NuxtPage />
58
- </NuxtLayout>
59
- </template>
31
+ depcheckConfig: {
32
+ parsers: {
33
+ '**/*.scss': depcheckParserSass,
34
+ '**/*.vue': depcheckParserVue
35
+ },
36
+ specials: [depcheckSpecial]
37
+ },
38
+ editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'app.vue', 'dist', 'nuxt.config.js'],
39
+ eslintConfig: getEslintConfig(config),
40
+ gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/app.vue', '/dist', '/nuxt.config.js'],
41
+ lint,
42
+ nodeVersion: 18,
43
+ npmPublish: true,
44
+ packageConfig: {
45
+ main: 'dist/index.js'
46
+ },
47
+ prepare: async () => {
48
+ const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
49
+ const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
50
+ const translations = await globby('i18n/*.json');
51
+ const hasI18n = translations.length > 0;
52
+ await outputFiles({
53
+ '.stylelintrc.json': `${JSON.stringify({
54
+ extends: packageName`@dword-design/stylelint-config`
55
+ }, undefined, 2)}\n`,
56
+ 'app.vue': endent`
57
+ <template>
58
+ <NuxtLayout>
59
+ <NuxtPage />
60
+ </NuxtLayout>
61
+ </template>
60
62
 
61
- <script setup>
62
- import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
63
+ <script setup>
64
+ import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
63
65
 
64
- ${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
66
+ ${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
65
67
 
66
- useHead({
67
- ${[...(hasI18n ? [endent`
68
- htmlAttrs: {
69
- lang: i18nHead.value.htmlAttrs.lang,
70
- },
71
- link: i18nHead.value.link,
72
- meta: i18nHead.value.meta,
73
- `] : []), "titleTemplate: title => title ? `${title} | ${runtimeConfig.public.name}` : `${runtimeConfig.public.name}${runtimeConfig.public.title ? `: ${runtimeConfig.public.title}` : ''}`"].join('\n')}
74
- })
75
- </script>\n
76
- `,
77
- 'nuxt.config.js': javascript`
78
- import deepmerge from '${packageName`deepmerge`}'
79
- import config from '${configPath}'
80
- import parentConfig from '${parentConfigPath}'
68
+ useHead({
69
+ ${[...(hasI18n ? [endent`
70
+ htmlAttrs: {
71
+ lang: i18nHead.value.htmlAttrs.lang,
72
+ },
73
+ link: i18nHead.value.link,
74
+ meta: i18nHead.value.meta,
75
+ `] : []), "titleTemplate: title => title ? `${title} | ${runtimeConfig.public.name}` : `${runtimeConfig.public.name}${runtimeConfig.public.title ? `: ${runtimeConfig.public.title}` : ''}`"].join('\n')}
76
+ })
77
+ </script>\n
78
+ `,
79
+ 'nuxt.config.js': javascript`
80
+ import deepmerge from '${packageName`deepmerge`}'
81
+ import config from '${configPath}'
82
+ import parentConfig from '${parentConfigPath}'
81
83
 
82
- export default deepmerge(parentConfig, config)\n
83
- `
84
- });
85
- },
86
- supportedNodeVersions: [16, 18],
87
- useJobMatrix: true
88
- };
84
+ export default deepmerge(parentConfig, config)\n
85
+ `
86
+ });
87
+ },
88
+ supportedNodeVersions: [16, 18],
89
+ useJobMatrix: true
90
+ };
91
+ });
@@ -6,7 +6,6 @@ import packageName from 'depcheck-package-name';
6
6
  import vitePluginBabel from 'vite-plugin-babel';
7
7
  import vueSfcDescriptorToString from 'vue-sfc-descriptor-to-string';
8
8
  import config from "./config.js";
9
- // import expressModule from './modules/express/index.js'
10
9
  import i18nModule from "./modules/i18n.js";
11
10
  import localeLinkModule from "./modules/locale-link/index.js";
12
11
  import svgModule from "./modules/svg.js";
@@ -78,7 +77,7 @@ export default {
78
77
  enforce: 'pre',
79
78
  transform: async (code, id) => {
80
79
  const query = parseVueRequest(id);
81
- if (query.filename.endsWith('.vue') && !query.filename.split('/').includes('node_modules')) {
80
+ if (query.filename.endsWith('.vue') && query.query.type !== 'style' && !query.filename.split('/').includes('node_modules')) {
82
81
  const sfc = parse(code);
83
82
  for (const section of ['scriptSetup', 'script']) {
84
83
  if (sfc.descriptor[section] && sfc.descriptor[section].lang === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -43,13 +43,10 @@
43
43
  "depcheck-package-name": "^3.0.0",
44
44
  "depcheck-parser-vue": "^4.0.7",
45
45
  "execa": "^7.1.1",
46
- "express": "^4.17.1",
47
- "express-mount-files": "npm:@dword-design/express-mount-files",
48
46
  "fs-extra": "^11.1.0",
49
47
  "globby": "^13.1.3",
50
48
  "jiti": "^1.18.2",
51
49
  "nuxt": "^3.2.3",
52
- "nuxt-alias-path": "^1.0.0",
53
50
  "nuxt-basic-authentication-module": "^0.2.1",
54
51
  "output-files": "^2.0.0",
55
52
  "require-package-name": "^2.0.1",
@@ -1,29 +0,0 @@
1
- import jitiBabelTransform from '@dword-design/jiti-babel-transform';
2
- import express from 'express';
3
- import mountFiles from 'express-mount-files';
4
- import { fromNodeMiddleware } from 'h3';
5
- import jiti from 'jiti';
6
- import P from 'path';
7
- import options from '#express/options.js';
8
- const jitiOptions = {
9
- esmResolve: true,
10
- interopDefault: true,
11
- transform: jitiBabelTransform
12
- };
13
- const jitiInstance = jiti(options.srcDir, jitiOptions);
14
- let app = express().use(express.json()).use(express.urlencoded({
15
- extended: false
16
- }));
17
- try {
18
- const setupExpress = jitiInstance('./setup-express');
19
- app = setupExpress(app);
20
- } catch (error) {
21
- if (!error.message.startsWith("Cannot find module './setup-express'")) {
22
- throw error;
23
- }
24
- }
25
- app.use('/api', mountFiles(P.resolve(options.srcDir, 'api'), {
26
- jitiOptions,
27
- paramChar: '_'
28
- }));
29
- export default fromNodeMiddleware(app);
@@ -1,18 +0,0 @@
1
- import { addServerHandler, addTemplate, createResolver } from '@nuxt/kit';
2
- import nuxtAliasPath from 'nuxt-alias-path';
3
- import P from 'path';
4
- const resolver = createResolver(import.meta.url);
5
- const moduleName = 'express';
6
- export default ((options, nuxt) => {
7
- addTemplate({
8
- filename: P.join(moduleName, 'options.js'),
9
- getContents: () => `export default ${JSON.stringify({
10
- srcDir: nuxt.options.srcDir
11
- }, undefined, 2)}`,
12
- write: true
13
- });
14
- nuxt.options.alias[`#${moduleName}`] = nuxtAliasPath(moduleName, nuxt);
15
- addServerHandler({
16
- handler: resolver.resolve('./handler')
17
- });
18
- });