@dword-design/base-config-nuxt 3.0.22 → 3.0.26
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.
|
@@ -5,18 +5,66 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
7
|
|
|
8
|
+
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
9
|
+
|
|
10
|
+
var _traverse = _interopRequireDefault(require("@babel/traverse"));
|
|
11
|
+
|
|
8
12
|
var _map = _interopRequireDefault(require("@dword-design/functions/dist/map"));
|
|
9
13
|
|
|
14
|
+
var _some = _interopRequireDefault(require("@dword-design/functions/dist/some"));
|
|
15
|
+
|
|
10
16
|
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
11
17
|
|
|
12
|
-
var
|
|
18
|
+
var _fsExtra = require("fs-extra");
|
|
13
19
|
|
|
14
|
-
var
|
|
20
|
+
var _globby = _interopRequireDefault(require("globby"));
|
|
15
21
|
|
|
16
22
|
var _path = _interopRequireDefault(require("path"));
|
|
17
23
|
|
|
24
|
+
var _missingNuxtI18nHeadError = _interopRequireDefault(require("./missing-nuxt-i18n-head-error"));
|
|
25
|
+
|
|
18
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
27
|
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
const checkNuxtI18nHead = async () => {
|
|
33
|
+
if (await (0, _fsExtra.exists)(_path.default.join('layouts', 'default.vue'))) {
|
|
34
|
+
var _layout$script;
|
|
35
|
+
|
|
36
|
+
const vueTemplateCompiler = require('vue-template-compiler');
|
|
37
|
+
|
|
38
|
+
const layout = vueTemplateCompiler.parseComponent(await (0, _fsExtra.readFile)(_path.default.join('layouts', 'default.vue'), 'utf8'));
|
|
39
|
+
|
|
40
|
+
if ((_layout$script = layout.script) !== null && _layout$script !== void 0 && _layout$script.content) {
|
|
41
|
+
var _layout$script2;
|
|
42
|
+
|
|
43
|
+
const ast = await babel.parse((_layout$script2 = layout.script) === null || _layout$script2 === void 0 ? void 0 : _layout$script2.content);
|
|
44
|
+
let valid = false;
|
|
45
|
+
(0, _traverse.default)(ast, {
|
|
46
|
+
ExportDefaultDeclaration: path => {
|
|
47
|
+
var _path$node$declaratio;
|
|
48
|
+
|
|
49
|
+
if (_path$node$declaratio = path.node.declaration.properties, (0, _some.default)(property => {
|
|
50
|
+
var _property$key, _property$body$body$, _property$body$body$2, _property$body$body$3;
|
|
51
|
+
|
|
52
|
+
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;
|
|
53
|
+
})(_path$node$declaratio)) {
|
|
54
|
+
valid = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (valid) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
throw new _missingNuxtI18nHeadError.default();
|
|
66
|
+
};
|
|
67
|
+
|
|
20
68
|
async function _default() {
|
|
21
69
|
const localeFiles = await (0, _globby.default)('*.json', {
|
|
22
70
|
cwd: _path.default.join(this.options.srcDir, 'i18n')
|
|
@@ -25,6 +73,7 @@ async function _default() {
|
|
|
25
73
|
if (localeFiles.length > 0) {
|
|
26
74
|
var _localeFiles;
|
|
27
75
|
|
|
76
|
+
await checkNuxtI18nHead();
|
|
28
77
|
await this.addModule([(0, _depcheckPackageName.default)`@nuxtjs/i18n`, {
|
|
29
78
|
detectBrowserLanguage: {
|
|
30
79
|
fallbackLocale: 'en',
|
|
@@ -42,6 +91,7 @@ async function _default() {
|
|
|
42
91
|
iso: code
|
|
43
92
|
};
|
|
44
93
|
})(_localeFiles)),
|
|
94
|
+
seo: true,
|
|
45
95
|
strategy: 'prefix',
|
|
46
96
|
vueI18n: {
|
|
47
97
|
fallbackLocale: 'en'
|
|
@@ -50,7 +100,6 @@ async function _default() {
|
|
|
50
100
|
baseUrl: process.env.BASE_URL
|
|
51
101
|
})
|
|
52
102
|
}]);
|
|
53
|
-
(0, _nuxtPushPlugins.default)(this, require.resolve("./plugin"));
|
|
54
103
|
}
|
|
55
104
|
}
|
|
56
105
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
class _default extends Error {
|
|
9
|
+
constructor() {
|
|
10
|
+
super('You have to implement $nuxtI18nHead in layouts/default.vue to make sure that i18n metadata are generated.');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.default = _default;
|
|
16
|
+
module.exports = exports.default;
|
|
@@ -96,6 +96,11 @@ async function _default() {
|
|
|
96
96
|
...this.options
|
|
97
97
|
}, (0, _keys.default)(_defaultConfig$this$o)))(_projectConfig)));
|
|
98
98
|
await (0, _promiseSequential.default)((_projectConfig$module = projectConfig.modules, (0, _map.default)(module => () => this.addModule(module))(_projectConfig$module)));
|
|
99
|
+
this.addTemplate({
|
|
100
|
+
fileName: _path.default.join('project', 'project-config.js'),
|
|
101
|
+
options: projectConfig,
|
|
102
|
+
src: require.resolve("./project-config.js.template")
|
|
103
|
+
});
|
|
99
104
|
(0, _nuxtPushPlugins.default)(this, ...projectConfig.plugins);
|
|
100
105
|
}
|
|
101
106
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default <%= JSON.stringify(options) %>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-nuxt",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.26",
|
|
4
4
|
"repository": "dword-design/base-config-nuxt",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
"test": "base test"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@babel/core": "^7.16.0",
|
|
23
|
+
"@babel/traverse": "^7.16.3",
|
|
22
24
|
"@dword-design/depcheck-parser-sass": "^2.0.0",
|
|
23
25
|
"@dword-design/dotenv-json-extended": "^2.0.0",
|
|
24
26
|
"@dword-design/eslint-config": "^2.0.0",
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
"@dword-design/stylelint-config": "^2.0.0",
|
|
27
29
|
"@nuxtjs/axios": "^5.10.3",
|
|
28
30
|
"@nuxtjs/eslint-module": "^3.0.0",
|
|
29
|
-
"@nuxtjs/i18n": "^7.0.
|
|
31
|
+
"@nuxtjs/i18n": "^7.0.2",
|
|
30
32
|
"@nuxtjs/stylelint-module": "^4.0.0",
|
|
31
33
|
"body-parser": "^1.19.0",
|
|
32
34
|
"depcheck-package-name": "^2.0.0",
|
|
@@ -47,7 +49,8 @@
|
|
|
47
49
|
"sass": "^1.34.0",
|
|
48
50
|
"sass-loader": "^10.0.0",
|
|
49
51
|
"stylelint": "^13.6.0",
|
|
50
|
-
"vue": "^2.6.11"
|
|
52
|
+
"vue": "^2.6.11",
|
|
53
|
+
"vue-template-compiler": "^2.6.14"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@dword-design/base": "^8.0.0",
|
|
@@ -57,7 +60,7 @@
|
|
|
57
60
|
"@dword-design/tester-plugin-puppeteer": "^2.1.19",
|
|
58
61
|
"@dword-design/tester-plugin-tmp-dir": "^2.1.2",
|
|
59
62
|
"@nuxtjs/sitemap": "^2.4.0",
|
|
60
|
-
"axios": "^0.
|
|
63
|
+
"axios": "^0.22.0",
|
|
61
64
|
"depcheck": "^1.4.2",
|
|
62
65
|
"output-files": "^2.0.0",
|
|
63
66
|
"port-ready": "^0.1.0",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vue = _interopRequireDefault(require("vue"));
|
|
4
|
-
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
|
-
_vue.default.use({
|
|
8
|
-
install: vue => vue.mixin({
|
|
9
|
-
head() {
|
|
10
|
-
return this.$nuxtI18nHead({
|
|
11
|
-
addSeoAttributes: true
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
});
|