nuxt-ai-ready 2.5.3 → 3.0.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/README.md +13 -12
- package/dist/chunks/agent-skills.mjs +35 -12
- package/dist/chunks/prerender.mjs +35 -24
- package/dist/cli.mjs +5 -2
- package/dist/module.d.mts +4 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +8 -4
- package/dist/runtime/app/index.d.ts +3 -0
- package/dist/runtime/app/index.js +2 -0
- package/dist/runtime/cache-control.d.ts +2 -0
- package/dist/runtime/cache-control.js +11 -0
- package/dist/runtime/llms-txt-utils.js +1 -1
- package/dist/runtime/server/db/context.d.ts +13 -0
- package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
- package/dist/runtime/server/db/drizzle/client.js +13 -2
- package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
- package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
- package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
- package/dist/runtime/server/db/drizzle/queries.js +6 -5
- package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
- package/dist/runtime/server/db/index.d.ts +1 -1
- package/dist/runtime/server/db/index.js +1 -1
- package/dist/runtime/server/db/queries.d.ts +36 -36
- package/dist/runtime/server/db/queries.js +8 -9
- package/dist/runtime/server/db/seed.d.ts +2 -2
- package/dist/runtime/server/db/seed.js +4 -3
- package/dist/runtime/server/db/shared.d.ts +8 -0
- package/dist/runtime/server/db/shared.js +8 -2
- package/dist/runtime/server/index.d.ts +2 -0
- package/dist/runtime/server/index.js +17 -0
- package/dist/runtime/server/mcp/tools/get-page-markdown.js +1 -1
- package/dist/runtime/server/mcp/tools/list-pages.js +1 -1
- package/dist/runtime/server/mcp/tools/search-pages.js +1 -1
- package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
- package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
- package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
- package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
- package/dist/runtime/server/plugins/link-header.d.ts +6 -0
- package/dist/runtime/server/plugins/link-header.js +7 -11
- package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
- package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
- package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
- package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-index.js +7 -6
- package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
- package/dist/runtime/server/routes/ai-catalog.js +7 -8
- package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
- package/dist/runtime/server/routes/api-catalog.js +12 -12
- package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
- package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
- package/dist/runtime/server/routes/mcp-server-card.js +7 -8
- package/dist/runtime/server/utils/checkStale.d.ts +2 -2
- package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
- package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
- package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
- package/dist/runtime/server/utils/cloudflare.js +31 -7
- package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
- package/dist/runtime/server/utils/content-negotiation.js +8 -7
- package/dist/runtime/server/utils/context.d.ts +3 -3
- package/dist/runtime/server/utils/context.js +1 -1
- package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
- package/dist/runtime/server/utils/link-header.d.ts +5 -3
- package/dist/runtime/server/utils/link-header.js +26 -2
- package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
- package/dist/runtime/server/utils/markdown-request.js +15 -13
- package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
- package/dist/runtime/server/utils/negotiation-decision.js +6 -5
- package/dist/runtime/server/utils/negotiation-response.js +47 -22
- package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
- package/dist/runtime/server/utils/prerender-html.js +3 -1
- package/dist/runtime/types.d.ts +15 -7
- package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
- package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
- package/package.json +85 -20
- package/skills/nuxt-ai-ready/SKILL.md +26 -12
- package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
- package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
- package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
- package/node_modules/@mdream/js/LICENSE.md +0 -9
- package/node_modules/@mdream/js/README.md +0 -792
- package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
- package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
- package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
- package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
- package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
- package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
- package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
- package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
- package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
- package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
- package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
- package/node_modules/@mdream/js/dist/cli.mjs +0 -32
- package/node_modules/@mdream/js/dist/core.d.mts +0 -15
- package/node_modules/@mdream/js/dist/core.mjs +0 -28
- package/node_modules/@mdream/js/dist/index.d.mts +0 -4
- package/node_modules/@mdream/js/dist/index.mjs +0 -58
- package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
- package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
- package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
- package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
- package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
- package/node_modules/@mdream/js/dist/parse.mjs +0 -2
- package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
- package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
- package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
- package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
- package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
- package/node_modules/@mdream/js/package.json +0 -103
- package/node_modules/cac/LICENSE +0 -21
- package/node_modules/cac/README.md +0 -492
- package/node_modules/cac/dist/index.d.ts +0 -196
- package/node_modules/cac/dist/index.js +0 -638
- package/node_modules/cac/package.json +0 -72
- package/node_modules/mdream/LICENSE.md +0 -9
- package/node_modules/mdream/README.md +0 -1091
- package/node_modules/mdream/bin/mdream.mjs +0 -46
- package/node_modules/mdream/dist/browser.d.mts +0 -105
- package/node_modules/mdream/dist/browser.mjs +0 -262
- package/node_modules/mdream/dist/edge.d.mts +0 -100
- package/node_modules/mdream/dist/edge.mjs +0 -250
- package/node_modules/mdream/dist/iife.js +0 -605
- package/node_modules/mdream/dist/index.d.mts +0 -89
- package/node_modules/mdream/dist/index.mjs +0 -184
- package/node_modules/mdream/dist/wasm.d.mts +0 -100
- package/node_modules/mdream/dist/wasm.mjs +0 -140
- package/node_modules/mdream/dist/worker.d.mts +0 -101
- package/node_modules/mdream/dist/worker.mjs +0 -217
- package/node_modules/mdream/napi/index.d.mts +0 -127
- package/node_modules/mdream/napi/index.d.ts +0 -127
- package/node_modules/mdream/napi/index.mjs +0 -725
- package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
- package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
- package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
- package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
- package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
- package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
- package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
- package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
- package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
- package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
- package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
- package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/README.md +0 -203
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/package.json +0 -35
- package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
- package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
- package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
- package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
- package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
- package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
- package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -240
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1118
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
- package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -17578
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
- package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
- package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
- package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
- package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
- package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
- package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
- package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
- package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
- package/node_modules/mdream/node_modules/tslib/README.md +0 -164
- package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
- package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
- package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
- package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
- package/node_modules/mdream/node_modules/tslib/package.json +0 -47
- package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
- package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
- package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
- package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
- package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
- package/node_modules/mdream/package.json +0 -110
- package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
- package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
- package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
- package/node_modules/mdream/wasm/mdream_edge.js +0 -517
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm/package.json +0 -17
- package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
- package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
- package/node_modules/mdream/wasm-bundler/package.json +0 -19
- package/node_modules/pathe/LICENSE +0 -70
- package/node_modules/pathe/README.md +0 -73
- package/node_modules/pathe/dist/index.cjs +0 -39
- package/node_modules/pathe/dist/index.d.cts +0 -47
- package/node_modules/pathe/dist/index.d.mts +0 -47
- package/node_modules/pathe/dist/index.d.ts +0 -47
- package/node_modules/pathe/dist/index.mjs +0 -19
- package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
- package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
- package/node_modules/pathe/dist/utils.cjs +0 -82
- package/node_modules/pathe/dist/utils.d.cts +0 -32
- package/node_modules/pathe/dist/utils.d.mts +0 -32
- package/node_modules/pathe/dist/utils.d.ts +0 -32
- package/node_modules/pathe/dist/utils.mjs +0 -77
- package/node_modules/pathe/package.json +0 -61
- package/node_modules/pathe/utils.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
<h1><a href="https://nuxtseo.com"><img src=".github/assets/icon.svg" width="40" height="40" alt="Nuxt SEO" align="top"></a> Nuxt AI Ready</h1>
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![License][license-src]][license-href]
|
|
5
6
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
6
|
-
|
|
7
|
-
<picture>
|
|
8
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://skilld.dev/b/harlan-zw/nuxt-ai-ready?theme=dark">
|
|
9
|
-
<source media="(prefers-color-scheme: light)" srcset="https://skilld.dev/b/harlan-zw/nuxt-ai-ready?theme=light">
|
|
10
|
-
<img alt="Skill repository on skilld.dev" src="https://skilld.dev/b/harlan-zw/nuxt-ai-ready?theme=light">
|
|
11
|
-
</picture>
|
|
12
|
-
</a>
|
|
7
|
+
[![Skill repository on skilld.dev][skilld-src]][skilld-href]
|
|
13
8
|
|
|
14
9
|
> Best practice AI & LLM discoverability for Nuxt sites. Score 100 on [`npx @vercel/agent-readability audit <URL>`](https://github.com/vercel-labs/agent-readability).
|
|
15
10
|
|
|
@@ -41,7 +36,7 @@ Nuxt AI Ready implements both. It converts your pages to markdown, generates llm
|
|
|
41
36
|
Install `nuxt-ai-ready` dependency to your project:
|
|
42
37
|
|
|
43
38
|
```bash
|
|
44
|
-
npx
|
|
39
|
+
npx nuxt module add nuxt-ai-ready
|
|
45
40
|
```
|
|
46
41
|
|
|
47
42
|
> [!TIP]
|
|
@@ -66,11 +61,17 @@ npx nuxi@latest module add nuxt-ai-ready
|
|
|
66
61
|
[MIT](https://github.com/harlan-zw/nuxt-ai-ready/blob/main/LICENSE).
|
|
67
62
|
|
|
68
63
|
<!-- Badges -->
|
|
69
|
-
[npm-version-src]: https://img.shields.io/npm/v/nuxt-ai-ready/latest.svg?style=flat&
|
|
64
|
+
[npm-version-src]: https://img.shields.io/npm/v/nuxt-ai-ready/latest.svg?style=flat&labelColor=16152b&color=00a63e
|
|
70
65
|
[npm-version-href]: https://npmjs.com/package/nuxt-ai-ready
|
|
71
66
|
|
|
72
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-ai-ready.svg?style=flat&
|
|
67
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-ai-ready.svg?style=flat&labelColor=16152b&color=00a63e
|
|
73
68
|
[npm-downloads-href]: https://npmjs.com/package/nuxt-ai-ready
|
|
74
69
|
|
|
75
|
-
[
|
|
70
|
+
[license-src]: https://img.shields.io/github/license/harlan-zw/nuxt-ai-ready.svg?style=flat&labelColor=16152b&color=00a63e
|
|
71
|
+
[license-href]: https://github.com/harlan-zw/nuxt-ai-ready/blob/main/LICENSE.md
|
|
72
|
+
|
|
73
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-16152b?logo=nuxt&style=flat
|
|
76
74
|
[nuxt-href]: https://nuxt.com
|
|
75
|
+
|
|
76
|
+
[skilld-src]: https://skilld.dev/b/harlan-zw/nuxt-ai-ready?style=flat&labelColor=16152b&color=00a63e&logoColor=ffffff
|
|
77
|
+
[skilld-href]: https://skilld.dev/gh/harlan-zw/nuxt-ai-ready
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { realpath, readFile, readdir } from 'node:fs/promises';
|
|
3
|
-
import { resolve, isAbsolute,
|
|
3
|
+
import { join, resolve, isAbsolute, relative, sep } from 'node:path';
|
|
4
4
|
import { parseDocument } from 'yaml';
|
|
5
|
-
import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.
|
|
5
|
+
import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.C34F0LJo.mjs';
|
|
6
6
|
import 'node:module';
|
|
7
|
+
import 'node:url';
|
|
7
8
|
import '@nuxt/kit';
|
|
8
9
|
import 'defu';
|
|
9
10
|
import 'nuxt-site-config/kit';
|
|
10
11
|
import 'nuxtseo-shared/kit';
|
|
11
|
-
import '
|
|
12
|
-
import 'node:
|
|
12
|
+
import '../shared/nuxt-ai-ready.B3hAuOLQ.mjs';
|
|
13
|
+
import 'node:fs';
|
|
13
14
|
import '../../dist/runtime/markdown-path.js';
|
|
15
|
+
import '../../dist/runtime/route-path.js';
|
|
14
16
|
import '../../dist/runtime/server/utils/sitemap-md.js';
|
|
15
17
|
import '../../dist/runtime/cache-control.js';
|
|
16
18
|
import '../../dist/runtime/server/utils/discovery-response.js';
|
|
19
|
+
import 'confbox';
|
|
20
|
+
import 'nuxtseo-shared/server';
|
|
21
|
+
import '../../dist/runtime/server/utils/content-negotiation.js';
|
|
17
22
|
import 'pathe';
|
|
18
23
|
import 'nuxtseo-shared/i18n';
|
|
19
|
-
import '../../dist/runtime/route-path.js';
|
|
20
24
|
|
|
21
25
|
const namePattern = /^(?!.*--)[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
22
26
|
const digestPattern = /^sha256:[a-f0-9]{64}$/;
|
|
@@ -145,9 +149,10 @@ function parseLocalSkillMetadata(content, skill, index) {
|
|
|
145
149
|
}
|
|
146
150
|
return issues;
|
|
147
151
|
}
|
|
148
|
-
async function resolveLocalEntry(skill, index, rootDir) {
|
|
152
|
+
async function resolveLocalEntry(skill, index, rootDir, publicDirs) {
|
|
149
153
|
const file = resolve(rootDir, skill.file);
|
|
150
|
-
|
|
154
|
+
const publicDirectory = publicDirs.map((directory) => resolve(directory, "skills")).find((directory) => isWithinDirectory(directory, file));
|
|
155
|
+
if (isAbsolute(skill.file) || !isWithinDirectory(rootDir, file) && !publicDirectory) {
|
|
151
156
|
return {
|
|
152
157
|
_tag: "Invalid",
|
|
153
158
|
issues: [{
|
|
@@ -157,8 +162,8 @@ async function resolveLocalEntry(skill, index, rootDir) {
|
|
|
157
162
|
}]
|
|
158
163
|
};
|
|
159
164
|
}
|
|
160
|
-
return Promise.all([realpath(rootDir), realpath(file)]).then(([realRootDir, realFile]) => {
|
|
161
|
-
if (!isWithinDirectory(realRootDir, realFile)) {
|
|
165
|
+
return Promise.all([realpath(rootDir), realpath(file), publicDirectory ? realpath(publicDirectory) : void 0]).then(([realRootDir, realFile, realPublicDirectory]) => {
|
|
166
|
+
if (!isWithinDirectory(realRootDir, realFile) && !(realPublicDirectory && isWithinDirectory(realPublicDirectory, realFile))) {
|
|
162
167
|
return {
|
|
163
168
|
_tag: "Invalid",
|
|
164
169
|
issues: [{
|
|
@@ -243,7 +248,7 @@ async function resolveAgentSkillsConfig(config, rootDir, options = {}) {
|
|
|
243
248
|
if (issues.length > 0)
|
|
244
249
|
return { _tag: "Invalid", issues };
|
|
245
250
|
const skills = configuredSkills;
|
|
246
|
-
const resolved = await Promise.all(skills.map((skill, index) => skill.source === "local" ? resolveLocalEntry(skill, index, rootDir) : Promise.resolve({ _tag: "Resolved", entry: resolveExternalEntry(skill) })));
|
|
251
|
+
const resolved = await Promise.all(skills.map((skill, index) => skill.source === "local" ? resolveLocalEntry(skill, index, rootDir, options.publicDirs ?? []) : Promise.resolve({ _tag: "Resolved", entry: resolveExternalEntry(skill) })));
|
|
247
252
|
const fileIssues = resolved.flatMap((result) => result._tag === "Invalid" ? result.issues : []);
|
|
248
253
|
if (fileIssues.length > 0)
|
|
249
254
|
return { _tag: "Invalid", issues: fileIssues };
|
|
@@ -283,7 +288,7 @@ async function discoverAgentSkills(options) {
|
|
|
283
288
|
const seen = /* @__PURE__ */ new Set();
|
|
284
289
|
for (const scanDir of options.scanDirs) {
|
|
285
290
|
const base = resolve(scanDir, dir);
|
|
286
|
-
if (!isWithinDirectory(options.rootDir, base) && base !== options.rootDir)
|
|
291
|
+
if (!options.publicOnly && !isWithinDirectory(options.rootDir, base) && base !== options.rootDir)
|
|
287
292
|
continue;
|
|
288
293
|
const entries = await readdir(base, { withFileTypes: true }).catch(() => {
|
|
289
294
|
return [];
|
|
@@ -292,6 +297,19 @@ async function discoverAgentSkills(options) {
|
|
|
292
297
|
if (seen.has(entry.name))
|
|
293
298
|
continue;
|
|
294
299
|
const file = join(base, entry.name, "SKILL.md");
|
|
300
|
+
if (options.publicOnly) {
|
|
301
|
+
const resolvedFile = await realpath(file).catch((error) => {
|
|
302
|
+
if (error.code === "ENOENT")
|
|
303
|
+
return null;
|
|
304
|
+
throw error;
|
|
305
|
+
});
|
|
306
|
+
if (resolvedFile === null)
|
|
307
|
+
continue;
|
|
308
|
+
if (!isWithinDirectory(await realpath(base), resolvedFile)) {
|
|
309
|
+
issues.push({ field: "file", message: `${toPosix(relative(options.rootDir, file))} must resolve within its public skills directory` });
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
295
313
|
const content = await readFile(file, "utf8").catch(() => {
|
|
296
314
|
return null;
|
|
297
315
|
});
|
|
@@ -347,7 +365,12 @@ async function prepareAgentSkills(config, options) {
|
|
|
347
365
|
return { _tag: "Invalid", issues: [{ field: "dir", message: "must be a string or false when set" }] };
|
|
348
366
|
if (config.skills !== void 0 && !Array.isArray(config.skills))
|
|
349
367
|
return { _tag: "Invalid", issues: [{ field: "agentSkills", message: "skills must be an array when set" }] };
|
|
350
|
-
const discovered = config.dir === false ? { skills: [], issues: [] } : await discoverAgentSkills({
|
|
368
|
+
const discovered = config.dir === false ? { skills: [], issues: [] } : await discoverAgentSkills({
|
|
369
|
+
rootDir: options.rootDir,
|
|
370
|
+
scanDirs: config.dir === void 0 ? options.publicDirs ?? options.scanDirs.map((directory) => join(directory, "public")) : options.scanDirs,
|
|
371
|
+
dir: config.dir ?? "skills",
|
|
372
|
+
publicOnly: config.dir === void 0
|
|
373
|
+
});
|
|
351
374
|
if (discovered.issues.length > 0)
|
|
352
375
|
return { _tag: "Invalid", issues: discovered.issues };
|
|
353
376
|
return { _tag: "Ok", skills: mergeAgentSkills(discovered.skills, config.skills ?? []) };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { mkdir, writeFile, appendFile, stat, readdir } from 'node:fs/promises';
|
|
2
2
|
import { join, dirname, relative, resolve } from 'node:path';
|
|
3
|
-
import { useNuxt, hasNuxtModule, resolveFiles } from '@nuxt/kit';
|
|
3
|
+
import { useNuxt, getNitroVersion, hasNuxtModule, resolveFiles } from '@nuxt/kit';
|
|
4
4
|
import { colorize } from 'consola/utils';
|
|
5
5
|
import { resolveLocaleFromRoute } from 'nuxtseo-shared/i18n-runtime';
|
|
6
|
+
import { createPrerenderFetch } from 'nuxtseo-shared/prerender';
|
|
6
7
|
import { collectSitemap } from 'sitemapd/parse';
|
|
7
8
|
import { withLeadingSlash, joinURL, withBase } from 'ufo';
|
|
8
|
-
import { l as logger,
|
|
9
|
+
import { l as logger, M as MARKDOWN_LINK_AVAILABILITY_FILE } from '../shared/nuxt-ai-ready.C34F0LJo.mjs';
|
|
9
10
|
import { normalizePagePath, toMarkdownPath } from '../../dist/runtime/markdown-path.js';
|
|
10
11
|
import { toDeployedRoute, toLogicalRoute } from '../../dist/runtime/route-path.js';
|
|
11
12
|
import { initSchema, computeContentHash, insertPage, queryAllPages, exportDbDump } from '../../dist/runtime/server/db/shared.js';
|
|
@@ -14,13 +15,17 @@ import { resolvePageUpdatedAt } from '../../dist/runtime/server/utils/page-updat
|
|
|
14
15
|
import { SITEMAP_MD_ROUTE, appendSitemapSection } from '../../dist/runtime/server/utils/sitemap-md.js';
|
|
15
16
|
import 'node:crypto';
|
|
16
17
|
import 'node:module';
|
|
18
|
+
import 'node:url';
|
|
17
19
|
import 'defu';
|
|
18
20
|
import 'nuxt-site-config/kit';
|
|
19
21
|
import 'nuxtseo-shared/kit';
|
|
20
|
-
import '
|
|
21
|
-
import 'node:
|
|
22
|
+
import '../shared/nuxt-ai-ready.B3hAuOLQ.mjs';
|
|
23
|
+
import 'node:fs';
|
|
22
24
|
import '../../dist/runtime/cache-control.js';
|
|
23
25
|
import '../../dist/runtime/server/utils/discovery-response.js';
|
|
26
|
+
import 'confbox';
|
|
27
|
+
import 'nuxtseo-shared/server';
|
|
28
|
+
import '../../dist/runtime/server/utils/content-negotiation.js';
|
|
24
29
|
import 'pathe';
|
|
25
30
|
import 'nuxtseo-shared/i18n';
|
|
26
31
|
|
|
@@ -62,6 +67,11 @@ async function findOutputMarkdownPaths(publicDir, baseURL, srcDir, ignoredPaths,
|
|
|
62
67
|
}
|
|
63
68
|
return [...paths].sort();
|
|
64
69
|
}
|
|
70
|
+
function crawlerFetch(state) {
|
|
71
|
+
if (!state.fetch)
|
|
72
|
+
throw new Error("The Nitro prerender app is not initialized.");
|
|
73
|
+
return state.fetch;
|
|
74
|
+
}
|
|
65
75
|
function createCrawlerState(dbPath, llmsFullTxtPath, siteInfo, llmsTxtConfig, concurrency = 10, ftsTokenizer, i18n) {
|
|
66
76
|
return {
|
|
67
77
|
prerenderedRoutes: /* @__PURE__ */ new Set(),
|
|
@@ -130,15 +140,8 @@ function createSqliteAdapter(sqlite) {
|
|
|
130
140
|
};
|
|
131
141
|
}
|
|
132
142
|
async function createPrerenderDatabase(dbPath) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const sqlite2 = new DatabaseSync(dbPath);
|
|
136
|
-
for (const pragma of PRERENDER_PRAGMAS)
|
|
137
|
-
sqlite2.exec(pragma);
|
|
138
|
-
return createSqliteAdapter(sqlite2);
|
|
139
|
-
}
|
|
140
|
-
const { default: Database } = await import('better-sqlite3');
|
|
141
|
-
const sqlite = new Database(dbPath);
|
|
143
|
+
const { DatabaseSync } = await import('node:sqlite');
|
|
144
|
+
const sqlite = new DatabaseSync(dbPath);
|
|
142
145
|
for (const pragma of PRERENDER_PRAGMAS)
|
|
143
146
|
sqlite.exec(pragma);
|
|
144
147
|
return createSqliteAdapter(sqlite);
|
|
@@ -191,7 +194,7 @@ async function processSitemapEntry(state, nuxt, nitro, entry) {
|
|
|
191
194
|
const mdRoute = toMarkdownPath(route);
|
|
192
195
|
const mdUrl = toDeployedRoute(mdRoute, nitro.options.baseURL);
|
|
193
196
|
logger.debug(`Fetching markdown for ${route} \u2192 ${mdUrl}`);
|
|
194
|
-
const res = await
|
|
197
|
+
const res = await crawlerFetch(state)(mdUrl, {
|
|
195
198
|
headers: { "x-nitro-prerender": mdRoute },
|
|
196
199
|
retry: 0,
|
|
197
200
|
signal: AbortSignal.timeout(PRERENDER_PAGE_TIMEOUT)
|
|
@@ -268,11 +271,11 @@ function detectSitemapPrerender(sitemapName = "sitemap.xml") {
|
|
|
268
271
|
usePrerenderHook: shouldHookIntoPrerender && !prerenderSitemap
|
|
269
272
|
};
|
|
270
273
|
}
|
|
271
|
-
async function prerenderRoute(nitro, route) {
|
|
274
|
+
async function prerenderRoute(nitro, route, fetch) {
|
|
272
275
|
const start = Date.now();
|
|
273
276
|
const encodedRoute = encodeURI(route);
|
|
274
277
|
const fetchUrl = withBase(encodedRoute, nitro.options.baseURL);
|
|
275
|
-
const res = await
|
|
278
|
+
const res = await fetch.raw(fetchUrl, {
|
|
276
279
|
headers: { "x-nitro-prerender": encodedRoute },
|
|
277
280
|
retry: nitro.options.prerender.retry,
|
|
278
281
|
retryDelay: nitro.options.prerender.retryDelay
|
|
@@ -309,6 +312,14 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
309
312
|
extras.ftsTokenizer,
|
|
310
313
|
extras.i18n
|
|
311
314
|
);
|
|
315
|
+
let prerenderClient;
|
|
316
|
+
nitro.hooks.hook("prerender:init", (renderer) => {
|
|
317
|
+
const major = getNitroVersion(nuxt);
|
|
318
|
+
if (major !== 2 && major !== 3)
|
|
319
|
+
throw new Error(`Unsupported Nitro prerender builder: ${major}`);
|
|
320
|
+
prerenderClient = createPrerenderFetch(renderer, major);
|
|
321
|
+
state.fetch = prerenderClient.fetch;
|
|
322
|
+
});
|
|
312
323
|
let initPromise = null;
|
|
313
324
|
const artifactRoutes = new Set(extras.artifactRoutes ?? []);
|
|
314
325
|
nitro.hooks.hook("prerender:generate", async (route) => {
|
|
@@ -327,7 +338,7 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
327
338
|
}
|
|
328
339
|
if (!route.fileName?.endsWith(".md"))
|
|
329
340
|
return;
|
|
330
|
-
let pageRoute = route.
|
|
341
|
+
let pageRoute = withLeadingSlash(route.fileName).replace(RE_MD_EXT, "");
|
|
331
342
|
if (pageRoute === "/index")
|
|
332
343
|
pageRoute = "/";
|
|
333
344
|
const pageStartTime = Date.now();
|
|
@@ -408,11 +419,11 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
408
419
|
paths
|
|
409
420
|
}), "utf-8");
|
|
410
421
|
}
|
|
411
|
-
const llmsStats = await prerenderRoute(nitro, "/llms.txt");
|
|
422
|
+
const llmsStats = await prerenderRoute(nitro, "/llms.txt", crawlerFetch(state));
|
|
412
423
|
const llmsFullStats = await stat(state.llmsFullTxtPath);
|
|
413
424
|
nitro._prerenderedRoutes.push({ route: "/llms-full.txt", fileName: "/llms-full.txt" });
|
|
414
425
|
if (options.sitemapMd !== false) {
|
|
415
|
-
const sitemapMdStats = await prerenderRoute(nitro, SITEMAP_MD_ROUTE);
|
|
426
|
+
const sitemapMdStats = await prerenderRoute(nitro, SITEMAP_MD_ROUTE, crawlerFetch(state));
|
|
416
427
|
logger.debug(`Wrote sitemap.md (${(sitemapMdStats.size / 1024).toFixed(1)}kb)`);
|
|
417
428
|
}
|
|
418
429
|
const kb = (b) => (b / 1024).toFixed(1);
|
|
@@ -426,7 +437,7 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
426
437
|
const { useSitemapHook, usePrerenderHook } = detectSitemapPrerender();
|
|
427
438
|
logger.debug(`Prerender hooks: sitemap=${useSitemapHook}, prerender=${usePrerenderHook}`);
|
|
428
439
|
if (useSitemapHook) {
|
|
429
|
-
nuxt.hooks.hook("sitemap:prerender:done", async (ctx) => {
|
|
440
|
+
nuxt.hooks.hook("sitemap:prerender:done", async (ctx) => (async () => {
|
|
430
441
|
if (!state.initialized)
|
|
431
442
|
return;
|
|
432
443
|
for (const sitemap of ctx.sitemaps)
|
|
@@ -435,12 +446,12 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
435
446
|
state.prerenderedRoutes.clear();
|
|
436
447
|
if (state.db)
|
|
437
448
|
await state.db.close?.();
|
|
438
|
-
});
|
|
449
|
+
})().finally(() => prerenderClient?.close()));
|
|
439
450
|
} else if (usePrerenderHook) {
|
|
440
|
-
nitro.hooks.hook("prerender:done", async () => {
|
|
451
|
+
nitro.hooks.hook("prerender:done", async () => (async () => {
|
|
441
452
|
if (!state.initialized)
|
|
442
453
|
return;
|
|
443
|
-
const sitemapContent = await
|
|
454
|
+
const sitemapContent = await crawlerFetch(state)(toDeployedRoute("/sitemap.xml", nitro.options.baseURL), {
|
|
444
455
|
headers: { "x-nitro-prerender": "/sitemap.xml" },
|
|
445
456
|
signal: AbortSignal.timeout(PRERENDER_PAGE_TIMEOUT)
|
|
446
457
|
}).catch(() => {
|
|
@@ -452,7 +463,7 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
452
463
|
state.prerenderedRoutes.clear();
|
|
453
464
|
if (state.db)
|
|
454
465
|
await state.db.close?.();
|
|
455
|
-
});
|
|
466
|
+
})().finally(() => prerenderClient?.close()));
|
|
456
467
|
}
|
|
457
468
|
});
|
|
458
469
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -5,7 +5,10 @@ import { defineCommand, runMain } from 'citty';
|
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { colors } from 'consola/utils';
|
|
7
7
|
import { resolve, join } from 'pathe';
|
|
8
|
-
import {
|
|
8
|
+
import { r as readPackageMetadata } from './shared/nuxt-ai-ready.B3hAuOLQ.mjs';
|
|
9
|
+
import 'node:module';
|
|
10
|
+
import 'node:path';
|
|
11
|
+
import 'node:url';
|
|
9
12
|
|
|
10
13
|
async function getSecret(cwd) {
|
|
11
14
|
const secretPath = join(cwd, "node_modules/.cache/nuxt/ai-ready/secret");
|
|
@@ -47,7 +50,7 @@ const main = defineCommand({
|
|
|
47
50
|
meta: {
|
|
48
51
|
name: "nuxt-ai-ready",
|
|
49
52
|
description: "Nuxt AI Ready CLI",
|
|
50
|
-
version: await
|
|
53
|
+
version: await readPackageMetadata(import.meta.url).then((p) => p.version || "0.0.0")
|
|
51
54
|
},
|
|
52
55
|
subCommands: {
|
|
53
56
|
status: () => defineCommand({
|
package/dist/module.d.mts
CHANGED
|
@@ -55,6 +55,8 @@ interface ResolvedWebMcpConfig {
|
|
|
55
55
|
declare function resolveAiCatalog(input: {
|
|
56
56
|
siteUrl: string;
|
|
57
57
|
serverCardName: string;
|
|
58
|
+
serverCardTitle?: string;
|
|
59
|
+
serverCardDescription?: string;
|
|
58
60
|
serverCardUrl: string;
|
|
59
61
|
}): AiCatalog;
|
|
60
62
|
|
|
@@ -91,9 +93,11 @@ declare module '@nuxt/schema' {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
interface ModulePublicRuntimeConfig {
|
|
96
|
+
cloudflarePrerenderedPages?: string[];
|
|
94
97
|
debug: boolean;
|
|
95
98
|
debugCron: boolean;
|
|
96
99
|
contentNegotiation: ContentNegotiationPolicy;
|
|
100
|
+
botNegotiation: boolean;
|
|
97
101
|
version: string;
|
|
98
102
|
sitemapMd: boolean;
|
|
99
103
|
describedby: boolean;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,17 +2,21 @@ import 'node:crypto';
|
|
|
2
2
|
import 'node:fs/promises';
|
|
3
3
|
import 'node:module';
|
|
4
4
|
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
5
6
|
import '@nuxt/kit';
|
|
6
7
|
import 'defu';
|
|
7
8
|
import 'nuxt-site-config/kit';
|
|
8
9
|
import 'nuxtseo-shared/kit';
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
export { m as default } from './shared/nuxt-ai-ready.C34F0LJo.mjs';
|
|
11
|
+
import './shared/nuxt-ai-ready.B3hAuOLQ.mjs';
|
|
11
12
|
import '../dist/runtime/markdown-path.js';
|
|
13
|
+
import '../dist/runtime/route-path.js';
|
|
12
14
|
import '../dist/runtime/server/utils/sitemap-md.js';
|
|
13
15
|
import '../dist/runtime/server/utils/discovery-response.js';
|
|
14
|
-
import 'node:url';
|
|
15
16
|
import '../dist/runtime/cache-control.js';
|
|
17
|
+
import 'confbox';
|
|
18
|
+
import 'nuxtseo-shared/server';
|
|
19
|
+
import '../dist/runtime/server/utils/content-negotiation.js';
|
|
16
20
|
import 'pathe';
|
|
17
21
|
import 'nuxtseo-shared/i18n';
|
|
18
|
-
import '
|
|
22
|
+
import 'node:fs';
|
|
@@ -6,3 +6,5 @@
|
|
|
6
6
|
* the edge.
|
|
7
7
|
*/
|
|
8
8
|
export declare function publicCacheControl(maxAgeSeconds: number, staleSeconds: number): string;
|
|
9
|
+
/** Merge Vary tokens without removing cache dimensions or duplicating names. */
|
|
10
|
+
export declare function mergeVaryHeader(current: string | undefined, added: string): string;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export function publicCacheControl(maxAgeSeconds, staleSeconds) {
|
|
2
2
|
return staleSeconds > 0 ? `public, max-age=${maxAgeSeconds}, stale-while-revalidate=${staleSeconds}` : `public, max-age=${maxAgeSeconds}`;
|
|
3
3
|
}
|
|
4
|
+
export function mergeVaryHeader(current, added) {
|
|
5
|
+
const tokens = [...(current || "").split(","), ...added.split(",")].map((token) => token.trim()).filter(Boolean);
|
|
6
|
+
if (tokens.includes("*"))
|
|
7
|
+
return "*";
|
|
8
|
+
const unique = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const token of tokens) {
|
|
10
|
+
if (!unique.has(token.toLowerCase()))
|
|
11
|
+
unique.set(token.toLowerCase(), token);
|
|
12
|
+
}
|
|
13
|
+
return [...unique.values()].join(", ");
|
|
14
|
+
}
|
|
@@ -122,7 +122,7 @@ export async function buildLlmsTxt(event) {
|
|
|
122
122
|
const i18nContext = { host: getRequestHost(event, { xForwardedHost: true }) };
|
|
123
123
|
const baseURL = runtimeConfig.app.baseURL;
|
|
124
124
|
const resolvePath = (path) => withSiteTrailingSlash(event, toDeployedRoute(path, baseURL));
|
|
125
|
-
const resolveUrl = (path) => withSiteUrl(event, toDeployedRoute(path, baseURL));
|
|
125
|
+
const resolveUrl = (path) => withSiteUrl(event, toDeployedRoute(path, baseURL), { withBase: true });
|
|
126
126
|
const canonicalSiteUrl = siteConfig.url ? resolveUrl("/") : void 0;
|
|
127
127
|
const parts = [];
|
|
128
128
|
parts.push(`# ${siteConfig.name || canonicalSiteUrl}`);
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import type { RequestEvent } from 'nuxt/server';
|
|
1
2
|
export declare const DB_CONTEXT_KEY = "_aiReadyDrizzle";
|
|
2
3
|
export declare const DB_PROMISE_CONTEXT_KEY = "_aiReadyDrizzlePromise";
|
|
3
4
|
export declare const DB_WORK_CONTEXT_KEY = "_aiReadyDrizzleWork";
|
|
5
|
+
/** Database clients need request context for bindings and response cleanup. */
|
|
6
|
+
export type AiReadyDatabaseEvent = Pick<RequestEvent, 'context'> & {
|
|
7
|
+
req?: {
|
|
8
|
+
headers: Headers | Record<string, string | string[] | undefined>;
|
|
9
|
+
};
|
|
10
|
+
node?: {
|
|
11
|
+
req: {
|
|
12
|
+
headers: Record<string, string | string[] | undefined>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
16
|
+
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
2
1
|
import type { SQLiteBunDatabase } from 'drizzle-orm/bun-sqlite';
|
|
3
2
|
import type { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
4
3
|
import type { LibSQLDatabase } from 'drizzle-orm/libsql';
|
|
5
4
|
import type { NeonHttpDatabase } from 'drizzle-orm/neon-http';
|
|
6
5
|
import type { NodeSQLiteDatabase } from 'drizzle-orm/node-sqlite';
|
|
7
6
|
import type { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
8
|
-
import type {
|
|
7
|
+
import type { AiReadyDatabaseEvent } from '../context.js';
|
|
9
8
|
export type DatabaseDialect = 'sqlite' | 'postgres';
|
|
10
|
-
type SQLiteDB =
|
|
9
|
+
type SQLiteDB = SQLiteBunDatabase | LibSQLDatabase | DrizzleD1Database | NodeSQLiteDatabase;
|
|
11
10
|
type PostgresDB = NeonHttpDatabase | PostgresJsDatabase;
|
|
12
11
|
export interface DrizzleDatabase {
|
|
13
12
|
dialect: DatabaseDialect;
|
|
14
13
|
db: SQLiteDB | PostgresDB;
|
|
15
14
|
}
|
|
16
15
|
/** Keep request-scoped clients alive until deferred database work finishes. */
|
|
17
|
-
export declare function trackDrizzleWork<T>(event:
|
|
16
|
+
export declare function trackDrizzleWork<T>(event: AiReadyDatabaseEvent, work: Promise<T>): Promise<T>;
|
|
18
17
|
/** Transfer client cleanup to deferred work after the response ends. */
|
|
19
|
-
export declare function finishDrizzleResponse(event:
|
|
18
|
+
export declare function finishDrizzleResponse(event: AiReadyDatabaseEvent): Promise<void>;
|
|
20
19
|
/**
|
|
21
20
|
* Get Drizzle database instance
|
|
22
21
|
*/
|
|
23
|
-
export declare function useDrizzle(event?:
|
|
24
|
-
export declare function closeDrizzle(event?:
|
|
22
|
+
export declare function useDrizzle(event?: AiReadyDatabaseEvent): Promise<DrizzleDatabase>;
|
|
23
|
+
export declare function closeDrizzle(event?: AiReadyDatabaseEvent): Promise<void>;
|
|
25
24
|
export {};
|
|
@@ -5,11 +5,16 @@ let fallbackClientPromise;
|
|
|
5
5
|
function createDrizzleClient(event) {
|
|
6
6
|
return import("#ai-ready-virtual/db-provider.mjs").then(({ createClient }) => createClient(event));
|
|
7
7
|
}
|
|
8
|
+
function getRequestOwner(event) {
|
|
9
|
+
return event.node?.req ?? event.req ?? event;
|
|
10
|
+
}
|
|
8
11
|
function getDrizzleWorkState(event) {
|
|
9
12
|
const context = event.context;
|
|
10
13
|
return context[DB_WORK_CONTEXT_KEY] ??= {
|
|
11
14
|
_tag: "ResponseOpen",
|
|
12
|
-
|
|
15
|
+
owner: getRequestOwner(event),
|
|
16
|
+
pending: /* @__PURE__ */ new Set(),
|
|
17
|
+
cleanup: () => closeDrizzle(event)
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
export function trackDrizzleWork(event, work) {
|
|
@@ -17,13 +22,15 @@ export function trackDrizzleWork(event, work) {
|
|
|
17
22
|
const tracked = work.finally(async () => {
|
|
18
23
|
state.pending.delete(tracked);
|
|
19
24
|
if (state._tag === "ResponseEnded" && state.pending.size === 0)
|
|
20
|
-
await
|
|
25
|
+
await state.cleanup();
|
|
21
26
|
});
|
|
22
27
|
state.pending.add(tracked);
|
|
23
28
|
return tracked;
|
|
24
29
|
}
|
|
25
30
|
export async function finishDrizzleResponse(event) {
|
|
26
31
|
const state = getDrizzleWorkState(event);
|
|
32
|
+
if (state.owner !== getRequestOwner(event))
|
|
33
|
+
return;
|
|
27
34
|
state._tag = "ResponseEnded";
|
|
28
35
|
if (state.pending.size === 0)
|
|
29
36
|
await closeDrizzle(event);
|
|
@@ -41,6 +48,7 @@ export async function useDrizzle(event) {
|
|
|
41
48
|
if (!event && fallbackClientPromise)
|
|
42
49
|
return fallbackClientPromise;
|
|
43
50
|
if (event?.context) {
|
|
51
|
+
getDrizzleWorkState(event);
|
|
44
52
|
const context = event.context;
|
|
45
53
|
const promise2 = createDrizzleClient(event).then((client) => {
|
|
46
54
|
context[DB_CONTEXT_KEY] = client;
|
|
@@ -65,6 +73,9 @@ export async function useDrizzle(event) {
|
|
|
65
73
|
export async function closeDrizzle(event) {
|
|
66
74
|
if (event?.context) {
|
|
67
75
|
const context = event.context;
|
|
76
|
+
const state = context[DB_WORK_CONTEXT_KEY];
|
|
77
|
+
if (state && state.owner !== getRequestOwner(event))
|
|
78
|
+
return;
|
|
68
79
|
const client = context[DB_CONTEXT_KEY] ?? await context[DB_PROMISE_CONTEXT_KEY];
|
|
69
80
|
if (!client)
|
|
70
81
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createClient(
|
|
1
|
+
import type { AiReadyDatabaseEvent } from '../../context.js';
|
|
2
|
+
export declare function createClient(_event?: AiReadyDatabaseEvent): Promise<{
|
|
3
3
|
dialect: "sqlite";
|
|
4
4
|
db: import("drizzle-orm/bun-sqlite").SQLiteBunDatabase<import("drizzle-orm").EmptyRelations> & {
|
|
5
5
|
$client: any;
|
|
@@ -4,8 +4,8 @@ import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
|
4
4
|
import { logger } from "../../../logger.js";
|
|
5
5
|
import { registerDriver } from "../raw.js";
|
|
6
6
|
import { resolveWritableDbPath } from "./dbPath.js";
|
|
7
|
-
export async function createClient(
|
|
8
|
-
const config = useRuntimeConfig(
|
|
7
|
+
export async function createClient(_event) {
|
|
8
|
+
const config = useRuntimeConfig()["nuxt-ai-ready"];
|
|
9
9
|
const dbPath = await resolveWritableDbPath(config.database.filename || ".data/ai-ready/pages.db");
|
|
10
10
|
logger.debug(`[drizzle] Opening Bun SQLite database: ${dbPath}`);
|
|
11
11
|
const sqlite = new Database(dbPath);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createClient(event?:
|
|
1
|
+
import type { AiReadyDatabaseEvent } from '../../context.js';
|
|
2
|
+
export declare function createClient(event?: AiReadyDatabaseEvent): Promise<{
|
|
3
3
|
dialect: "sqlite";
|
|
4
4
|
db: import("drizzle-orm/d1").DrizzleD1Database<import("drizzle-orm").EmptyRelations> & {
|
|
5
5
|
$client: any;
|
|
@@ -3,10 +3,11 @@ import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
|
3
3
|
import { logger } from "../../../logger.js";
|
|
4
4
|
import { registerDriver } from "../raw.js";
|
|
5
5
|
export async function createClient(event) {
|
|
6
|
-
const config = useRuntimeConfig(
|
|
6
|
+
const config = useRuntimeConfig()["nuxt-ai-ready"];
|
|
7
7
|
const bindingName = config.database.bindingName || "DB";
|
|
8
8
|
logger.debug(`[drizzle] Using D1 binding: ${bindingName}`);
|
|
9
|
-
const
|
|
9
|
+
const cloudflare = event?.context.cloudflare;
|
|
10
|
+
const cfEnv = cloudflare?.env;
|
|
10
11
|
const globalEnv = globalThis.__env__;
|
|
11
12
|
const d1 = cfEnv?.[bindingName] || globalEnv?.[bindingName];
|
|
12
13
|
if (!d1) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createClient(
|
|
1
|
+
import type { AiReadyDatabaseEvent } from '../../context.js';
|
|
2
|
+
export declare function createClient(_event?: AiReadyDatabaseEvent): Promise<{
|
|
3
3
|
dialect: "sqlite";
|
|
4
4
|
db: import("drizzle-orm/libsql").LibSQLDatabase<import("drizzle-orm").EmptyRelations> & {
|
|
5
5
|
$client: import("@libsql/client").Client;
|
|
@@ -4,8 +4,8 @@ import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
|
4
4
|
import { logger } from "../../../logger.js";
|
|
5
5
|
import { registerDriver } from "../raw.js";
|
|
6
6
|
import { resolveWritableDbPath } from "./dbPath.js";
|
|
7
|
-
export async function createClient(
|
|
8
|
-
const config = useRuntimeConfig(
|
|
7
|
+
export async function createClient(_event) {
|
|
8
|
+
const config = useRuntimeConfig()["nuxt-ai-ready"];
|
|
9
9
|
let dbUrl = config.database.url || `file:${config.database.filename || ".data/ai-ready/pages.db"}`;
|
|
10
10
|
if (dbUrl.startsWith("file:") && !dbUrl.startsWith("file://")) {
|
|
11
11
|
const resolved = await resolveWritableDbPath(dbUrl.slice("file:".length));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createClient(
|
|
1
|
+
import type { AiReadyDatabaseEvent } from '../../context.js';
|
|
2
|
+
export declare function createClient(_event?: AiReadyDatabaseEvent): Promise<{
|
|
3
3
|
dialect: "postgres";
|
|
4
4
|
db: import("drizzle-orm/neon-http").NeonHttpDatabase<import("drizzle-orm").EmptyRelations> & {
|
|
5
5
|
$client: import("@neondatabase/serverless").NeonQueryFunction<false, false>;
|
|
@@ -3,8 +3,8 @@ import { drizzle } from "drizzle-orm/neon-http";
|
|
|
3
3
|
import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
4
4
|
import { logger } from "../../../logger.js";
|
|
5
5
|
import { registerDriver } from "../raw.js";
|
|
6
|
-
export async function createClient(
|
|
7
|
-
const config = useRuntimeConfig(
|
|
6
|
+
export async function createClient(_event) {
|
|
7
|
+
const config = useRuntimeConfig()["nuxt-ai-ready"];
|
|
8
8
|
const connectionString = config.database.url || process.env.POSTGRES_URL || process.env.DATABASE_URL;
|
|
9
9
|
if (!connectionString) {
|
|
10
10
|
throw new Error("[ai-ready] Missing database URL. Set POSTGRES_URL or configure database.url");
|