@dword-design/base-config-nuxt 3.0.26 → 3.0.30
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.
|
@@ -13,6 +13,8 @@ var _map = _interopRequireDefault(require("@dword-design/functions/dist/map"));
|
|
|
13
13
|
|
|
14
14
|
var _some = _interopRequireDefault(require("@dword-design/functions/dist/some"));
|
|
15
15
|
|
|
16
|
+
var _uniq = _interopRequireDefault(require("@dword-design/functions/dist/uniq"));
|
|
17
|
+
|
|
16
18
|
var _depcheckPackageName = _interopRequireDefault(require("depcheck-package-name"));
|
|
17
19
|
|
|
18
20
|
var _fsExtra = require("fs-extra");
|
|
@@ -30,17 +32,26 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
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; }
|
|
31
33
|
|
|
32
34
|
const checkNuxtI18nHead = async () => {
|
|
33
|
-
|
|
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 => {
|
|
34
43
|
var _layout$script;
|
|
35
44
|
|
|
36
45
|
const vueTemplateCompiler = require('vue-template-compiler');
|
|
37
46
|
|
|
38
|
-
const layout = vueTemplateCompiler.parseComponent(await (0, _fsExtra.readFile)(_path.default.join('layouts',
|
|
47
|
+
const layout = (await (0, _fsExtra.exists)(_path.default.join('layouts', layoutFile))) ? vueTemplateCompiler.parseComponent(await (0, _fsExtra.readFile)(_path.default.join('layouts', layoutFile), 'utf8')) : {};
|
|
39
48
|
|
|
40
49
|
if ((_layout$script = layout.script) !== null && _layout$script !== void 0 && _layout$script.content) {
|
|
41
50
|
var _layout$script2;
|
|
42
51
|
|
|
43
|
-
const ast = await babel.parse((_layout$script2 = layout.script) === null || _layout$script2 === void 0 ? void 0 : _layout$script2.content
|
|
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
|
+
});
|
|
44
55
|
let valid = false;
|
|
45
56
|
(0, _traverse.default)(ast, {
|
|
46
57
|
ExportDefaultDeclaration: path => {
|
|
@@ -60,9 +71,11 @@ const checkNuxtI18nHead = async () => {
|
|
|
60
71
|
return;
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
|
-
}
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
throw new _missingNuxtI18nHeadError.default(layoutFile);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return Promise.all((_layoutFiles = layoutFiles, (0, _map.default)(checkLayoutFile)(_layoutFiles)));
|
|
66
79
|
};
|
|
67
80
|
|
|
68
81
|
async function _default() {
|
|
@@ -5,9 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
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
|
+
|
|
8
14
|
class _default extends Error {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
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
|
+
`);
|
|
11
27
|
}
|
|
12
28
|
|
|
13
29
|
}
|
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.30",
|
|
4
4
|
"repository": "dword-design/base-config-nuxt",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@dword-design/base": "^8.0.0",
|
|
57
|
-
"@dword-design/puppeteer": "^5.0.
|
|
58
|
-
"@dword-design/tester": "^2.0.
|
|
57
|
+
"@dword-design/puppeteer": "^5.0.5",
|
|
58
|
+
"@dword-design/tester": "^2.0.9",
|
|
59
59
|
"@dword-design/tester-plugin-env": "^2.0.8",
|
|
60
60
|
"@dword-design/tester-plugin-puppeteer": "^2.1.19",
|
|
61
|
-
"@dword-design/tester-plugin-tmp-dir": "^2.1.
|
|
61
|
+
"@dword-design/tester-plugin-tmp-dir": "^2.1.3",
|
|
62
62
|
"@nuxtjs/sitemap": "^2.4.0",
|
|
63
63
|
"axios": "^0.22.0",
|
|
64
64
|
"depcheck": "^1.4.2",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"postcss-hexrgba": "^2.0.0",
|
|
68
68
|
"stealthy-require-no-leak": "^1.0.3",
|
|
69
69
|
"tree-kill-promise": "^2.0.0",
|
|
70
|
-
"with-local-tmp-dir": "^4.0.0",
|
|
71
70
|
"xml-formatter": "^2.1.2"
|
|
72
71
|
},
|
|
73
72
|
"engines": {
|