nuxt-seo-utils 8.3.2 → 8.3.3
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/cli.mjs +1 -1
- package/dist/devtools/lib/seo-utils/state.ts +4 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +29 -25
- package/dist/runtime/app/plugins/minifyScripts.server.js +1 -3
- package/dist/runtime/server/plugins/minifyHtml.js +1 -3
- package/dist/runtime/server/routes/__nuxt-seo-utils/debug.d.ts +1 -1
- package/dist/runtime/shared/minify.d.ts +2 -0
- package/dist/runtime/shared/minify.js +2 -0
- package/package.json +30 -29
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { colors } from 'consola/utils';
|
|
|
8
8
|
import { resolve } from 'pathe';
|
|
9
9
|
|
|
10
10
|
const name = "nuxt-seo-utils";
|
|
11
|
-
const version = "8.3.
|
|
11
|
+
const version = "8.3.3";
|
|
12
12
|
const description = "SEO utilities to improve your Nuxt sites discoverability and shareability";
|
|
13
13
|
|
|
14
14
|
const ICON_SIZES = [
|
|
@@ -27,7 +27,10 @@ export async function refreshSources() {
|
|
|
27
27
|
return
|
|
28
28
|
data.value = await appFetch.value('/__nuxt-seo-utils/debug.json', {
|
|
29
29
|
query: { path: path.value },
|
|
30
|
-
}).catch(() =>
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
// A failed devtools refresh means no debug data is available until the next poll.
|
|
32
|
+
return null
|
|
33
|
+
})
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
watch([path, appFetch, refreshTime], () => {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs, { existsSync } from 'node:fs';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import { useNuxt, addTypeTemplate, useLogger, defineNuxtModule, createResolver, addServerHandler, hasNuxtModule, addPlugin, addImports, hasNuxtCompatibility, directoryToURL, addVitePlugin } from '@nuxt/kit';
|
|
3
|
+
import { useNuxt, addTypeTemplate, extendRouteRules, useLogger, defineNuxtModule, createResolver, addServerHandler, hasNuxtModule, addPlugin, addImports, hasNuxtCompatibility, directoryToURL, addVitePlugin } from '@nuxt/kit';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { resolveModulePath } from 'exsolve';
|
|
6
6
|
import { installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
7
|
-
import { resolveHostUnheadMajor } from 'nuxtseo-shared/kit';
|
|
7
|
+
import { useModuleLogger, resolveHostUnheadMajor } from 'nuxtseo-shared/kit';
|
|
8
8
|
import { resolve, extname, relative, dirname, basename } from 'pathe';
|
|
9
9
|
import { readPackageJSON } from 'pkg-types';
|
|
10
10
|
import { unpackMeta } from '@unhead/vue/utils';
|
|
@@ -13,6 +13,7 @@ import { encodePath, joinURL } from 'ufo';
|
|
|
13
13
|
import escapeRE from 'escape-string-regexp';
|
|
14
14
|
import { readFile, readdir } from 'node:fs/promises';
|
|
15
15
|
import imageSize from 'image-size';
|
|
16
|
+
import { JSON_TYPES, SKIP_JS_TYPES } from '../dist/runtime/shared/minify.js';
|
|
16
17
|
import { setupDevToolsUI as setupDevToolsUI$1 } from 'nuxtseo-shared/devtools';
|
|
17
18
|
|
|
18
19
|
function extendNuxtConfigAppHeadSeoMeta(nuxt = useNuxt()) {
|
|
@@ -178,7 +179,7 @@ function parseSegment(segment) {
|
|
|
178
179
|
state = 0 /* initial */;
|
|
179
180
|
} else if (PARAM_CHAR_RE.test(c)) {
|
|
180
181
|
buffer += c;
|
|
181
|
-
}
|
|
182
|
+
}
|
|
182
183
|
break;
|
|
183
184
|
}
|
|
184
185
|
i++;
|
|
@@ -273,8 +274,8 @@ async function generateTagsFromPageDirImages(nuxt = useNuxt()) {
|
|
|
273
274
|
});
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
for (const [route, rule] of Object.entries(appendRouteRules))
|
|
278
|
+
extendRouteRules(route, rule, { override: true });
|
|
278
279
|
if (nuxt.options.dev) {
|
|
279
280
|
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
280
281
|
nitroConfig.virtual["#seo-utils-virtual/pageDirImages"] = `export const fileMapping = ${JSON.stringify(devMiddlewareMap)}`;
|
|
@@ -395,8 +396,6 @@ async function generateTagsFromPublicFiles(nuxt = useNuxt()) {
|
|
|
395
396
|
return { hasIcons };
|
|
396
397
|
}
|
|
397
398
|
|
|
398
|
-
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
399
|
-
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
400
399
|
const logger = useLogger("nuxt-seo-utils");
|
|
401
400
|
async function minifyJSBuildTime(code) {
|
|
402
401
|
try {
|
|
@@ -495,7 +494,6 @@ function setupNuxtConfigAppHeadWithMoreDefaults(nuxt = useNuxt()) {
|
|
|
495
494
|
const headConfig = nuxt.options.app.head;
|
|
496
495
|
headConfig.link = headConfig.link || [];
|
|
497
496
|
headConfig.htmlAttrs = headConfig.htmlAttrs || {};
|
|
498
|
-
headConfig.link = headConfig.link || [];
|
|
499
497
|
headConfig.meta = headConfig.meta || [];
|
|
500
498
|
if (!hasMetaProperty(headConfig, "og:type")) {
|
|
501
499
|
headConfig.meta.push({
|
|
@@ -556,8 +554,7 @@ const module$1 = defineNuxtModule({
|
|
|
556
554
|
minify: true
|
|
557
555
|
},
|
|
558
556
|
async setup(config, nuxt) {
|
|
559
|
-
const logger =
|
|
560
|
-
logger.level = config.debug || nuxt.options.debug ? 4 : 3;
|
|
557
|
+
const logger = useModuleLogger("nuxt-seo-utils", config, nuxt);
|
|
561
558
|
if (config.enabled === false) {
|
|
562
559
|
logger.debug("The module is disabled, skipping setup.");
|
|
563
560
|
return;
|
|
@@ -725,6 +722,9 @@ export {}
|
|
|
725
722
|
const lightningcssPath = resolveModulePath("lightningcss", { try: true, from: importPaths });
|
|
726
723
|
const rolldownURL = rolldownPath ? pathToFileURL(rolldownPath).href : void 0;
|
|
727
724
|
const lightningcssURL = lightningcssPath ? pathToFileURL(lightningcssPath).href : void 0;
|
|
725
|
+
const bundlerPath = unheadMajor < 3 ? resolveModulePath("@unhead/bundler/vite", { try: true, from: importPaths }) : void 0;
|
|
726
|
+
const bundlerURL = bundlerPath ? pathToFileURL(bundlerPath).href : void 0;
|
|
727
|
+
const vitePluginSource = unheadMajor >= 3 ? { _tag: "vue" } : bundlerURL ? { _tag: "bundler", url: bundlerURL } : { _tag: "missing-bundler" };
|
|
728
728
|
const minify = {
|
|
729
729
|
js: rolldownURL ? async (code) => {
|
|
730
730
|
const { minify: minify2 } = await import(rolldownURL);
|
|
@@ -739,22 +739,26 @@ export {}
|
|
|
739
739
|
}).code).trim();
|
|
740
740
|
} : void 0
|
|
741
741
|
};
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
742
|
+
if (vitePluginSource._tag === "missing-bundler") {
|
|
743
|
+
logger.warn("`treeShakeUseSeoMeta` requires the optional `@unhead/bundler` peer on Unhead v2. Install it or disable `treeShakeUseSeoMeta`.");
|
|
744
|
+
} else {
|
|
745
|
+
addVitePlugin(async () => {
|
|
746
|
+
if (vitePluginSource._tag === "vue") {
|
|
747
|
+
const v3Vite = "@unhead/vue/vite";
|
|
748
|
+
const { Unhead: Unhead2 } = await import(v3Vite);
|
|
749
|
+
return Unhead2({ minify, ...viteOpts });
|
|
750
|
+
}
|
|
751
|
+
const { Unhead } = await import(vitePluginSource.url);
|
|
752
|
+
return Unhead({
|
|
753
|
+
_framework: "@unhead/vue",
|
|
754
|
+
minify,
|
|
755
|
+
validate: false,
|
|
756
|
+
devtools: false
|
|
757
|
+
});
|
|
758
|
+
}, {
|
|
759
|
+
prepend: true
|
|
754
760
|
});
|
|
755
|
-
}
|
|
756
|
-
prepend: true
|
|
757
|
-
});
|
|
761
|
+
}
|
|
758
762
|
}
|
|
759
763
|
if (config.automaticOgAndTwitterTags)
|
|
760
764
|
addPlugin({ src: resolve(appRuntimeDir, "plugins", "inferSeoMetaPlugin") });
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { injectHead } from "@unhead/vue";
|
|
2
2
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
-
import { minifyCSS, minifyJS, minifyJSON } from "../../shared/minify.js";
|
|
4
|
-
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
5
|
-
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
3
|
+
import { JSON_TYPES, minifyCSS, minifyJS, minifyJSON, SKIP_JS_TYPES } from "../../shared/minify.js";
|
|
6
4
|
export default defineNuxtPlugin({
|
|
7
5
|
enforce: "post",
|
|
8
6
|
setup() {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { defineNitroPlugin } from "nitropack/runtime";
|
|
2
|
-
import { minifyCSS, minifyJS, minifyJSON } from "../../shared/minify.js";
|
|
2
|
+
import { JSON_TYPES, minifyCSS, minifyJS, minifyJSON, SKIP_JS_TYPES } from "../../shared/minify.js";
|
|
3
3
|
const INLINE_SCRIPT_RE = /<script(?![^>]+\bsrc\b)([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
|
4
4
|
const INLINE_STYLE_RE = /<style([^>]*)>([\s\S]*?)<\/style\s*>/gi;
|
|
5
5
|
const TYPE_ATTR_RE = /\btype\s*=\s*["']([^"']*)["']/i;
|
|
6
|
-
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
7
|
-
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
8
6
|
function minifyChunk(chunk) {
|
|
9
7
|
let out = chunk.replace(INLINE_SCRIPT_RE, (full, attrs, content) => {
|
|
10
8
|
if (!content)
|
|
@@ -13,6 +13,6 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
|
|
|
13
13
|
twitter: any;
|
|
14
14
|
};
|
|
15
15
|
headConfig: any;
|
|
16
|
-
path: string | number | true | import("ufo").QueryValue[]
|
|
16
|
+
path: string | number | true | Record<string, any> | import("ufo").QueryValue[];
|
|
17
17
|
}>;
|
|
18
18
|
export default _default;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
2
|
+
export const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
1
3
|
export function minifyJS(code) {
|
|
2
4
|
let result = "";
|
|
3
5
|
let i = 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-seo-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.3.
|
|
4
|
+
"version": "8.3.3",
|
|
5
5
|
"description": "SEO utilities to improve your Nuxt sites discoverability and shareability",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@unhead/vue",
|
|
34
34
|
"@unhead/vue/plugins",
|
|
35
35
|
"@unhead/vue/utils",
|
|
36
|
-
"@unhead/vue/vite"
|
|
37
|
-
"@unhead/bundler/vite"
|
|
36
|
+
"@unhead/vue/vite"
|
|
38
37
|
]
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
40
|
+
"@unhead/bundler": "^3.2.1",
|
|
41
41
|
"@unhead/vue": "^2.0.7 || ^3.0.0",
|
|
42
42
|
"esbuild": ">=0.17.0",
|
|
43
43
|
"lightningcss": ">=1.20.0",
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
"unhead": "^2.0.7 || ^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
49
|
+
"@unhead/bundler": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
49
52
|
"@unhead/vue": {
|
|
50
53
|
"optional": true
|
|
51
54
|
},
|
|
@@ -63,16 +66,15 @@
|
|
|
63
66
|
}
|
|
64
67
|
},
|
|
65
68
|
"dependencies": {
|
|
66
|
-
"@nuxt/kit": "^4.5.
|
|
67
|
-
"@unhead/bundler": "3.2.1",
|
|
69
|
+
"@nuxt/kit": "^4.5.1",
|
|
68
70
|
"citty": "^0.2.2",
|
|
69
71
|
"consola": "^3.4.2",
|
|
70
72
|
"defu": "^6.1.7",
|
|
71
73
|
"escape-string-regexp": "^5.0.0",
|
|
72
|
-
"exsolve": "^1.1.
|
|
74
|
+
"exsolve": "^1.1.1",
|
|
73
75
|
"image-size": "^2.0.2",
|
|
74
|
-
"nuxt-site-config": "^4.1.
|
|
75
|
-
"nuxtseo-shared": "^5.3.
|
|
76
|
+
"nuxt-site-config": "^4.1.2",
|
|
77
|
+
"nuxtseo-shared": "^5.3.6",
|
|
76
78
|
"pathe": "^2.0.3",
|
|
77
79
|
"pkg-types": "^2.3.1",
|
|
78
80
|
"scule": "^1.3.0",
|
|
@@ -83,38 +85,37 @@
|
|
|
83
85
|
"sharp": "^0.35.3"
|
|
84
86
|
},
|
|
85
87
|
"devDependencies": {
|
|
86
|
-
"@antfu/eslint-config": "^9.
|
|
87
|
-
"@nuxt/devtools-kit": "4.0.0-alpha.
|
|
88
|
-
"@nuxt/module-builder": "^1.0.
|
|
89
|
-
"@nuxt/schema": "^4.5.
|
|
90
|
-
"@nuxt/test-utils": "^4.0
|
|
88
|
+
"@antfu/eslint-config": "^9.2.0",
|
|
89
|
+
"@nuxt/devtools-kit": "4.0.0-alpha.9",
|
|
90
|
+
"@nuxt/module-builder": "^1.0.3",
|
|
91
|
+
"@nuxt/schema": "^4.5.1",
|
|
92
|
+
"@nuxt/test-utils": "^4.1.0",
|
|
91
93
|
"@nuxt/ui": "^4.10.0",
|
|
92
|
-
"@nuxtjs/i18n": "^10.
|
|
93
|
-
"@types/node": "^26.1.
|
|
94
|
-
"@unhead/
|
|
94
|
+
"@nuxtjs/i18n": "^10.5.0",
|
|
95
|
+
"@types/node": "^26.1.2",
|
|
96
|
+
"@unhead/bundler": "^3.2.3",
|
|
97
|
+
"@unhead/vue": "3.2.3",
|
|
95
98
|
"@vue/test-utils": "^2.4.11",
|
|
96
|
-
"bumpp": "^
|
|
99
|
+
"bumpp": "^12.0.0",
|
|
97
100
|
"case-police": "^2.2.1",
|
|
98
101
|
"cheerio": "^1.2.0",
|
|
99
|
-
"eslint": "^10.
|
|
100
|
-
"eslint-plugin-harlanzw": "^0.17.
|
|
101
|
-
"happy-dom": "^20.
|
|
102
|
-
"lint-staged": "^17.0
|
|
102
|
+
"eslint": "^10.8.0",
|
|
103
|
+
"eslint-plugin-harlanzw": "^0.17.1",
|
|
104
|
+
"happy-dom": "^20.11.1",
|
|
105
|
+
"lint-staged": "^17.2.0",
|
|
103
106
|
"markdownlint-cli": "^0.49.1",
|
|
104
|
-
"nuxt": "^4.5.
|
|
107
|
+
"nuxt": "^4.5.1",
|
|
105
108
|
"nuxt-security": "^2.6.0",
|
|
106
|
-
"nuxtseo-layer-devtools": "^5.3.
|
|
107
|
-
"playwright-core": "^1.
|
|
108
|
-
"sass": "^1.
|
|
109
|
-
"semver": "^7.8.5",
|
|
110
|
-
"sirv": "^3.0.2",
|
|
109
|
+
"nuxtseo-layer-devtools": "^5.3.6",
|
|
110
|
+
"playwright-core": "^1.62.0",
|
|
111
|
+
"sass": "^1.102.0",
|
|
111
112
|
"typescript": "6.0.3",
|
|
112
113
|
"ultrahtml": "^1.7.0",
|
|
113
114
|
"unbuild": "^3.6.1",
|
|
114
|
-
"unhead": "3.2.
|
|
115
|
+
"unhead": "3.2.3",
|
|
115
116
|
"vitest": "^4.1.10",
|
|
116
117
|
"vue": "^3.5.40",
|
|
117
|
-
"vue-tsc": "^3.3.
|
|
118
|
+
"vue-tsc": "^3.3.8"
|
|
118
119
|
},
|
|
119
120
|
"scripts": {
|
|
120
121
|
"client:build": "node -e \"require('fs').cpSync('devtools','dist/devtools',{recursive:true})\"",
|