@dword-design/base-config-nuxt 3.1.7 → 3.2.0
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/analyze.js +3 -16
- package/dist/depcheck-special.js +18 -34
- package/dist/dev.js +12 -17
- package/dist/eslint.config.js +4 -16
- package/dist/get-nuxt-config.js +8 -0
- package/dist/index.js +24 -46
- package/dist/lint.js +5 -18
- package/dist/modules/project/index.js +58 -48
- package/dist/modules/project/modules/axios-dynamic-baseurl/index.js +6 -0
- package/dist/modules/project/modules/axios-dynamic-baseurl/plugin.js +5 -0
- package/dist/modules/project/modules/babel.js +3 -0
- package/dist/modules/project/modules/body-parser.js +4 -0
- package/dist/modules/{css-modules.js → project/modules/css-modules.js} +2 -11
- package/dist/modules/project/modules/dotenv.js +6 -0
- package/dist/modules/project/modules/i18n/index.js +79 -0
- package/dist/modules/project/modules/i18n/missing-nuxt-i18n-head-error.js +17 -0
- package/dist/modules/project/modules/locale-link/index.js +14 -0
- package/dist/modules/{locale-link → project/modules/locale-link}/nuxt-locale-link.vue +0 -0
- package/dist/modules/project/modules/locale-link/plugin.js +3 -0
- package/dist/modules/project/modules/raw.js +10 -0
- package/dist/modules/project/modules/server-middleware/index.js +14 -0
- package/dist/prepublish-only.js +16 -27
- package/dist/start.js +16 -17
- package/package.json +7 -9
- package/dist/modules/axios-dynamic-baseurl/index.js +0 -16
- package/dist/modules/axios-dynamic-baseurl/plugin.js +0 -15
- package/dist/modules/babel.js +0 -12
- package/dist/modules/body-parser.js +0 -16
- package/dist/modules/dotenv.js +0 -20
- package/dist/modules/i18n/index.js +0 -119
- package/dist/modules/i18n/missing-nuxt-i18n-head-error.js +0 -32
- package/dist/modules/locale-link/index.js +0 -25
- package/dist/modules/locale-link/plugin.js +0 -9
- package/dist/modules/raw.js +0 -22
- package/dist/modules/server-middleware.js +0 -28
- package/dist/nuxt.config.js +0 -37
package/dist/analyze.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _execa = _interopRequireDefault(require("execa"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = () => (0, _execa.default)('nuxt-babel', ['build', '--analyze', '--config-file', require.resolve("./nuxt.config")], {
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
export default (() => execa('nuxt-babel', ['build', '--analyze', '--config-file', require.resolve("./nuxt.config")], {
|
|
13
3
|
stdio: 'inherit'
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
17
|
-
module.exports = exports.default;
|
|
4
|
+
}));
|
package/dist/depcheck-special.js
CHANGED
|
@@ -1,36 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _default = filename => {
|
|
19
|
-
if (_path.default.basename(filename) === 'nuxt.config.js') {
|
|
20
|
-
var _ref, _modules;
|
|
21
|
-
|
|
22
|
-
const config = require(filename);
|
|
23
|
-
|
|
24
|
-
const modules = [...(config.modules || []), ...(config.buildModules || [])];
|
|
25
|
-
return _ref = (_modules = modules, (0, _map.default)(mod => {
|
|
26
|
-
var _concat;
|
|
27
|
-
|
|
28
|
-
return _concat = [].concat(mod), (0, _first.default)(_concat);
|
|
29
|
-
})(_modules)), (0, _filter.default)(name => typeof name === 'string')(_ref);
|
|
1
|
+
import filter from "@dword-design/functions/dist/filter.js";
|
|
2
|
+
import first from "@dword-design/functions/dist/first.js";
|
|
3
|
+
import map from "@dword-design/functions/dist/map.js";
|
|
4
|
+
import P from 'path';
|
|
5
|
+
export default (async path => {
|
|
6
|
+
try {
|
|
7
|
+
if (P.basename(path) === 'nuxt.config.js') {
|
|
8
|
+
var _ref, _modules;
|
|
9
|
+
const config = (await import(path)).default;
|
|
10
|
+
const modules = [...(config.modules || []), ...(config.buildModules || [])];
|
|
11
|
+
return _ref = (_modules = modules, map(mod => {
|
|
12
|
+
var _concat;
|
|
13
|
+
return _concat = [].concat(mod), first(_concat);
|
|
14
|
+
})(_modules)), filter(name => typeof name === 'string')(_ref);
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.log(error);
|
|
30
18
|
}
|
|
31
|
-
|
|
32
19
|
return [];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
exports.default = _default;
|
|
36
|
-
module.exports = exports.default;
|
|
20
|
+
});
|
package/dist/dev.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stdio: 'inherit'
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
17
|
-
module.exports = exports.default;
|
|
1
|
+
import { Builder, Nuxt } from 'nuxt';
|
|
2
|
+
import getNuxtConfig from "./get-nuxt-config.js";
|
|
3
|
+
export default (async nuxtConfig => {
|
|
4
|
+
const nuxt = new Nuxt({
|
|
5
|
+
...getNuxtConfig(),
|
|
6
|
+
dev: true,
|
|
7
|
+
...nuxtConfig
|
|
8
|
+
});
|
|
9
|
+
await new Builder(nuxt).build();
|
|
10
|
+
await nuxt.listen();
|
|
11
|
+
return nuxt;
|
|
12
|
+
});
|
package/dist/eslint.config.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = {
|
|
13
|
-
extends: (0, _depcheckPackageName.default)`@dword-design/eslint-config`,
|
|
1
|
+
import packageName from 'depcheck-package-name';
|
|
2
|
+
export default {
|
|
3
|
+
extends: packageName`@dword-design/eslint-config`,
|
|
14
4
|
rules: {
|
|
15
5
|
'import/no-webpack-loader-syntax': 'off'
|
|
16
6
|
}
|
|
17
|
-
};
|
|
18
|
-
exports.default = _default;
|
|
19
|
-
module.exports = exports.default;
|
|
7
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,62 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _fsExtra = require("fs-extra");
|
|
15
|
-
|
|
16
|
-
var _analyze = _interopRequireDefault(require("./analyze"));
|
|
17
|
-
|
|
18
|
-
var _depcheckSpecial = _interopRequireDefault(require("./depcheck-special"));
|
|
19
|
-
|
|
20
|
-
var _dev = _interopRequireDefault(require("./dev"));
|
|
21
|
-
|
|
22
|
-
var _eslint = _interopRequireDefault(require("./eslint.config"));
|
|
23
|
-
|
|
24
|
-
var _lint = _interopRequireDefault(require("./lint"));
|
|
25
|
-
|
|
26
|
-
var _prepublishOnly = _interopRequireDefault(require("./prepublish-only"));
|
|
27
|
-
|
|
28
|
-
var _start = _interopRequireDefault(require("./start"));
|
|
29
|
-
|
|
30
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
|
-
var _default = {
|
|
1
|
+
import depcheckParserSass from '@dword-design/depcheck-parser-sass';
|
|
2
|
+
import packageName from 'depcheck-package-name';
|
|
3
|
+
import depcheckParserVue from 'depcheck-parser-vue';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import analyze from "./analyze.js";
|
|
6
|
+
import depcheckSpecial from "./depcheck-special.js";
|
|
7
|
+
import dev from "./dev.js";
|
|
8
|
+
import eslintConfig from "./eslint.config.js";
|
|
9
|
+
import lint from "./lint.js";
|
|
10
|
+
import prepublishOnly from "./prepublish-only.js";
|
|
11
|
+
import start from "./start.js";
|
|
12
|
+
export default {
|
|
33
13
|
allowedMatches: ['.stylelintrc.json', 'api', 'assets', 'components', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'nuxt.config.js', 'pages', 'plugins', 'static', 'store', 'types'],
|
|
34
14
|
commands: {
|
|
35
|
-
analyze
|
|
36
|
-
dev
|
|
37
|
-
prepublishOnly
|
|
38
|
-
start
|
|
15
|
+
analyze,
|
|
16
|
+
dev,
|
|
17
|
+
prepublishOnly,
|
|
18
|
+
start
|
|
39
19
|
},
|
|
40
20
|
coverageFileExtensions: ['.scss', '.vue'],
|
|
41
21
|
depcheckConfig: {
|
|
42
22
|
parsers: {
|
|
43
|
-
'**/*.scss':
|
|
44
|
-
'**/*.vue':
|
|
23
|
+
'**/*.scss': depcheckParserSass,
|
|
24
|
+
'**/*.vue': depcheckParserVue
|
|
45
25
|
},
|
|
46
|
-
specials: [
|
|
26
|
+
specials: [depcheckSpecial]
|
|
47
27
|
},
|
|
48
28
|
editorIgnore: ['.eslintcache', '.stylelintrc.json', '.nuxt', 'dist'],
|
|
49
|
-
eslintConfig
|
|
29
|
+
eslintConfig,
|
|
50
30
|
gitignore: ['/.eslintcache', '/.nuxt', '/dist'],
|
|
51
|
-
lint
|
|
31
|
+
lint,
|
|
52
32
|
npmPublish: true,
|
|
53
33
|
packageConfig: {
|
|
54
34
|
main: 'dist/index.js'
|
|
55
35
|
},
|
|
56
|
-
prepare: () =>
|
|
57
|
-
extends:
|
|
36
|
+
prepare: () => fs.outputFile('.stylelintrc.json', JSON.stringify({
|
|
37
|
+
extends: packageName`@dword-design/stylelint-config`
|
|
58
38
|
}, undefined, 2)),
|
|
59
39
|
useJobMatrix: true
|
|
60
|
-
};
|
|
61
|
-
exports.default = _default;
|
|
62
|
-
module.exports = exports.default;
|
|
40
|
+
};
|
package/dist/lint.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _execa = _interopRequireDefault(require("execa"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = async () => {
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
export default (async () => {
|
|
13
3
|
try {
|
|
14
|
-
await
|
|
4
|
+
await execa.command('eslint --fix --ignore-path .gitignore --ext .js,.json,.vue .', {
|
|
15
5
|
all: true
|
|
16
6
|
});
|
|
17
|
-
await
|
|
7
|
+
await execa.command('stylelint --fix --allow-empty-input --ignore-path .gitignore **/*.{css,scss,vue}', {
|
|
18
8
|
all: true
|
|
19
9
|
});
|
|
20
10
|
} catch (error) {
|
|
21
11
|
throw new Error(error.all);
|
|
22
12
|
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.default = _default;
|
|
26
|
-
module.exports = exports.default;
|
|
13
|
+
});
|
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
async function _default() {
|
|
27
|
-
var _ref, _projectConfig$router, _projectConfig, _defaultConfig$this$o, _projectConfig$module;
|
|
28
|
-
|
|
1
|
+
import join from "@dword-design/functions/dist/join.js";
|
|
2
|
+
import keys from "@dword-design/functions/dist/keys.js";
|
|
3
|
+
import map from "@dword-design/functions/dist/map.js";
|
|
4
|
+
import omit from "@dword-design/functions/dist/omit.js";
|
|
5
|
+
import packageName from 'depcheck-package-name';
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
|
+
import nuxtPushPlugins from 'nuxt-push-plugins';
|
|
8
|
+
import P from 'path';
|
|
9
|
+
import sequential from 'promise-sequential';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import axiosDynamicBaseurlModule from "./modules/axios-dynamic-baseurl/index.js";
|
|
12
|
+
import babelModule from "./modules/babel.js";
|
|
13
|
+
import bodyParserModule from "./modules/body-parser.js";
|
|
14
|
+
import cssModulesModule from "./modules/css-modules.js";
|
|
15
|
+
import dotenvModule from "./modules/dotenv.js";
|
|
16
|
+
import i18nModule from "./modules/i18n/index.js";
|
|
17
|
+
import localeLinkModule from "./modules/locale-link/index.js";
|
|
18
|
+
import rawModule from "./modules/raw.js";
|
|
19
|
+
import serverMiddlewareModule from "./modules/server-middleware/index.js";
|
|
20
|
+
const _require = createRequire(import.meta.url);
|
|
21
|
+
export default async function () {
|
|
22
|
+
var _ref, _projectConfig$router, _projectConfig, _defaultConfig$this$o, _ref2;
|
|
29
23
|
const defaultConfig = {
|
|
30
24
|
bodyAttrs: {},
|
|
31
|
-
css: [
|
|
25
|
+
css: [_require.resolve('./style.css')],
|
|
32
26
|
head: {},
|
|
33
27
|
headAttrs: {},
|
|
34
28
|
htmlAttrs: {},
|
|
@@ -39,32 +33,38 @@ async function _default() {
|
|
|
39
33
|
serverMiddleware: [],
|
|
40
34
|
userScalable: true
|
|
41
35
|
};
|
|
42
|
-
|
|
43
|
-
const
|
|
36
|
+
let localConfig;
|
|
37
|
+
const configPath = P.join(this.options.rootDir, 'nuxt.config.js');
|
|
38
|
+
try {
|
|
39
|
+
localConfig = (await import(configPath)).default;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (error.message === `Cannot find module '${configPath}' imported from ${fileURLToPath(import.meta.url)}`) {
|
|
42
|
+
localConfig = {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const projectConfig = {
|
|
46
|
+
...defaultConfig,
|
|
44
47
|
...localConfig,
|
|
45
48
|
css: [...defaultConfig.css, ...(localConfig.css || [])]
|
|
46
49
|
};
|
|
47
|
-
this.options.watch.push(
|
|
50
|
+
this.options.watch.push(P.join(this.options.rootDir, 'nuxt.config.js'));
|
|
48
51
|
this.options.publicRuntimeConfig.name = projectConfig.name;
|
|
49
52
|
this.options.publicRuntimeConfig.title = projectConfig.title;
|
|
50
53
|
/* istanbul ignore next */
|
|
51
|
-
|
|
52
54
|
this.options.head.titleTemplate = function (title) {
|
|
53
55
|
return title ? `${title} | ${this.$config.name}` : [this.$config.name, ...(this.$config.title ? [this.$config.title] : [])].join(': ');
|
|
54
56
|
};
|
|
55
|
-
|
|
56
57
|
this.options.head.link.push(...(projectConfig.head.link || []));
|
|
57
58
|
this.options.head.meta.push({
|
|
58
59
|
charset: 'utf-8'
|
|
59
60
|
}, {
|
|
60
|
-
content: (_ref = ['width=device-width', 'initial-scale=1', ...(projectConfig.userScalable ? [] : ['user-scalable=0'])], (
|
|
61
|
+
content: (_ref = ['width=device-width', 'initial-scale=1', ...(projectConfig.userScalable ? [] : ['user-scalable=0'])], join(', ')(_ref)),
|
|
61
62
|
name: 'viewport'
|
|
62
63
|
}, {
|
|
63
64
|
content: projectConfig.name,
|
|
64
65
|
hid: 'description',
|
|
65
66
|
name: 'description'
|
|
66
67
|
});
|
|
67
|
-
|
|
68
68
|
if (projectConfig.ogImage) {
|
|
69
69
|
this.options.head.meta.push({
|
|
70
70
|
content: projectConfig.ogImage,
|
|
@@ -72,14 +72,12 @@ async function _default() {
|
|
|
72
72
|
name: 'og:image'
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
|
|
76
75
|
if (projectConfig.webApp) {
|
|
77
76
|
this.options.head.meta.push({
|
|
78
77
|
content: 'yes',
|
|
79
78
|
name: 'apple-mobile-web-app-capable'
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
|
-
|
|
83
81
|
this.options.head.htmlAttrs = projectConfig.htmlAttrs;
|
|
84
82
|
this.options.head.headAttrs = projectConfig.headAttrs;
|
|
85
83
|
this.options.head.bodyAttrs = projectConfig.bodyAttrs;
|
|
@@ -89,19 +87,31 @@ async function _default() {
|
|
|
89
87
|
Object.assign(this.options.router, {
|
|
90
88
|
linkActiveClass: 'active',
|
|
91
89
|
routeNameSplitter: '.',
|
|
92
|
-
...(_projectConfig$router = projectConfig.router, (
|
|
90
|
+
...(_projectConfig$router = projectConfig.router, omit('middleware')(_projectConfig$router))
|
|
93
91
|
});
|
|
94
92
|
this.options.router.middleware = [...this.options.router.middleware, ...(projectConfig.router.middleware || [])];
|
|
95
|
-
Object.assign(this.options, (_projectConfig = projectConfig, (
|
|
93
|
+
Object.assign(this.options, (_projectConfig = projectConfig, omit((_defaultConfig$this$o = {
|
|
94
|
+
...defaultConfig,
|
|
96
95
|
...this.options
|
|
97
|
-
}, (
|
|
98
|
-
await (
|
|
96
|
+
}, keys(_defaultConfig$this$o)))(_projectConfig)));
|
|
97
|
+
await sequential((_ref2 = [[packageName`nuxt-basic-auth-module`, {
|
|
98
|
+
enabled: process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASSWORD,
|
|
99
|
+
name: process.env.BASIC_AUTH_USER,
|
|
100
|
+
pass: process.env.BASIC_AUTH_PASSWORD
|
|
101
|
+
}], babelModule, dotenvModule, [packageName`@nuxtjs/eslint-module`, {
|
|
102
|
+
failOnWarning: true,
|
|
103
|
+
fix: true
|
|
104
|
+
}], [packageName`@nuxtjs/stylelint-module`, {
|
|
105
|
+
allowEmptyInput: true,
|
|
106
|
+
failOnWarning: true,
|
|
107
|
+
fix: true
|
|
108
|
+
}], cssModulesModule, rawModule, i18nModule, bodyParserModule, [serverMiddlewareModule, {
|
|
109
|
+
expressInstance: projectConfig.expressInstance
|
|
110
|
+
}], packageName`@nuxtjs/axios`, axiosDynamicBaseurlModule, packageName`nuxt-svg-loader`, localeLinkModule, ...projectConfig.modules], map(module => () => this.addModule(module))(_ref2)));
|
|
99
111
|
this.addTemplate({
|
|
100
|
-
fileName:
|
|
112
|
+
fileName: P.join('project', 'project-config.js'),
|
|
101
113
|
options: projectConfig,
|
|
102
|
-
src:
|
|
114
|
+
src: _require.resolve('./project-config.js.template')
|
|
103
115
|
});
|
|
104
|
-
(
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
module.exports = exports.default;
|
|
116
|
+
nuxtPushPlugins(this, ...projectConfig.plugins);
|
|
117
|
+
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
function _default() {
|
|
1
|
+
export default function () {
|
|
9
2
|
this.options.build.loaders.cssModules.modules.localIdentName = this.options.dev ? '[name]__[local]' : '[hash:base64]';
|
|
10
3
|
this.options.build.loaders.cssModules.modules.exportLocalsConvention = 'camelCase';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = exports.default;
|
|
4
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as babel from '@babel/core';
|
|
2
|
+
import traverse from '@babel/traverse';
|
|
3
|
+
import map from "@dword-design/functions/dist/map.js";
|
|
4
|
+
import some from "@dword-design/functions/dist/some.js";
|
|
5
|
+
import uniq from "@dword-design/functions/dist/uniq.js";
|
|
6
|
+
import packageName from 'depcheck-package-name';
|
|
7
|
+
import fs from 'fs-extra';
|
|
8
|
+
import globby from 'globby';
|
|
9
|
+
import P from 'path';
|
|
10
|
+
import vueTemplateCompiler from 'vue-template-compiler';
|
|
11
|
+
import MissingNuxtI18nHeadError from "./missing-nuxt-i18n-head-error.js";
|
|
12
|
+
const checkNuxtI18nHead = async () => {
|
|
13
|
+
var _ref, _ref2, _layoutFiles;
|
|
14
|
+
const layoutFiles = (_ref = (_ref2 = ['default.vue', ...(await globby('*', {
|
|
15
|
+
cwd: 'layouts',
|
|
16
|
+
ignore: '-*'
|
|
17
|
+
}))], await _ref2), uniq(_ref));
|
|
18
|
+
const checkLayoutFile = async layoutFile => {
|
|
19
|
+
var _layout$script;
|
|
20
|
+
const layout = (await fs.exists(P.join('layouts', layoutFile))) ? vueTemplateCompiler.parseComponent(await fs.readFile(P.join('layouts', layoutFile), 'utf8')) : {};
|
|
21
|
+
if ((_layout$script = layout.script) !== null && _layout$script !== void 0 && _layout$script.content) {
|
|
22
|
+
var _layout$script2;
|
|
23
|
+
const ast = await babel.parse((_layout$script2 = layout.script) === null || _layout$script2 === void 0 ? void 0 : _layout$script2.content, {
|
|
24
|
+
filename: 'index.js'
|
|
25
|
+
});
|
|
26
|
+
let valid = false;
|
|
27
|
+
traverse.default(ast, {
|
|
28
|
+
ExportDefaultDeclaration: path => {
|
|
29
|
+
var _path$node$declaratio;
|
|
30
|
+
if (_path$node$declaratio = path.node.declaration.properties, some(property => {
|
|
31
|
+
var _property$key, _property$body$body$, _property$body$body$2, _property$body$body$3;
|
|
32
|
+
return property.type === 'ObjectMethod' && ((_property$key = property.key) === null || _property$key === void 0 ? void 0 : _property$key.name) === 'head' && property.body.body.length === 1 && property.body.body[0].type === 'ReturnStatement' && property.body.body[0].argument.type === 'CallExpression' && property.body.body[0].argument.callee.type === 'MemberExpression' && property.body.body[0].argument.callee.object.type === 'ThisExpression' && ((_property$body$body$ = property.body.body[0].argument.callee.property) === null || _property$body$body$ === void 0 ? void 0 : _property$body$body$.name) === '$nuxtI18nHead' && property.body.body[0].argument.arguments.length === 1 && property.body.body[0].argument.arguments[0].type === 'ObjectExpression' && property.body.body[0].argument.arguments[0].properties.length === 1 && ((_property$body$body$2 = property.body.body[0].argument.arguments[0].properties[0].key) === null || _property$body$body$2 === void 0 ? void 0 : _property$body$body$2.name) === 'addSeoAttributes' && ((_property$body$body$3 = property.body.body[0].argument.arguments[0].properties[0].value) === null || _property$body$body$3 === void 0 ? void 0 : _property$body$body$3.value) === true;
|
|
33
|
+
})(_path$node$declaratio)) {
|
|
34
|
+
valid = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (valid) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw new MissingNuxtI18nHeadError(layoutFile);
|
|
43
|
+
};
|
|
44
|
+
return Promise.all((_layoutFiles = layoutFiles, map(checkLayoutFile)(_layoutFiles)));
|
|
45
|
+
};
|
|
46
|
+
export default async function () {
|
|
47
|
+
const localeFiles = await globby('*.json', {
|
|
48
|
+
cwd: P.join(this.options.srcDir, 'i18n')
|
|
49
|
+
});
|
|
50
|
+
if (localeFiles.length > 0) {
|
|
51
|
+
var _localeFiles;
|
|
52
|
+
await checkNuxtI18nHead();
|
|
53
|
+
await this.addModule([packageName`@nuxtjs/i18n`, {
|
|
54
|
+
detectBrowserLanguage: localeFiles.length === 1 ? false : {
|
|
55
|
+
fallbackLocale: 'en',
|
|
56
|
+
redirectOn: 'no prefix',
|
|
57
|
+
useCookie: false
|
|
58
|
+
},
|
|
59
|
+
langDir: 'i18n/',
|
|
60
|
+
lazy: true,
|
|
61
|
+
locales: (_localeFiles = localeFiles, map(filename => {
|
|
62
|
+
const code = P.basename(filename, '.json');
|
|
63
|
+
return {
|
|
64
|
+
code,
|
|
65
|
+
file: filename,
|
|
66
|
+
iso: code
|
|
67
|
+
};
|
|
68
|
+
})(_localeFiles)),
|
|
69
|
+
seo: localeFiles.length > 1,
|
|
70
|
+
strategy: localeFiles.length === 1 ? 'no_prefix' : 'prefix',
|
|
71
|
+
...(localeFiles.length === 1 && {
|
|
72
|
+
defaultLocale: P.basename(localeFiles[0], '.json')
|
|
73
|
+
}),
|
|
74
|
+
...(process.env.BASE_URL && {
|
|
75
|
+
baseUrl: process.env.BASE_URL
|
|
76
|
+
})
|
|
77
|
+
}]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import endent from "@dword-design/functions/dist/endent.js";
|
|
2
|
+
import P from 'path';
|
|
3
|
+
export default class extends Error {
|
|
4
|
+
constructor(layoutFile) {
|
|
5
|
+
super(endent`
|
|
6
|
+
You have to implement $nuxtI18nHead in ${P.join('layouts', layoutFile)} like this to make sure that i18n metadata are generated:
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
head () {
|
|
11
|
+
return this.$nuxtI18nHead({ addSeoAttributes: true })
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import nuxtPushPlugins from 'nuxt-push-plugins';
|
|
3
|
+
import P from 'path';
|
|
4
|
+
const _require = createRequire(import.meta.url);
|
|
5
|
+
export default function () {
|
|
6
|
+
this.addTemplate({
|
|
7
|
+
fileName: P.join('nuxt-locale-link', 'nuxt-locale-link.vue'),
|
|
8
|
+
src: _require.resolve('./nuxt-locale-link.vue')
|
|
9
|
+
});
|
|
10
|
+
nuxtPushPlugins(this, {
|
|
11
|
+
fileName: P.join('nuxt-locale-link', 'plugin.js'),
|
|
12
|
+
src: _require.resolve('./plugin')
|
|
13
|
+
});
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import mountFiles from 'express-mount-files';
|
|
3
|
+
import P from 'path';
|
|
4
|
+
export default async function (options) {
|
|
5
|
+
const app = options.expressInstance || express();
|
|
6
|
+
app.use(await mountFiles(P.join(this.options.srcDir, 'api'), {
|
|
7
|
+
paramChar: '_'
|
|
8
|
+
}));
|
|
9
|
+
this.addServerMiddleware({
|
|
10
|
+
handler: app,
|
|
11
|
+
path: '/api'
|
|
12
|
+
});
|
|
13
|
+
this.options.watch.push(P.join(this.options.srcDir, 'api'));
|
|
14
|
+
}
|
package/dist/prepublish-only.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _lint = _interopRequireDefault(require("./lint"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
var _default = async (options = {}) => {
|
|
17
|
-
await (0, _lint.default)();
|
|
18
|
-
await (0, _execa.default)('nuxt-babel', ['build', ...(options.rootDir ? [options.rootDir] : []), '--config-file', require.resolve("./nuxt.config")], {
|
|
19
|
-
stdio: options.log === false ? 'ignore' : 'inherit'
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { Builder, Nuxt } from 'nuxt';
|
|
4
|
+
import getNuxtConfig from "./get-nuxt-config.js";
|
|
5
|
+
import lint from "./lint.js";
|
|
6
|
+
export default (async (options = {}) => {
|
|
7
|
+
await lint();
|
|
8
|
+
const nuxt = new Nuxt({
|
|
9
|
+
...getNuxtConfig(),
|
|
10
|
+
dev: false,
|
|
11
|
+
rootDir: options.rootDir
|
|
20
12
|
});
|
|
21
|
-
|
|
22
|
-
if (await
|
|
23
|
-
await
|
|
24
|
-
await (
|
|
13
|
+
await new Builder(nuxt).build();
|
|
14
|
+
if (await fs.exists('model')) {
|
|
15
|
+
await fs.remove('dist');
|
|
16
|
+
await execa('babel', ['--out-dir', 'dist', '--copy-files', '--no-copy-ignored', '--ignore', '**/*.spec.js', 'model'], {
|
|
25
17
|
stdio: options.log === false ? 'ignore' : 'inherit'
|
|
26
18
|
});
|
|
27
19
|
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.default = _default;
|
|
31
|
-
module.exports = exports.default;
|
|
20
|
+
});
|
package/dist/start.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
module.exports = exports.default;
|
|
1
|
+
import { Nuxt } from 'nuxt';
|
|
2
|
+
import getNuxtConfig from "./get-nuxt-config.js";
|
|
3
|
+
export default (async (options = {
|
|
4
|
+
log: false
|
|
5
|
+
}) => {
|
|
6
|
+
const nuxt = new Nuxt({
|
|
7
|
+
...getNuxtConfig(),
|
|
8
|
+
build: {
|
|
9
|
+
quiet: !options.log
|
|
10
|
+
},
|
|
11
|
+
dev: false,
|
|
12
|
+
rootDir: options.rootDir
|
|
13
|
+
});
|
|
14
|
+
await nuxt.listen();
|
|
15
|
+
return nuxt;
|
|
16
|
+
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-nuxt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"repository": "dword-design/base-config-nuxt",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Sebastian Landwehr <info@sebastianlandwehr.com>",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": "./dist/index.js",
|
|
8
10
|
"main": "dist/index.js",
|
|
9
11
|
"files": [
|
|
10
12
|
"dist"
|
|
@@ -22,9 +24,9 @@
|
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"@babel/core": "^7.16.0",
|
|
24
26
|
"@babel/traverse": "^7.16.3",
|
|
25
|
-
"@dword-design/depcheck-parser-sass": "^
|
|
27
|
+
"@dword-design/depcheck-parser-sass": "^3.0.0",
|
|
26
28
|
"@dword-design/dotenv-json-extended": "^2.0.0",
|
|
27
|
-
"@dword-design/eslint-config": "^
|
|
29
|
+
"@dword-design/eslint-config": "^3.0.1",
|
|
28
30
|
"@dword-design/functions": "^4.0.0",
|
|
29
31
|
"@dword-design/stylelint-config": "^2.0.0",
|
|
30
32
|
"@nuxtjs/axios": "^5.10.3",
|
|
@@ -33,10 +35,9 @@
|
|
|
33
35
|
"@nuxtjs/stylelint-module": "^4.0.0",
|
|
34
36
|
"depcheck-package-name": "^2.0.0",
|
|
35
37
|
"depcheck-parser-vue": "^2.0.0",
|
|
36
|
-
"esm": "^3.2.25",
|
|
37
38
|
"execa": "^5.0.0",
|
|
38
39
|
"express": "^4.17.1",
|
|
39
|
-
"express-mount-files": "dword-design/express-mount-files
|
|
40
|
+
"express-mount-files": "npm:@dword-design/express-mount-files",
|
|
40
41
|
"fs-extra": "^10.0.0",
|
|
41
42
|
"globby": "^11.0.1",
|
|
42
43
|
"nuxt": "~2.15.0",
|
|
@@ -46,7 +47,6 @@
|
|
|
46
47
|
"nuxt-svg-loader": "^1.2.0",
|
|
47
48
|
"promise-sequential": "^1.1.1",
|
|
48
49
|
"raw-loader": "^4.0.1",
|
|
49
|
-
"safe-require": "dword-design/node-safe-require#fork",
|
|
50
50
|
"sass": "^1.34.0",
|
|
51
51
|
"sass-loader": "^10.0.0",
|
|
52
52
|
"stylelint": "^13.6.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vue-template-compiler": "^2.6.14"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@dword-design/base": "^
|
|
57
|
+
"@dword-design/base": "^9.0.0",
|
|
58
58
|
"@dword-design/puppeteer": "^5.0.5",
|
|
59
59
|
"@dword-design/tester": "^2.0.9",
|
|
60
60
|
"@dword-design/tester-plugin-env": "^2.0.8",
|
|
@@ -65,8 +65,6 @@
|
|
|
65
65
|
"depcheck": "^1.4.2",
|
|
66
66
|
"output-files": "^2.0.0",
|
|
67
67
|
"port-ready": "^0.1.0",
|
|
68
|
-
"stealthy-require-no-leak": "^1.0.3",
|
|
69
|
-
"tree-kill-promise": "^2.0.0",
|
|
70
68
|
"xml-formatter": "^2.1.2"
|
|
71
69
|
},
|
|
72
70
|
"engines": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _nuxtPushPlugins = _interopRequireDefault(require("nuxt-push-plugins"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _default() {
|
|
13
|
-
(0, _nuxtPushPlugins.default)(this, require.resolve("./plugin"));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = exports.default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _default = context => {
|
|
9
|
-
if (process.client) {
|
|
10
|
-
context.$axios.defaults.baseURL = window.location.origin;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.default = _default;
|
|
15
|
-
module.exports = exports.default;
|
package/dist/modules/babel.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _express = _interopRequireDefault(require("express"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _default() {
|
|
13
|
-
this.options.serverMiddleware.push(_express.default.json());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = exports.default;
|
package/dist/modules/dotenv.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _dotenvJsonExtended = _interopRequireDefault(require("@dword-design/dotenv-json-extended"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _default() {
|
|
15
|
-
_dotenvJsonExtended.default.config();
|
|
16
|
-
|
|
17
|
-
this.options.watch.push(_path.default.join(this.options.rootDir, '.env.json'), _path.default.join(this.options.rootDir, '.env.schema.json'));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = exports.default;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
9
|
-
|
|
10
|
-
var _traverse = _interopRequireDefault(require("@babel/traverse"));
|
|
11
|
-
|
|
12
|
-
var _map = _interopRequireDefault(require("@dword-design/functions/dist/map"));
|
|
13
|
-
|
|
14
|
-
var _some = _interopRequireDefault(require("@dword-design/functions/dist/some"));
|
|
15
|
-
|
|
16
|
-
var _uniq = _interopRequireDefault(require("@dword-design/functions/dist/uniq"));
|
|
17
|
-
|
|
18
|
-
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
19
|
-
|
|
20
|
-
var _fsExtra = require("fs-extra");
|
|
21
|
-
|
|
22
|
-
var _globby = _interopRequireDefault(require("globby"));
|
|
23
|
-
|
|
24
|
-
var _path = _interopRequireDefault(require("path"));
|
|
25
|
-
|
|
26
|
-
var _missingNuxtI18nHeadError = _interopRequireDefault(require("./missing-nuxt-i18n-head-error"));
|
|
27
|
-
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
|
-
const checkNuxtI18nHead = async () => {
|
|
35
|
-
var _ref, _ref2, _layoutFiles;
|
|
36
|
-
|
|
37
|
-
const layoutFiles = (_ref = (_ref2 = ['default.vue', ...(await (0, _globby.default)('*', {
|
|
38
|
-
cwd: 'layouts',
|
|
39
|
-
ignore: '-*'
|
|
40
|
-
}))], await _ref2), (0, _uniq.default)(_ref));
|
|
41
|
-
|
|
42
|
-
const checkLayoutFile = async layoutFile => {
|
|
43
|
-
var _layout$script;
|
|
44
|
-
|
|
45
|
-
const vueTemplateCompiler = require('vue-template-compiler');
|
|
46
|
-
|
|
47
|
-
const layout = (await (0, _fsExtra.exists)(_path.default.join('layouts', layoutFile))) ? vueTemplateCompiler.parseComponent(await (0, _fsExtra.readFile)(_path.default.join('layouts', layoutFile), 'utf8')) : {};
|
|
48
|
-
|
|
49
|
-
if ((_layout$script = layout.script) !== null && _layout$script !== void 0 && _layout$script.content) {
|
|
50
|
-
var _layout$script2;
|
|
51
|
-
|
|
52
|
-
const ast = await babel.parse((_layout$script2 = layout.script) === null || _layout$script2 === void 0 ? void 0 : _layout$script2.content, {
|
|
53
|
-
filename: 'index.js'
|
|
54
|
-
});
|
|
55
|
-
let valid = false;
|
|
56
|
-
(0, _traverse.default)(ast, {
|
|
57
|
-
ExportDefaultDeclaration: path => {
|
|
58
|
-
var _path$node$declaratio;
|
|
59
|
-
|
|
60
|
-
if (_path$node$declaratio = path.node.declaration.properties, (0, _some.default)(property => {
|
|
61
|
-
var _property$key, _property$body$body$, _property$body$body$2, _property$body$body$3;
|
|
62
|
-
|
|
63
|
-
return property.type === 'ObjectMethod' && ((_property$key = property.key) === null || _property$key === void 0 ? void 0 : _property$key.name) === 'head' && property.body.body.length === 1 && property.body.body[0].type === 'ReturnStatement' && property.body.body[0].argument.type === 'CallExpression' && property.body.body[0].argument.callee.type === 'MemberExpression' && property.body.body[0].argument.callee.object.type === 'ThisExpression' && ((_property$body$body$ = property.body.body[0].argument.callee.property) === null || _property$body$body$ === void 0 ? void 0 : _property$body$body$.name) === '$nuxtI18nHead' && property.body.body[0].argument.arguments.length === 1 && property.body.body[0].argument.arguments[0].type === 'ObjectExpression' && property.body.body[0].argument.arguments[0].properties.length === 1 && ((_property$body$body$2 = property.body.body[0].argument.arguments[0].properties[0].key) === null || _property$body$body$2 === void 0 ? void 0 : _property$body$body$2.name) === 'addSeoAttributes' && ((_property$body$body$3 = property.body.body[0].argument.arguments[0].properties[0].value) === null || _property$body$body$3 === void 0 ? void 0 : _property$body$body$3.value) === true;
|
|
64
|
-
})(_path$node$declaratio)) {
|
|
65
|
-
valid = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (valid) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
throw new _missingNuxtI18nHeadError.default(layoutFile);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
return Promise.all((_layoutFiles = layoutFiles, (0, _map.default)(checkLayoutFile)(_layoutFiles)));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
async function _default() {
|
|
82
|
-
const localeFiles = await (0, _globby.default)('*.json', {
|
|
83
|
-
cwd: _path.default.join(this.options.srcDir, 'i18n')
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (localeFiles.length > 0) {
|
|
87
|
-
var _localeFiles;
|
|
88
|
-
|
|
89
|
-
await checkNuxtI18nHead();
|
|
90
|
-
await this.addModule([(0, _depcheckPackageName.default)`@nuxtjs/i18n`, {
|
|
91
|
-
detectBrowserLanguage: localeFiles.length === 1 ? false : {
|
|
92
|
-
fallbackLocale: 'en',
|
|
93
|
-
redirectOn: 'no prefix',
|
|
94
|
-
useCookie: false
|
|
95
|
-
},
|
|
96
|
-
langDir: 'i18n/',
|
|
97
|
-
lazy: true,
|
|
98
|
-
locales: (_localeFiles = localeFiles, (0, _map.default)(filename => {
|
|
99
|
-
const code = _path.default.basename(filename, '.json');
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
code,
|
|
103
|
-
file: filename,
|
|
104
|
-
iso: code
|
|
105
|
-
};
|
|
106
|
-
})(_localeFiles)),
|
|
107
|
-
seo: localeFiles.length > 1,
|
|
108
|
-
strategy: localeFiles.length === 1 ? 'no_prefix' : 'prefix',
|
|
109
|
-
...(localeFiles.length === 1 && {
|
|
110
|
-
defaultLocale: _path.default.basename(localeFiles[0], '.json')
|
|
111
|
-
}),
|
|
112
|
-
...(process.env.BASE_URL && {
|
|
113
|
-
baseUrl: process.env.BASE_URL
|
|
114
|
-
})
|
|
115
|
-
}]);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
module.exports = exports.default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _endent = _interopRequireDefault(require("@dword-design/functions/dist/endent"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
class _default extends Error {
|
|
15
|
-
constructor(layoutFile) {
|
|
16
|
-
super((0, _endent.default)`
|
|
17
|
-
You have to implement $nuxtI18nHead in ${_path.default.join('layouts', layoutFile)} like this to make sure that i18n metadata are generated:
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
export default {
|
|
21
|
-
head () {
|
|
22
|
-
return this.$nuxtI18nHead({ addSeoAttributes: true })
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.default = _default;
|
|
32
|
-
module.exports = exports.default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _nuxtPushPlugins = _interopRequireDefault(require("nuxt-push-plugins"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _default() {
|
|
15
|
-
this.addTemplate({
|
|
16
|
-
fileName: _path.default.join('nuxt-locale-link', 'nuxt-locale-link.vue'),
|
|
17
|
-
src: require.resolve("./nuxt-locale-link.vue")
|
|
18
|
-
});
|
|
19
|
-
(0, _nuxtPushPlugins.default)(this, {
|
|
20
|
-
fileName: _path.default.join('nuxt-locale-link', 'plugin.js'),
|
|
21
|
-
src: require.resolve("./plugin")
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = exports.default;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vue = _interopRequireDefault(require("vue"));
|
|
4
|
-
|
|
5
|
-
var _nuxtLocaleLink = _interopRequireDefault(require("./nuxt-locale-link.vue"));
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
|
|
9
|
-
_vue.default.component('NuxtLocaleLink', _nuxtLocaleLink.default);
|
package/dist/modules/raw.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _default() {
|
|
13
|
-
this.extendBuild(config => {
|
|
14
|
-
config.module.rules.push({
|
|
15
|
-
exclude: /node_modules/,
|
|
16
|
-
loader: (0, _depcheckPackageName.default)`raw-loader`,
|
|
17
|
-
test: /\.(txt|html)$/
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = exports.default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _express = _interopRequireDefault(require("express"));
|
|
9
|
-
|
|
10
|
-
var _expressMountFiles = _interopRequireDefault(require("express-mount-files"));
|
|
11
|
-
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _default() {
|
|
17
|
-
const app = (0, _express.default)();
|
|
18
|
-
app.use((0, _expressMountFiles.default)(_path.default.join(this.options.srcDir, 'api'), {
|
|
19
|
-
paramChar: '_'
|
|
20
|
-
}));
|
|
21
|
-
this.addServerMiddleware({
|
|
22
|
-
handler: app,
|
|
23
|
-
path: '/api'
|
|
24
|
-
});
|
|
25
|
-
this.options.watch.push(_path.default.join(this.options.srcDir, 'api'));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = exports.default;
|
package/dist/nuxt.config.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _dotenvJsonExtended = _interopRequireDefault(require("@dword-design/dotenv-json-extended"));
|
|
9
|
-
|
|
10
|
-
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
11
|
-
|
|
12
|
-
var _esm = _interopRequireDefault(require("esm"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
_dotenvJsonExtended.default.config();
|
|
17
|
-
|
|
18
|
-
var _default = {
|
|
19
|
-
createRequire: () => (0, _esm.default)(module),
|
|
20
|
-
modules: [require.resolve("./modules/babel"), require.resolve("./modules/dotenv"), [(0, _depcheckPackageName.default)`@nuxtjs/eslint-module`, {
|
|
21
|
-
failOnWarning: true,
|
|
22
|
-
fix: true
|
|
23
|
-
}], [(0, _depcheckPackageName.default)`@nuxtjs/stylelint-module`, {
|
|
24
|
-
allowEmptyInput: true,
|
|
25
|
-
failOnWarning: true,
|
|
26
|
-
fix: true
|
|
27
|
-
}], require.resolve("./modules/css-modules"), require.resolve("./modules/raw"), require.resolve("./modules/i18n"), require.resolve("./modules/body-parser"), require.resolve("./modules/server-middleware"), (0, _depcheckPackageName.default)`@nuxtjs/axios`, require.resolve("./modules/axios-dynamic-baseurl"), (0, _depcheckPackageName.default)`nuxt-svg-loader`, require.resolve("./modules/locale-link"), [(0, _depcheckPackageName.default)`nuxt-basic-auth-module`, {
|
|
28
|
-
enabled: process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASSWORD,
|
|
29
|
-
name: process.env.BASIC_AUTH_USER,
|
|
30
|
-
pass: process.env.BASIC_AUTH_PASSWORD
|
|
31
|
-
}], require.resolve("./modules/project")],
|
|
32
|
-
server: {
|
|
33
|
-
port: process.env.PORT || 3000
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
exports.default = _default;
|
|
37
|
-
module.exports = exports.default;
|