nuxt-ai-ready 3.6.1 → 3.6.2
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/agent-skills-config-CmZq9uWW.mjs +18 -0
- package/dist/agent-skills-zGLgFB6H.mjs +468 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +656 -570
- package/dist/devtools/pages/ai-ready/debug.vue +9 -3
- package/dist/devtools/pages/ai-ready/index.vue +3 -1
- package/dist/devtools/pages/ai-ready/llms-txt.vue +15 -4
- package/dist/devtools/pages/ai-ready.vue +28 -4
- package/dist/module.d.mts +106 -112
- package/dist/module.json +3 -3
- package/dist/module.mjs +2732 -26
- package/dist/package-metadata-B1darl8W.mjs +28 -0
- package/dist/prerender-QMv07W4h.mjs +650 -0
- package/dist/runtime/app/composables/webmcp.js +90 -97
- package/dist/runtime/app/plugins/md-alternate.server.js +29 -26
- package/dist/runtime/app/plugins/md-hints.prerender.js +13 -15
- package/dist/runtime/app/plugins/webmcp.client.js +49 -53
- package/dist/runtime/app/webmcp-config.js +2 -2
- package/dist/runtime/cache-control.js +16 -10
- package/dist/runtime/i18n-url.js +6 -6
- package/dist/runtime/index.js +4 -12
- package/dist/runtime/llms-txt-directive.js +20 -13
- package/dist/runtime/llms-txt-files.js +188 -187
- package/dist/runtime/llms-txt-format.js +54 -55
- package/dist/runtime/llms-txt-i18n.js +22 -19
- package/dist/runtime/llms-txt-utils.js +140 -95
- package/dist/runtime/markdown-links.js +45 -39
- package/dist/runtime/markdown-path.js +29 -9
- package/dist/runtime/markdown-text.js +2 -1
- package/dist/runtime/mcp.js +5 -1
- package/dist/runtime/route-path.js +14 -8
- package/dist/runtime/server/db/drizzle/client.js +71 -75
- package/dist/runtime/server/db/drizzle/index.js +16 -28
- package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -1
- package/dist/runtime/server/db/drizzle/providers/bun.js +10 -7
- package/dist/runtime/server/db/drizzle/providers/d1.js +16 -13
- package/dist/runtime/server/db/drizzle/providers/dbPath.js +60 -37
- package/dist/runtime/server/db/drizzle/providers/libsql.js +23 -11
- package/dist/runtime/server/db/drizzle/providers/neon.js +13 -10
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +10 -7
- package/dist/runtime/server/db/drizzle/providers/postgres.js +13 -10
- package/dist/runtime/server/db/drizzle/queries.js +633 -532
- package/dist/runtime/server/db/drizzle/raw.js +200 -176
- package/dist/runtime/server/db/index.js +3 -0
- package/dist/runtime/server/db/queries.js +816 -607
- package/dist/runtime/server/db/schema/postgres.js +56 -50
- package/dist/runtime/server/db/schema/sqlite.js +56 -50
- package/dist/runtime/server/db/schema-sql.js +35 -38
- package/dist/runtime/server/db/seed.js +60 -45
- package/dist/runtime/server/db/shared.js +300 -213
- package/dist/runtime/server/index.js +1 -17
- package/dist/runtime/server/mcp/cache-key.js +5 -1
- package/dist/runtime/server/mcp/resources/pages.js +32 -33
- package/dist/runtime/server/mcp/tools/get-page-markdown.js +41 -27
- package/dist/runtime/server/mcp/tools/list-pages.js +40 -34
- package/dist/runtime/server/mcp/tools/search-pages.js +24 -16
- package/dist/runtime/server/middleware/markdown.d.ts +1 -1
- package/dist/runtime/server/middleware/markdown.js +15 -13
- package/dist/runtime/server/middleware/markdown.prerender.d.ts +1 -1
- package/dist/runtime/server/middleware/markdown.prerender.js +135 -119
- package/dist/runtime/server/middleware/render-markdown.d.ts +1 -1
- package/dist/runtime/server/middleware/render-markdown.js +164 -144
- package/dist/runtime/server/plugins/ai-terms.d.ts +1 -1
- package/dist/runtime/server/plugins/ai-terms.js +4 -8
- package/dist/runtime/server/plugins/content-signal-capture-nitro3.prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/content-signal-capture-nitro3.prerender.js +7 -8
- package/dist/runtime/server/plugins/content-signal-capture.prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/content-signal-capture.prerender.js +7 -7
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +1 -1
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +13 -14
- package/dist/runtime/server/plugins/db-lifecycle.js +13 -11
- package/dist/runtime/server/plugins/html-capture.prerender.js +6 -6
- package/dist/runtime/server/plugins/link-header-nitro3.d.ts +1 -1
- package/dist/runtime/server/plugins/link-header-nitro3.js +23 -13
- package/dist/runtime/server/plugins/link-header.d.ts +1 -1
- package/dist/runtime/server/plugins/link-header.js +30 -30
- package/dist/runtime/server/plugins/llms-txt-directive-html.d.ts +1 -1
- package/dist/runtime/server/plugins/llms-txt-directive-html.js +4 -3
- package/dist/runtime/server/plugins/markdown-negotiation.d.ts +1 -1
- package/dist/runtime/server/plugins/markdown-negotiation.js +64 -45
- package/dist/runtime/server/plugins/sitemap-seeder.js +144 -112
- package/dist/runtime/server/routes/__ai-ready/cron.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/cron.get.js +17 -11
- package/dist/runtime/server/routes/__ai-ready/devtools.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/devtools.get.js +60 -45
- package/dist/runtime/server/routes/__ai-ready/pages.get.d.ts +36 -1
- package/dist/runtime/server/routes/__ai-ready/pages.get.js +44 -40
- package/dist/runtime/server/routes/__ai-ready/poll.post.d.ts +15 -1
- package/dist/runtime/server/routes/__ai-ready/poll.post.js +30 -30
- package/dist/runtime/server/routes/__ai-ready/prune.post.d.ts +13 -1
- package/dist/runtime/server/routes/__ai-ready/prune.post.js +29 -15
- package/dist/runtime/server/routes/__ai-ready/reindex.post.d.ts +22 -1
- package/dist/runtime/server/routes/__ai-ready/reindex.post.js +31 -21
- package/dist/runtime/server/routes/__ai-ready/restore.post.d.ts +4 -1
- package/dist/runtime/server/routes/__ai-ready/restore.post.js +28 -22
- package/dist/runtime/server/routes/__ai-ready/status.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/status.get.js +52 -53
- package/dist/runtime/server/routes/__ai-ready-debug.get.d.ts +83 -1
- package/dist/runtime/server/routes/__ai-ready-debug.get.js +209 -189
- package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-artifact.js +16 -14
- package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-index.js +8 -6
- package/dist/runtime/server/routes/ai-catalog.js +19 -19
- package/dist/runtime/server/routes/ai-terms.js +23 -19
- package/dist/runtime/server/routes/api-catalog.js +23 -23
- package/dist/runtime/server/routes/llms-full.txt.get.d.ts +1 -1
- package/dist/runtime/server/routes/llms-full.txt.get.js +42 -41
- package/dist/runtime/server/routes/llms.txt.get.d.ts +1 -1
- package/dist/runtime/server/routes/llms.txt.get.js +38 -33
- package/dist/runtime/server/routes/mcp-server-card.js +19 -19
- package/dist/runtime/server/routes/sitemap.md.get.d.ts +1 -1
- package/dist/runtime/server/routes/sitemap.md.get.js +38 -39
- package/dist/runtime/server/tasks/ai-ready-cron.d.ts +1 -1
- package/dist/runtime/server/tasks/ai-ready-cron.js +17 -14
- package/dist/runtime/server/utils/auth.js +76 -53
- package/dist/runtime/server/utils/batchIndex.js +72 -60
- package/dist/runtime/server/utils/checkStale.js +181 -134
- package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -20
- package/dist/runtime/server/utils/cloudflare.js +69 -51
- package/dist/runtime/server/utils/content-negotiation.js +30 -18
- package/dist/runtime/server/utils/content.js +4 -1
- package/dist/runtime/server/utils/context.js +30 -19
- package/dist/runtime/server/utils/cron-plan.js +6 -6
- package/dist/runtime/server/utils/discovery-response.js +5 -6
- package/dist/runtime/server/utils/fetch.js +2 -1
- package/dist/runtime/server/utils/frontmatter.js +44 -57
- package/dist/runtime/server/utils/i18n.js +3 -8
- package/dist/runtime/server/utils/indexPage.js +152 -113
- package/dist/runtime/server/utils/keywords.js +278 -277
- package/dist/runtime/server/utils/link-header.js +67 -56
- package/dist/runtime/server/utils/llms-full.js +39 -49
- package/dist/runtime/server/utils/markdown-redirect.js +26 -14
- package/dist/runtime/server/utils/markdown-request.js +62 -47
- package/dist/runtime/server/utils/negotiation-decision.d.ts +8 -0
- package/dist/runtime/server/utils/negotiation-decision.js +106 -34
- package/dist/runtime/server/utils/negotiation-response.d.ts +1 -1
- package/dist/runtime/server/utils/negotiation-response.js +195 -144
- package/dist/runtime/server/utils/page-updated-at.js +23 -15
- package/dist/runtime/server/utils/prerender-html.js +31 -17
- package/dist/runtime/server/utils/runCron.js +263 -192
- package/dist/runtime/server/utils/sitemap-crawl-state.js +57 -39
- package/dist/runtime/server/utils/sitemap-lastmod.js +16 -14
- package/dist/runtime/server/utils/sitemap-md.js +39 -50
- package/dist/runtime/server/utils/sitemap-routes.js +7 -7
- package/dist/runtime/server/utils/sitemap.js +459 -414
- package/dist/runtime/server/utils.js +141 -122
- package/dist/runtime/site-tool-catalog.js +39 -43
- package/dist/runtime/site-tool-config.js +1 -0
- package/dist/runtime/sync-secret.js +11 -11
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/webmcp-site-tools.js +278 -250
- package/dist/runtime/webmcp.js +53 -42
- package/dist/static-headers-G7hFL3wE.mjs +328 -0
- package/dist/types.d.mts +1 -9
- package/package.json +18 -22
- package/skills/nuxt-ai-ready/SKILL.md +8 -2
- package/dist/chunks/agent-skills.mjs +0 -383
- package/dist/chunks/prerender.mjs +0 -683
- package/dist/shared/nuxt-ai-ready.Bzx0dNWj.mjs +0 -3034
- package/dist/shared/nuxt-ai-ready.DCd-1s1G.mjs +0 -29
|
@@ -1,189 +1,213 @@
|
|
|
1
1
|
import { useDrizzle } from "./client.js";
|
|
2
|
-
|
|
2
|
+
// Store underlying driver references alongside Drizzle instance
|
|
3
|
+
const driverCache = new WeakMap();
|
|
4
|
+
/**
|
|
5
|
+
* Register the underlying driver for raw SQL access
|
|
6
|
+
*/
|
|
3
7
|
export function registerDriver(db, type, driver) {
|
|
4
|
-
|
|
8
|
+
driverCache.set(db, {
|
|
9
|
+
type,
|
|
10
|
+
driver
|
|
11
|
+
});
|
|
5
12
|
}
|
|
6
13
|
const RE_PARAM_PLACEHOLDER = /\?/g;
|
|
14
|
+
/**
|
|
15
|
+
* Remote drivers pay a network round-trip per statement. Their batch or
|
|
16
|
+
* transaction interface keeps chunks ordered and avoids oversized requests.
|
|
17
|
+
* Local drivers wrap each batch in a transaction for the same interface.
|
|
18
|
+
*/
|
|
7
19
|
const MAX_BATCH_STATEMENTS = 100;
|
|
8
20
|
function toPostgresQuery(query) {
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
let index = 0;
|
|
22
|
+
return query.replace(RE_PARAM_PLACEHOLDER, () => `$${++index}`);
|
|
11
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Get raw SQL executor for a Drizzle client
|
|
26
|
+
*/
|
|
12
27
|
export function getRawExecutor(client) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
28
|
+
const cached = driverCache.get(client.db);
|
|
29
|
+
if (!cached) {
|
|
30
|
+
throw new Error("[ai-ready] Raw driver not registered. This is a bug.");
|
|
31
|
+
}
|
|
32
|
+
const { type, driver } = cached;
|
|
33
|
+
return {
|
|
34
|
+
dialect: client.dialect,
|
|
35
|
+
async all(query, params = []) {
|
|
36
|
+
switch (type) {
|
|
37
|
+
case "better-sqlite3": {
|
|
38
|
+
const db = driver;
|
|
39
|
+
return db.prepare(query).all(...params);
|
|
40
|
+
}
|
|
41
|
+
case "node-sqlite": {
|
|
42
|
+
const db = driver;
|
|
43
|
+
return db.prepare(query).all(...params);
|
|
44
|
+
}
|
|
45
|
+
case "libsql": {
|
|
46
|
+
const client = driver;
|
|
47
|
+
const result = await client.execute({
|
|
48
|
+
sql: query,
|
|
49
|
+
args: params
|
|
50
|
+
});
|
|
51
|
+
return result.rows;
|
|
52
|
+
}
|
|
53
|
+
case "d1": {
|
|
54
|
+
const db = driver;
|
|
55
|
+
const result = await db.prepare(query).bind(...params).all();
|
|
56
|
+
return result.results;
|
|
57
|
+
}
|
|
58
|
+
case "neon": {
|
|
59
|
+
const sqlFn = driver;
|
|
60
|
+
const result = await sqlFn.query(toPostgresQuery(query), params);
|
|
61
|
+
return result.rows || result;
|
|
62
|
+
}
|
|
63
|
+
case "postgres": {
|
|
64
|
+
const sqlClient = driver;
|
|
65
|
+
return await sqlClient.unsafe(toPostgresQuery(query), params);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
async first(query, params = []) {
|
|
70
|
+
const rows = await this.all(query, params);
|
|
71
|
+
return rows[0];
|
|
72
|
+
},
|
|
73
|
+
async exec(query, params = []) {
|
|
74
|
+
switch (type) {
|
|
75
|
+
case "better-sqlite3": {
|
|
76
|
+
const db = driver;
|
|
77
|
+
db.prepare(query).run(...params);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case "node-sqlite": {
|
|
81
|
+
const db = driver;
|
|
82
|
+
db.prepare(query).run(...params);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "libsql": {
|
|
86
|
+
const client = driver;
|
|
87
|
+
await client.execute({
|
|
88
|
+
sql: query,
|
|
89
|
+
args: params
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "d1": {
|
|
94
|
+
const db = driver;
|
|
95
|
+
await db.prepare(query).bind(...params).run();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "neon": {
|
|
99
|
+
const sqlFn = driver;
|
|
100
|
+
await sqlFn.query(toPostgresQuery(query), params);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case "postgres": {
|
|
104
|
+
const sqlClient = driver;
|
|
105
|
+
await sqlClient.unsafe(toPostgresQuery(query), params);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Execute many statements in as few round-trips as the driver allows.
|
|
112
|
+
* Statements run in order; on a remote driver each chunk is one request.
|
|
113
|
+
*/
|
|
114
|
+
async batch(queries) {
|
|
115
|
+
if (queries.length === 0) return;
|
|
116
|
+
switch (type) {
|
|
117
|
+
case "better-sqlite3": {
|
|
118
|
+
const sqlite = driver;
|
|
119
|
+
const tx = sqlite.transaction(() => {
|
|
120
|
+
for (const q of queries) sqlite.prepare(q.sql).run(...q.params || []);
|
|
121
|
+
});
|
|
122
|
+
tx();
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case "node-sqlite": {
|
|
126
|
+
const sqlite = driver;
|
|
127
|
+
sqlite.exec("BEGIN");
|
|
128
|
+
try {
|
|
129
|
+
for (const q of queries) sqlite.prepare(q.sql).run(...q.params || []);
|
|
130
|
+
sqlite.exec("COMMIT");
|
|
131
|
+
} catch (error) {
|
|
132
|
+
sqlite.exec("ROLLBACK");
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case "libsql": {
|
|
138
|
+
const client = driver;
|
|
139
|
+
for (let i = 0; i < queries.length; i += MAX_BATCH_STATEMENTS) {
|
|
140
|
+
const chunk = queries.slice(i, i + MAX_BATCH_STATEMENTS);
|
|
141
|
+
await client.batch(chunk.map((q) => ({
|
|
142
|
+
sql: q.sql,
|
|
143
|
+
args: q.params || []
|
|
144
|
+
})));
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case "d1": {
|
|
149
|
+
const db = driver;
|
|
150
|
+
for (let i = 0; i < queries.length; i += MAX_BATCH_STATEMENTS) {
|
|
151
|
+
const chunk = queries.slice(i, i + MAX_BATCH_STATEMENTS);
|
|
152
|
+
await db.batch(chunk.map((q) => db.prepare(q.sql).bind(...q.params || [])));
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case "neon": {
|
|
157
|
+
const sqlFn = driver;
|
|
158
|
+
for (let i = 0; i < queries.length; i += MAX_BATCH_STATEMENTS) {
|
|
159
|
+
const chunk = queries.slice(i, i + MAX_BATCH_STATEMENTS);
|
|
160
|
+
await sqlFn.transaction((tx) => chunk.map((q) => tx.query(toPostgresQuery(q.sql), q.params || [])));
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case "postgres": {
|
|
165
|
+
const sqlClient = driver;
|
|
166
|
+
for (let i = 0; i < queries.length; i += MAX_BATCH_STATEMENTS) {
|
|
167
|
+
const chunk = queries.slice(i, i + MAX_BATCH_STATEMENTS);
|
|
168
|
+
await sqlClient.begin((transaction) => Promise.all(chunk.map((q) => transaction.unsafe(toPostgresQuery(q.sql), q.params || []))));
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
156
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Get raw SQL executor from event context or create new one
|
|
178
|
+
*/
|
|
157
179
|
export async function useRawDb(event) {
|
|
158
|
-
|
|
159
|
-
|
|
180
|
+
const client = await useDrizzle(event);
|
|
181
|
+
return getRawExecutor(client);
|
|
160
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Close underlying database driver connection
|
|
185
|
+
*/
|
|
161
186
|
export async function closeDriver(db) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
driverCache.delete(db);
|
|
187
|
+
const cached = driverCache.get(db);
|
|
188
|
+
if (!cached) return;
|
|
189
|
+
const { type, driver } = cached;
|
|
190
|
+
switch (type) {
|
|
191
|
+
case "better-sqlite3": {
|
|
192
|
+
const sqlite = driver;
|
|
193
|
+
sqlite.close?.();
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case "node-sqlite": {
|
|
197
|
+
const sqlite = driver;
|
|
198
|
+
sqlite.close?.();
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case "libsql": {
|
|
202
|
+
const client = driver;
|
|
203
|
+
client.close?.();
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "postgres": {
|
|
207
|
+
const sqlClient = driver;
|
|
208
|
+
await sqlClient.end();
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
driverCache.delete(db);
|
|
189
213
|
}
|