nuxt-ai-ready 0.3.6 → 0.3.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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +55 -0
- package/package.json +9 -7
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,6 +4,9 @@ import defu from 'defu';
|
|
|
4
4
|
import { useSiteConfig, installNuxtSiteConfig, withSiteUrl } from 'nuxt-site-config/kit';
|
|
5
5
|
import { relative } from 'pathe';
|
|
6
6
|
import { readPackageJSON } from 'pkg-types';
|
|
7
|
+
import * as p from '@clack/prompts';
|
|
8
|
+
import { $fetch } from 'ofetch';
|
|
9
|
+
import { isTest, isCI } from 'std-env';
|
|
7
10
|
import { createHash } from 'node:crypto';
|
|
8
11
|
import { mkdirSync, createWriteStream } from 'node:fs';
|
|
9
12
|
import { mkdir, stat, open } from 'node:fs/promises';
|
|
@@ -14,6 +17,57 @@ import fsDriver from 'unstorage/drivers/fs';
|
|
|
14
17
|
|
|
15
18
|
const logger = useLogger("nuxt-ai-ready");
|
|
16
19
|
|
|
20
|
+
function hookNuxtSeoProLicense() {
|
|
21
|
+
const nuxt = useNuxt();
|
|
22
|
+
const isBuild = !nuxt.options.dev && !nuxt.options._prepare;
|
|
23
|
+
if (isBuild && !nuxt._isNuxtSeoProVerifying) {
|
|
24
|
+
const license = nuxt.options.runtimeConfig.seoProKey || process.env.NUXT_SEO_PRO_KEY;
|
|
25
|
+
if (isTest) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!isCI && !license) {
|
|
29
|
+
p.log.warn("\u26A0\uFE0F Building without license in non-CI environment. A license is required for production builds.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!license) {
|
|
33
|
+
p.log.error("\u{1F510} Nuxt SEO Pro license required");
|
|
34
|
+
p.note("Set NUXT_SEO_PRO_KEY or configure via module options.\n\nhttps://nuxtseo.com/pro/dashboard", "Get your license");
|
|
35
|
+
throw new Error("Missing Nuxt SEO Pro license key.");
|
|
36
|
+
}
|
|
37
|
+
nuxt._isNuxtSeoProVerifying = true;
|
|
38
|
+
nuxt.hooks.hook("build:before", async () => {
|
|
39
|
+
p.intro("Nuxt SEO Pro: License Verification");
|
|
40
|
+
const siteConfig = useSiteConfig();
|
|
41
|
+
const spinner = p.spinner();
|
|
42
|
+
spinner.start("\u{1F511} Verifying Nuxt SEO Pro license...");
|
|
43
|
+
const siteUrl = siteConfig.url?.startsWith("http") ? siteConfig.url : void 0;
|
|
44
|
+
const siteName = siteConfig.name || void 0;
|
|
45
|
+
const res = await $fetch("https://nuxtseo.com/api/pro/verify", {
|
|
46
|
+
method: "POST",
|
|
47
|
+
body: { apiKey: license, siteUrl, siteName }
|
|
48
|
+
}).catch((err) => {
|
|
49
|
+
if (err?.response?.status === 401) {
|
|
50
|
+
spinner.stop("\u274C Invalid API key");
|
|
51
|
+
p.note("Your API key is invalid.\n\nhttps://nuxtseo.com/pro/dashboard", "License Issue");
|
|
52
|
+
throw new Error("Invalid Nuxt SEO Pro API key.");
|
|
53
|
+
}
|
|
54
|
+
if (err?.response?.status === 403) {
|
|
55
|
+
spinner.stop("\u274C No active subscription");
|
|
56
|
+
p.note("Your subscription has expired or is inactive.\n\nhttps://nuxtseo.com/pro/dashboard", "License Issue");
|
|
57
|
+
throw new Error("No active Nuxt SEO Pro subscription.");
|
|
58
|
+
}
|
|
59
|
+
logger.error(err);
|
|
60
|
+
return null;
|
|
61
|
+
});
|
|
62
|
+
if (!res) {
|
|
63
|
+
spinner.stop("\u26A0\uFE0F License verification skipped (network issue)");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
spinner.stop("License verified \u2713");
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
17
71
|
function createContentHashManager(options) {
|
|
18
72
|
const { storagePath, debug = false } = options;
|
|
19
73
|
let storage;
|
|
@@ -405,6 +459,7 @@ const module$1 = defineNuxtModule({
|
|
|
405
459
|
return;
|
|
406
460
|
}
|
|
407
461
|
await installNuxtSiteConfig();
|
|
462
|
+
hookNuxtSeoProLicense();
|
|
408
463
|
nuxt.options.nitro.alias = nuxt.options.nitro.alias || {};
|
|
409
464
|
nuxt.options.alias["#ai-ready"] = resolve("./runtime");
|
|
410
465
|
if (!nuxt.options.mcp?.name) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ai-ready",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.7",
|
|
5
5
|
"description": "Best practice AI & LLM discoverability for Nuxt sites.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -32,16 +32,18 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@
|
|
35
|
+
"@clack/prompts": "^0.11.0",
|
|
36
|
+
"@nuxt/kit": "4.2.2",
|
|
36
37
|
"@toon-format/toon": "^2.1.0",
|
|
37
38
|
"consola": "^3.4.2",
|
|
38
39
|
"defu": "^6.1.4",
|
|
39
40
|
"mdream": "^0.15.3",
|
|
40
41
|
"minimatch": "^10.1.1",
|
|
41
|
-
"nuxt-site-config": "
|
|
42
|
+
"nuxt-site-config": "3.2.11",
|
|
43
|
+
"ofetch": "^1.5.1",
|
|
42
44
|
"pathe": "^2.0.3",
|
|
43
45
|
"pkg-types": "^2.3.0",
|
|
44
|
-
"std-env": "
|
|
46
|
+
"std-env": "3.10.0",
|
|
45
47
|
"tokenx": "^1.2.1",
|
|
46
48
|
"ufo": "^1.6.1",
|
|
47
49
|
"unstorage": "^1.17.3"
|
|
@@ -67,8 +69,8 @@
|
|
|
67
69
|
"eslint": "^9.39.1",
|
|
68
70
|
"execa": "^9.6.1",
|
|
69
71
|
"happy-dom": "^20.0.11",
|
|
70
|
-
"nuxt": "^4.2.
|
|
71
|
-
"nuxt-site-config": "
|
|
72
|
+
"nuxt": "^4.2.2",
|
|
73
|
+
"nuxt-site-config": "3.2.11",
|
|
72
74
|
"playwright": "^1.57.0",
|
|
73
75
|
"playwright-core": "^1.57.0",
|
|
74
76
|
"postgres": "^3.4.7",
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
"vitest": "^4.0.15",
|
|
77
79
|
"vue": "^3.5.25",
|
|
78
80
|
"vue-router": "^4.6.3",
|
|
79
|
-
"vue-tsc": "^3.1.
|
|
81
|
+
"vue-tsc": "^3.1.8",
|
|
80
82
|
"zod": "^4.1.13"
|
|
81
83
|
},
|
|
82
84
|
"resolutions": {
|