@vite-hub/kv 0.4.1 → 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 +7 -3
- package/dist/{batch--v0ri69O.js → batch-D-ib5_0P.js} +0 -1
- package/dist/{cli-DpPhz_Ek.d.ts → cli-BvVInMht.d.ts} +1 -6
- package/dist/cli.d.ts +2 -4
- package/dist/cli.js +24 -14
- package/dist/{cloudflare-env-lOtHHsgP.js → cloudflare-env-Bm6huR35.js} +4 -4
- package/dist/{cloudflare-env-lookup-Bs0VDpU5.js → cloudflare-env-lookup-Dgq5n1Aq.js} +1 -2
- package/dist/{cloudflare-kv-C3NO4C21.js → cloudflare-kv-K2MzfP6D.js} +12 -16
- package/dist/{cloudflare-kv-local-C2sbIrFy.js → cloudflare-kv-local-lov9LLhU.js} +5 -10
- package/dist/{config-LfpUj9hs.js → config-B8FRGmX_.js} +53 -22
- package/dist/{create-storage-BORQm2a8.js → create-storage-BMvkkYdM.js} +9 -15
- package/dist/{cursor-history-DRHh5bO5.js → cursor-history-C6oG12QO.js} +9 -6
- package/dist/{deno-kv-D_VtffFv.js → deno-kv-MnqlNH1e.js} +45 -10
- package/dist/{dev-peer-CHafxbtj.js → dev-peer-D0vOxmrD.js} +1 -2
- package/dist/driver-bLMl-wMO.d.ts +43 -0
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{error-diagnostics-C54QQEhN.js → error-diagnostics-DUIp6FhO.js} +7 -4
- package/dist/{errors-DzD6YNEH.js → errors-IaVOqzAs.js} +42 -8
- package/dist/errors.d.ts +8 -5
- package/dist/errors.js +1 -2
- package/dist/fs-lite-DhXLUL-H.js +1 -0
- package/dist/{fs-lite-BaklCLuV.js → fs-lite-fvNdBEr9.js} +3 -5
- package/dist/index.d.ts +1 -3
- package/dist/index.js +34 -66
- 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-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
- package/dist/{operations-D2iI9oN4.js → operations-CGAX5ASA.js} +53 -28
- package/dist/{operations-CtrWLmPK.js → operations-FgS_sJ3M.js} +27 -45
- package/dist/operations.d.ts +2 -8
- package/dist/operations.js +8 -12
- package/dist/out-By90R-Bo.js +22706 -0
- package/dist/{redis-shared-5ogRd3-Y.js → redis-shared-DO7Ib1Sz.js} +2 -3
- package/dist/request-log-DllKQXj7.js +104 -0
- package/dist/results-emgN7uDS.js +4 -0
- package/dist/rolldown-runtime-DegdyBIC.js +25 -0
- 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 +2 -0
- package/dist/{database-oJdy0ZVX.js → runtime/database.js} +69 -39
- package/dist/runtime/nitro-plugin.d.ts +1 -2
- package/dist/runtime/nitro-plugin.js +11 -8
- package/dist/runtime/redis-driver.d.ts +3 -5
- package/dist/runtime/redis-driver.js +6 -10
- 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 -11
- package/dist/{types-Bj3EQoRg.d.ts → types-BUb0FcjM.d.ts} +0 -2
- package/dist/{types-Dv-OSXZC.d.ts → types-C397WKyf.d.ts} +4 -20
- package/dist/{upstash-B-vaUYqO.js → upstash-DQVo1zbz.js} +3 -4
- package/dist/{utils2-FozcTsmb.js → utils2-By8eee1x.js} +1 -2
- package/dist/vite.d.ts +8 -19
- package/dist/vite.js +2676 -104
- package/package.json +15 -10
- package/dist/driver-R4Z5Z5fl.d.ts +0 -15
- package/dist/fs-lite-BAgpmNAF.js +0 -2
- package/dist/results-p7nPCnaJ.js +0 -6
|
@@ -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;
|
|
@@ -83,6 +76,8 @@ interface ViteHubResourceSummary {
|
|
|
83
76
|
owner: string;
|
|
84
77
|
/** Absent when no id is known yet. */
|
|
85
78
|
source?: ViteHubResourceIdSource;
|
|
79
|
+
/** The resource is in the Wrangler config of a standalone Provider Output Worker, not in Nitro's. */
|
|
80
|
+
standalone?: boolean;
|
|
86
81
|
}
|
|
87
82
|
interface ViteHubInspectionContributor {
|
|
88
83
|
definitions?: readonly ViteHubDefinitionInspector[];
|
|
@@ -93,8 +88,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
|
|
|
93
88
|
interface ViteHubInspectionPluginMetadata {
|
|
94
89
|
inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
|
|
95
90
|
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region ../internal/src/build/deployment-plan-output.d.ts
|
|
98
91
|
/**
|
|
99
92
|
* One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
|
|
100
93
|
* a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
|
|
@@ -124,8 +117,6 @@ interface DeploymentEnvContext {
|
|
|
124
117
|
* Return names only, never values.
|
|
125
118
|
*/
|
|
126
119
|
type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region ../internal/src/durability.d.ts
|
|
129
120
|
/**
|
|
130
121
|
* One durability reporter that a primitive's Vite plugin contributes through `vitehub.durability`. The Node server
|
|
131
122
|
* imports `export` from `module` at boot and calls it with `input` and the server environment. It returns the
|
|
@@ -148,8 +139,6 @@ interface DurabilityPluginMetadata {
|
|
|
148
139
|
/** Called after Vite resolves the config. Return an empty list when the primitive is off. */
|
|
149
140
|
durability?: () => readonly DurabilityContribution[];
|
|
150
141
|
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/vite.d.ts
|
|
153
142
|
/**
|
|
154
143
|
* File path of the unstorage driver over a KV store. Options: `store` (default: the default store) and `base` (a key prefix).
|
|
155
144
|
* ViteHub mounts it at `kv`, `kv-<store>`, and, with `cache: { driver: "kv" }`, at `cache`.
|
|
@@ -172,11 +161,9 @@ export type KVVitePlugin = Plugin & {
|
|
|
172
161
|
};
|
|
173
162
|
};
|
|
174
163
|
export declare function hubKVOptionalPeerResolver(): Plugin;
|
|
175
|
-
/** The part of Nitro's prerender config that KV changes. */
|
|
176
164
|
interface KVPrerenderConfig {
|
|
177
165
|
virtual?: Record<string, string | (() => string)>;
|
|
178
166
|
}
|
|
179
|
-
/** The parts of a Nitro build that KV changes. */
|
|
180
167
|
interface KVNitroBuild {
|
|
181
168
|
hooks?: {
|
|
182
169
|
hook: (name: "prerender:config", callback: (config: KVPrerenderConfig) => void) => unknown;
|
|
@@ -184,6 +171,9 @@ interface KVNitroBuild {
|
|
|
184
171
|
options: NitroCloudflareKVTarget;
|
|
185
172
|
}
|
|
186
173
|
interface NitroCloudflareKVTarget {
|
|
174
|
+
deps?: {
|
|
175
|
+
paths?: Record<string, string>;
|
|
176
|
+
};
|
|
187
177
|
handlers?: unknown[];
|
|
188
178
|
kv?: Record<string, unknown>;
|
|
189
179
|
storage?: Record<string, unknown>;
|
|
@@ -203,5 +193,4 @@ export interface KVViteInput extends Pick<KVResolutionInput, "hosting"> {
|
|
|
203
193
|
}
|
|
204
194
|
/** `input.hosting` names the host preset for driver inference, as `vitehub()` passes it. Without it, KV reads the host from env. */
|
|
205
195
|
export declare function hubKV(options?: KVOptions, input?: KVViteInput): KVVitePlugin;
|
|
206
|
-
//#endregion
|
|
207
196
|
export type { KVViteRuntimeConfig };
|