@vite-hub/kv 0.5.0 → 0.5.1
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 +1 -1
- package/dist/{batch--v0ri69O.js → batch-D-ib5_0P.js} +0 -1
- package/dist/{cli-CLomw9ml.d.ts → cli-BvVInMht.d.ts} +0 -6
- package/dist/cli.d.ts +2 -4
- package/dist/cli.js +5 -6
- package/dist/{cloudflare-env-Dl349h_9.js → cloudflare-env-Bm6huR35.js} +2 -3
- package/dist/{cloudflare-env-lookup-Bs0VDpU5.js → cloudflare-env-lookup-Dgq5n1Aq.js} +1 -2
- package/dist/{cloudflare-kv-DQJhmGof.js → cloudflare-kv-K2MzfP6D.js} +8 -10
- package/dist/{cloudflare-kv-local-COjgHweC.js → cloudflare-kv-local-lov9LLhU.js} +5 -6
- package/dist/{config-pfyPiPrI.js → config-B8FRGmX_.js} +7 -11
- package/dist/{create-storage-DQ1BbFqH.js → create-storage-BMvkkYdM.js} +9 -15
- package/dist/{cursor-history-CAT4mpP1.js → cursor-history-C6oG12QO.js} +3 -4
- package/dist/{deno-kv-Cf0ZveeN.js → deno-kv-MnqlNH1e.js} +4 -5
- package/dist/{dev-peer-CHafxbtj.js → dev-peer-D0vOxmrD.js} +1 -2
- package/dist/{driver-Du6Eh9p2.d.ts → driver-bLMl-wMO.d.ts} +2 -6
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{error-diagnostics-C4VTHInS.js → error-diagnostics-DUIp6FhO.js} +1 -2
- package/dist/{errors-BpiM-Vmh.js → errors-IaVOqzAs.js} +4 -7
- package/dist/errors.d.ts +2 -6
- package/dist/errors.js +1 -2
- package/dist/fs-lite-DhXLUL-H.js +1 -0
- package/dist/{fs-lite-BTcBUP6B.js → fs-lite-fvNdBEr9.js} +3 -5
- package/dist/index.d.ts +1 -3
- package/dist/index.js +16 -20
- package/dist/{inspect-BIKQsqX4.js → inspect-BWMcVWD8.js} +2 -4
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
- package/dist/{operations-nAaONxzh.js → operations-CGAX5ASA.js} +15 -20
- package/dist/{operations-CqKs7Ykc.js → operations-FgS_sJ3M.js} +7 -10
- package/dist/operations.d.ts +2 -8
- package/dist/operations.js +8 -12
- package/dist/{out-BbXG-yVX.js → out-By90R-Bo.js} +3345 -2394
- package/dist/{redis-shared-1M0IaguQ.js → redis-shared-DO7Ib1Sz.js} +2 -3
- package/dist/{request-log-Dj9Vw7qG.js → request-log-DllKQXj7.js} +1 -2
- package/dist/{results-D6jfPtCk.js → results-emgN7uDS.js} +1 -2
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
- package/dist/runtime/cloudflare-kv.d.ts +1 -3
- package/dist/runtime/cloudflare-kv.js +1 -2
- package/dist/runtime/cloudflare-request-env.d.ts +1 -3
- package/dist/runtime/cloudflare-request-env.js +2 -3
- package/dist/runtime/database.d.ts +1 -1
- package/dist/runtime/database.js +5 -6
- package/dist/runtime/nitro-plugin.d.ts +1 -2
- package/dist/runtime/nitro-plugin.js +3 -4
- package/dist/runtime/redis-driver.d.ts +3 -5
- package/dist/runtime/redis-driver.js +6 -7
- package/dist/runtime/unstorage-driver.d.ts +2 -4
- package/dist/runtime/unstorage-driver.js +2 -3
- package/dist/runtime/upstash-driver.d.ts +3 -5
- package/dist/runtime/upstash-driver.js +6 -7
- package/dist/{types-Bj3EQoRg.d.ts → types-BUb0FcjM.d.ts} +0 -2
- package/dist/{types-Cp6IBhSN.d.ts → types-C397WKyf.d.ts} +1 -3
- package/dist/{upstash-5sTbIR35.js → upstash-DQVo1zbz.js} +3 -4
- package/dist/{utils2-FozcTsmb.js → utils2-By8eee1x.js} +1 -2
- package/dist/vite.d.ts +3 -17
- package/dist/vite.js +1429 -913
- package/package.json +10 -10
- package/dist/fs-lite-C8yXCVDM.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
2
|
+
// src/runtime/redis-shared.ts
|
|
3
3
|
const redisIncrementScript = `
|
|
4
4
|
local existed = redis.call('EXISTS', KEYS[1])
|
|
5
5
|
local current = redis.call('GET', KEYS[1])
|
|
@@ -90,5 +90,4 @@ function createPortableRedisKeyLister(provider, scan) {
|
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
//#endregion
|
|
94
93
|
export { redisIncrementScript as a, redisIncrementResult as i, escapeRedisGlob as n, redisTTLSeconds as o, redisDeleteIfEqualsScript as r, createPortableRedisKeyLister as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/runtime/request-log.ts
|
|
2
2
|
function isRequestLog(value) {
|
|
3
3
|
return value !== null && typeof value === "object" && typeof Reflect.get(value, "set") === "function" && typeof Reflect.get(value, "warn") === "function" && typeof Reflect.get(value, "error") === "function";
|
|
4
4
|
}
|
|
@@ -101,5 +101,4 @@ function logFailure(failure, fallback) {
|
|
|
101
101
|
fallback();
|
|
102
102
|
} catch {}
|
|
103
103
|
}
|
|
104
|
-
//#endregion
|
|
105
104
|
export { logFailure as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
12
|
key = keys[i];
|
|
@@ -22,5 +22,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
25
|
-
//#endregion
|
|
26
25
|
export { __require as n, __toESM as r, __commonJSMin as t };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { t as KVRuntimeDriver } from "../driver-
|
|
2
|
-
//#region src/runtime/cloudflare-kv.d.ts
|
|
1
|
+
import { t as KVRuntimeDriver } from "../driver-bLMl-wMO.js";
|
|
3
2
|
declare function createCloudflareDriver(options: Record<string, unknown>): KVRuntimeDriver;
|
|
4
3
|
export declare function createCloudflareKVStorage(options: Record<string, unknown>): unknown;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { createCloudflareDriver as default };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createCloudflareKVStorage, createCloudflareDriver as default };
|
|
1
|
+
export { n as createCloudflareKVStorage, t as default } from "../cloudflare-kv-K2MzfP6D.js";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/runtime/cloudflare-request-env.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Nitro middleware for Cloudflare KV. A Cloudflare KV store reads its binding from the active env, and only the request
|
|
4
3
|
* carries that env in `vite dev`, so the middleware installs it before the route runs.
|
|
5
4
|
*/
|
|
6
|
-
export default function vitehubKVCloudflareRequestEnv(event: unknown): void;
|
|
7
|
-
//#endregion
|
|
5
|
+
export default function vitehubKVCloudflareRequestEnv(event: unknown): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as installCloudflareRequestEnv } from "../cloudflare-env-
|
|
2
|
-
|
|
1
|
+
import { r as installCloudflareRequestEnv } from "../cloudflare-env-Bm6huR35.js";
|
|
2
|
+
// src/runtime/cloudflare-request-env.ts
|
|
3
3
|
/**
|
|
4
4
|
* Nitro middleware for Cloudflare KV. A Cloudflare KV store reads its binding from the active env, and only the request
|
|
5
5
|
* carries that env in `vite dev`, so the middleware installs it before the route runs.
|
|
@@ -7,5 +7,4 @@ import { r as installCloudflareRequestEnv } from "../cloudflare-env-Dl349h_9.js"
|
|
|
7
7
|
function vitehubKVCloudflareRequestEnv(event) {
|
|
8
8
|
installCloudflareRequestEnv(event);
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { vitehubKVCloudflareRequestEnv as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createDatabaseKVDriver, i as KVSqlParam, n as KVDatabases, o as kvSqlClientFromDatabase, r as KVSqlClient, s as kvTable } from "../driver-
|
|
1
|
+
import { a as createDatabaseKVDriver, i as KVSqlParam, n as KVDatabases, o as kvSqlClientFromDatabase, r as KVSqlClient, s as kvTable } from "../driver-bLMl-wMO.js";
|
|
2
2
|
export { KVDatabases, KVSqlClient, KVSqlParam, createDatabaseKVDriver as default, kvSqlClientFromDatabase, kvTable };
|
package/dist/runtime/database.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as d1PrimaryClient } from "../cloudflare-env-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
|
|
1
|
+
import { t as logFailure } from "../request-log-DllKQXj7.js";
|
|
2
|
+
import { t as d1PrimaryClient } from "../cloudflare-env-Bm6huR35.js";
|
|
3
|
+
import { n as kvErrorDiagnostics } from "../error-diagnostics-DUIp6FhO.js";
|
|
4
|
+
import { t as chunks } from "../batch-D-ib5_0P.js";
|
|
5
|
+
// src/runtime/database.ts
|
|
6
6
|
/** The table that keeps the keys of every `database` store. Each store has its rows under its own `namespace`. */
|
|
7
7
|
const kvTable = "vitehub_kv";
|
|
8
8
|
function isD1HttpClient(value) {
|
|
@@ -277,5 +277,4 @@ function createDatabaseKVDriver(options, connect, table = kvTable) {
|
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
|
-
//#endregion
|
|
281
280
|
export { createDatabaseKVDriver as default, kvSqlClientFromDatabase, kvTable };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/nitro-plugin.d.ts
|
|
2
1
|
interface NitroAppLike {
|
|
3
2
|
hooks: {
|
|
4
3
|
hook(name: "close", callback: () => Promise<void>): unknown;
|
|
@@ -9,4 +8,4 @@ interface NitroAppLike {
|
|
|
9
8
|
* so the process can exit.
|
|
10
9
|
*/
|
|
11
10
|
export default function kvNitroPlugin(nitroApp: NitroAppLike): void;
|
|
12
|
-
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
1
|
+
import { t as logFailure } from "../request-log-DllKQXj7.js";
|
|
2
|
+
import { t as kvInferredStoreNotice } from "../config-B8FRGmX_.js";
|
|
3
3
|
import { disposeKVStores } from "@vite-hub/kv";
|
|
4
|
-
|
|
4
|
+
// src/runtime/nitro-plugin.ts
|
|
5
5
|
async function logInferredStores() {
|
|
6
6
|
const { durabilityReportsStores, kv } = await import("#vitehub/kv/config");
|
|
7
7
|
if (!kv || durabilityReportsStores) return;
|
|
@@ -25,5 +25,4 @@ function kvNitroPlugin(nitroApp) {
|
|
|
25
25
|
}, () => console.warn("[vitehub] Could not read the KV configuration.", error));
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { kvNitroPlugin as default };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { z as ResolvedRedisKVStoreConfig } from "../types-
|
|
2
|
-
import { t as KVRuntimeDriver } from "../driver-
|
|
3
|
-
//#region src/runtime/redis-driver.d.ts
|
|
1
|
+
import { z as ResolvedRedisKVStoreConfig } from "../types-C397WKyf.js";
|
|
2
|
+
import { t as KVRuntimeDriver } from "../driver-bLMl-wMO.js";
|
|
4
3
|
/** The URL of a store: `env:<NAME>` reads the variable now, so a build never holds the URL of its server. */
|
|
5
4
|
export declare function resolveRedisUrl(url: string, env?: Record<string, string | undefined>): string;
|
|
6
5
|
/**
|
|
7
6
|
* KV over a Redis server through TCP, with `ioredis`. Each atomic operation is one command or one script. This module
|
|
8
7
|
* loads only for a Redis store, so other stores do not load `ioredis`.
|
|
9
8
|
*/
|
|
10
|
-
export default function createRedisKVDriver(options: ResolvedRedisKVStoreConfig): KVRuntimeDriver;
|
|
11
|
-
//#endregion
|
|
9
|
+
export default function createRedisKVDriver(options: ResolvedRedisKVStoreConfig): KVRuntimeDriver;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as invariant } from "../invariant-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as chunks } from "../batch
|
|
5
|
-
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-
|
|
1
|
+
import { t as invariant } from "../invariant-Dj2R1eMr.js";
|
|
2
|
+
import { o as normalizeKey } from "../utils2-By8eee1x.js";
|
|
3
|
+
import { n as kvErrorDiagnostics } from "../error-diagnostics-DUIp6FhO.js";
|
|
4
|
+
import { t as chunks } from "../batch-D-ib5_0P.js";
|
|
5
|
+
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-DO7Ib1Sz.js";
|
|
6
6
|
import { Redis } from "ioredis";
|
|
7
|
-
|
|
7
|
+
// src/runtime/redis-driver.ts
|
|
8
8
|
/** The URL of a store: `env:<NAME>` reads the variable now, so a build never holds the URL of its server. */
|
|
9
9
|
function resolveRedisUrl(url, env = globalThis.process?.env ?? {}) {
|
|
10
10
|
if (!url.startsWith("env:")) return url;
|
|
@@ -106,5 +106,4 @@ function createRedisKVDriver(options) {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { createRedisKVDriver as default, resolveRedisUrl };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as Driver } from "../types-
|
|
2
|
-
//#region src/runtime/unstorage-driver.d.ts
|
|
1
|
+
import { t as Driver } from "../types-BUb0FcjM.js";
|
|
3
2
|
export interface KVStorageDriverOptions {
|
|
4
3
|
/** The named KV store. Default: the default store. */
|
|
5
4
|
store?: string;
|
|
@@ -10,5 +9,4 @@ export interface KVStorageDriverOptions {
|
|
|
10
9
|
* Unstorage driver over one KV store, for Nitro storage mounts such as `kv` and `cache`.
|
|
11
10
|
* It resolves the store on each call, so a Cloudflare store uses the binding of the current request.
|
|
12
11
|
*/
|
|
13
|
-
export default function createKVStorageDriver(options?: KVStorageDriverOptions): Driver<KVStorageDriverOptions>;
|
|
14
|
-
//#endregion
|
|
12
|
+
export default function createKVStorageDriver(options?: KVStorageDriverOptions): Driver<KVStorageDriverOptions>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeKey } from "../utils2-
|
|
1
|
+
import { o as normalizeKey } from "../utils2-By8eee1x.js";
|
|
2
2
|
import { kv } from "@vite-hub/kv";
|
|
3
|
-
|
|
3
|
+
// src/runtime/unstorage-driver.ts
|
|
4
4
|
async function unwrap(pending) {
|
|
5
5
|
const [error, value] = await pending;
|
|
6
6
|
if (error) throw error;
|
|
@@ -33,5 +33,4 @@ function createKVStorageDriver(options = {}) {
|
|
|
33
33
|
clear: (keyBase) => unwrap(store().clear({ prefix: below(keyBase) }))
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { createKVStorageDriver as default };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { B as ResolvedUpstashKVStoreConfig } from "../types-
|
|
2
|
-
import { t as KVRuntimeDriver } from "../driver-
|
|
3
|
-
|
|
4
|
-
export default function createUpstashKVDriver(options: ResolvedUpstashKVStoreConfig): KVRuntimeDriver;
|
|
5
|
-
//#endregion
|
|
1
|
+
import { B as ResolvedUpstashKVStoreConfig } from "../types-C397WKyf.js";
|
|
2
|
+
import { t as KVRuntimeDriver } from "../driver-bLMl-wMO.js";
|
|
3
|
+
export default function createUpstashKVDriver(options: ResolvedUpstashKVStoreConfig): KVRuntimeDriver;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as invariant } from "../invariant-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as chunks } from "../batch
|
|
5
|
-
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-
|
|
1
|
+
import { t as invariant } from "../invariant-Dj2R1eMr.js";
|
|
2
|
+
import { o as normalizeKey } from "../utils2-By8eee1x.js";
|
|
3
|
+
import { n as kvErrorDiagnostics } from "../error-diagnostics-DUIp6FhO.js";
|
|
4
|
+
import { t as chunks } from "../batch-D-ib5_0P.js";
|
|
5
|
+
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-DO7Ib1Sz.js";
|
|
6
6
|
import createDriver from "unstorage/drivers/upstash";
|
|
7
|
-
|
|
7
|
+
// src/runtime/upstash-driver.ts
|
|
8
8
|
const keyBatchSize = 1e3;
|
|
9
9
|
function createUpstashKVDriver(options) {
|
|
10
10
|
const base = normalizeKey(options.base);
|
|
@@ -63,5 +63,4 @@ function createUpstashKVDriver(options) {
|
|
|
63
63
|
});
|
|
64
64
|
return driver;
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { createUpstashKVDriver as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/types.d.mts
|
|
2
1
|
type StorageValue = null | string | number | boolean | object;
|
|
3
2
|
type WatchEvent = "update" | "remove";
|
|
4
3
|
type WatchCallback = (event: WatchEvent, key: string) => any;
|
|
@@ -65,5 +64,4 @@ interface Driver<OptionsT = any, InstanceT = any> {
|
|
|
65
64
|
dispose?: () => MaybePromise<void>;
|
|
66
65
|
watch?: (callback: WatchCallback) => MaybePromise<Unwatch>;
|
|
67
66
|
}
|
|
68
|
-
//#endregion
|
|
69
67
|
export { TransactionOptions as i, GetItemType as n, GetItemTypeMap as r, Driver as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as GetItemType, r as GetItemTypeMap } from "./types-
|
|
1
|
+
import { n as GetItemType, r as GetItemTypeMap } from "./types-BUb0FcjM.js";
|
|
2
2
|
import { Duration, Result } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
type KVDriver = "cloudflare" | "database" | "deno-kv" | "fs-lite" | "redis" | "upstash";
|
|
5
4
|
/**
|
|
6
5
|
* The atomic operations of each driver. A store returns `KV_UNSUPPORTED_OPERATION` for an atomic operation that its
|
|
@@ -307,5 +306,4 @@ interface ReadonlyKVStorage {
|
|
|
307
306
|
has: KVStorage["has"];
|
|
308
307
|
list: KVStorage["list"];
|
|
309
308
|
}
|
|
310
|
-
//#endregion
|
|
311
309
|
export { KVStoreOptions as A, ResolvedUpstashKVStoreConfig as B, KVOperation as C, KVStorage as D, KVSetOptions as E, ResolvedDenoKVStoreConfig as F, ResolvedFsLiteKVStoreConfig as I, ResolvedKVModuleOptions as L, RedisKVStoreConfig as M, ResolvedCloudflareKVStoreConfig as N, KVStoreConfig as O, ResolvedDatabaseKVStoreConfig as P, ResolvedKVStoreConfig as R, KVLockRunResult as S, KVPageOptions as T, UpstashKVStoreConfig as V, KVListPage as _, InferredKVStoreConfig as a, KVLockErrorCode as b, KVDriver as c, KVEntry as d, KVErrorCode as f, KVListOptions as g, KVGetTypeMap as h, FsLiteKVStoreConfig as i, ReadonlyKVStorage as j, KVStoreName as k, KVDriverAtomicOperations as l, KVGetType as m, DatabaseKVStoreConfig as n, KVAtomicOperation as o, KVGetOptions as p, DenoKVStoreConfig as r, KVClearOptions as s, CloudflareKVStoreConfig as t, KVDriversWith as u, KVLock as v, KVOptions as w, KVLockOptions as x, KVLockAcquisition as y, ResolvedRedisKVStoreConfig as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { a as upstashUrlEnvNames, i as upstashTokenEnvNames, s as readEnv } from "./config-B8FRGmX_.js";
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
3
|
+
// src/runtime/upstash.ts
|
|
4
4
|
function isMaskedValue(value) {
|
|
5
5
|
return !value || /^\*+$/.test(value);
|
|
6
6
|
}
|
|
@@ -36,5 +36,4 @@ function resolveRuntimeKVOptions(config, env = process.env) {
|
|
|
36
36
|
store
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { resolveUpstashRuntimeValues as n, resolveRuntimeKVOptions as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/utils2.mjs
|
|
2
2
|
function normalizeKey(key) {
|
|
3
3
|
if (!key) return "";
|
|
4
4
|
return key.split("?")[0]?.replace(/[/\\]/g, ":").replace(/:+/g, ":").replace(/^:|:$/g, "") || "";
|
|
@@ -27,5 +27,4 @@ function filterKeyByBase(key, base) {
|
|
|
27
27
|
if (base) return key.startsWith(base) && key[key.length - 1] !== "$";
|
|
28
28
|
return key[key.length - 1] !== "$";
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { normalizeBaseKey as a, joinKeys as i, filterKeyByDepth as n, normalizeKey as o, hasDotSegment as r, filterKeyByBase as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { L as ResolvedKVModuleOptions, w as KVOptions } from "./types-
|
|
2
|
-
import { r as ViteHubCliPluginMetadata } from "./cli-
|
|
3
|
-
import { n as OperationContributionEntry } from "./operation-definition-
|
|
1
|
+
import { L as ResolvedKVModuleOptions, w as KVOptions } from "./types-C397WKyf.js";
|
|
2
|
+
import { r as ViteHubCliPluginMetadata } from "./cli-BvVInMht.js";
|
|
3
|
+
import { n as OperationContributionEntry } from "./operation-definition-CqZkx1Rm.js";
|
|
4
4
|
import "nostics";
|
|
5
5
|
import { Plugin } from "vite";
|
|
6
|
-
//#region src/config.d.ts
|
|
7
6
|
interface KVResolutionInput {
|
|
8
7
|
/**
|
|
9
8
|
* `vite dev`. A store is then local unless it sets `remote: true`: inference never selects Upstash, and a Cloudflare
|
|
@@ -19,8 +18,6 @@ interface KVResolutionInput {
|
|
|
19
18
|
*/
|
|
20
19
|
postgresDatabase?: boolean;
|
|
21
20
|
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/vite-config.d.ts
|
|
24
21
|
export declare const KV_VITE_PLUGIN_NAME = "@vite-hub/kv/vite";
|
|
25
22
|
export declare const KV_VIRTUAL_CONFIG_ID = "#vitehub/kv/config";
|
|
26
23
|
interface KVViteRuntimeConfig {
|
|
@@ -28,12 +25,8 @@ interface KVViteRuntimeConfig {
|
|
|
28
25
|
kv: false | ResolvedKVModuleOptions;
|
|
29
26
|
}
|
|
30
27
|
export declare function resolveKVViteConfig(kv: KVOptions | undefined, input?: KVResolutionInput): KVViteRuntimeConfig;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region ../internal/src/deployment.d.ts
|
|
33
28
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
34
29
|
type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region ../internal/src/inspect.d.ts
|
|
37
30
|
interface ViteHubDefinitionField {
|
|
38
31
|
label: string;
|
|
39
32
|
value: string;
|
|
@@ -95,8 +88,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
|
|
|
95
88
|
interface ViteHubInspectionPluginMetadata {
|
|
96
89
|
inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
|
|
97
90
|
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region ../internal/src/build/deployment-plan-output.d.ts
|
|
100
91
|
/**
|
|
101
92
|
* One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
|
|
102
93
|
* a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
|
|
@@ -126,8 +117,6 @@ interface DeploymentEnvContext {
|
|
|
126
117
|
* Return names only, never values.
|
|
127
118
|
*/
|
|
128
119
|
type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region ../internal/src/durability.d.ts
|
|
131
120
|
/**
|
|
132
121
|
* One durability reporter that a primitive's Vite plugin contributes through `vitehub.durability`. The Node server
|
|
133
122
|
* imports `export` from `module` at boot and calls it with `input` and the server environment. It returns the
|
|
@@ -150,8 +139,6 @@ interface DurabilityPluginMetadata {
|
|
|
150
139
|
/** Called after Vite resolves the config. Return an empty list when the primitive is off. */
|
|
151
140
|
durability?: () => readonly DurabilityContribution[];
|
|
152
141
|
}
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/vite.d.ts
|
|
155
142
|
/**
|
|
156
143
|
* File path of the unstorage driver over a KV store. Options: `store` (default: the default store) and `base` (a key prefix).
|
|
157
144
|
* ViteHub mounts it at `kv`, `kv-<store>`, and, with `cache: { driver: "kv" }`, at `cache`.
|
|
@@ -206,5 +193,4 @@ export interface KVViteInput extends Pick<KVResolutionInput, "hosting"> {
|
|
|
206
193
|
}
|
|
207
194
|
/** `input.hosting` names the host preset for driver inference, as `vitehub()` passes it. Without it, KV reads the host from env. */
|
|
208
195
|
export declare function hubKV(options?: KVOptions, input?: KVViteInput): KVVitePlugin;
|
|
209
|
-
//#endregion
|
|
210
196
|
export type { KVViteRuntimeConfig };
|