@vite-hub/kv 0.8.0 → 0.9.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/dist/cli.js +2 -2
- package/dist/{cloudflare-env-Cpy3Bqdn.js → cloudflare-env-JD7uO5-i.js} +0 -4
- package/dist/{cloudflare-kv-hMdZQZz1.js → cloudflare-kv-CkrnHHnv.js} +4 -4
- package/dist/{cloudflare-kv-local-BpPaDG49.js → cloudflare-kv-local-qb92SO8d.js} +3 -3
- package/dist/{config-x_Nru3R5.js → config-CZ4CZy9h.js} +1 -1
- package/dist/{create-storage-DrhV0F4S.js → create-storage-DeGjkDl8.js} +1 -1
- package/dist/{cursor-history-MzSrXXXX.js → cursor-history-KSuS5xrH.js} +1 -1
- package/dist/{database-D0NvYrhk.js → database-CtQO7n6H.js} +1 -1
- package/dist/{deno-kv-DwcTL95B.js → deno-kv-ClGWU3yO.js} +2 -2
- package/dist/{dev-peer-D0vOxmrD.js → dev-peer-CpFxuBAP.js} +0 -24
- package/dist/{error-diagnostics-DAi25E6F.js → error-diagnostics-C7c-Bfrl.js} +2 -2
- package/dist/{errors-kZRpu7Wa.js → errors-BV0MKLrD.js} +1 -1
- package/dist/errors.js +1 -1
- package/dist/{fs-lite-1n_Dvy4p.js → fs-lite-Bmcw5tUV.js} +1 -1
- package/dist/fs-lite-D33j4kWD.js +1 -0
- package/dist/index.js +9 -9
- package/dist/{operations-Cj_0pSSA.js → operations-CbpFdf91.js} +1 -1
- package/dist/{operations-DP8iWjQK.js → operations-mNN-HppH.js} +0 -2
- package/dist/operations.js +3 -10
- package/dist/{redis-shared-DEwmedD5.js → redis-shared-DIUSIQAC.js} +1 -1
- package/dist/runtime/cloudflare-kv.js +1 -1
- package/dist/runtime/cloudflare-request-env.js +1 -1
- package/dist/runtime/nitro-plugin.js +1 -1
- package/dist/runtime/redis-driver.js +2 -2
- package/dist/runtime/upstash-driver.js +2 -2
- package/dist/{upstash-DINRYhXI.js → upstash-CiqFI55W.js} +2 -2
- package/dist/vite.js +5 -22
- package/package.json +4 -4
- package/dist/fs-lite-Co1NzxYo.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as listSeedFiles, E as askOnTerminal, N as writeCliFailure, O as parseCliPositiveInteger, j as readViteHubDevTargetOption, k as readCliOptionValue, n as callOperationFromCli } from "./operations-
|
|
1
|
+
import { D as listSeedFiles, E as askOnTerminal, N as writeCliFailure, O as parseCliPositiveInteger, j as readViteHubDevTargetOption, k as readCliOptionValue, n as callOperationFromCli } from "./operations-mNN-HppH.js";
|
|
2
2
|
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
3
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
4
4
|
import { t as kvDevMaximumListLimit } from "./results-emgN7uDS.js";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { extname, join, relative, resolve } from "node:path";
|
|
@@ -4,10 +4,6 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
4
4
|
const runtimeGlobal = globalThis;
|
|
5
5
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
6
6
|
const globalEnvProbe = Symbol("vitehub.cloudflare.global-env-probe");
|
|
7
|
-
/**
|
|
8
|
-
* Under the Nitro Cloudflare dev server, `cloudflare:workers` exports unenv's env proxy, which reads every key from
|
|
9
|
-
* `globalThis.__env__`. Storing that proxy in `__env__` makes it read itself, and the next read overflows the stack.
|
|
10
|
-
*/
|
|
11
7
|
function readsGlobalEnv(env) {
|
|
12
8
|
const scope = globalThis;
|
|
13
9
|
const owned = Object.hasOwn(scope, "__env__");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
-
import { t as getActiveCloudflareBinding } from "./cloudflare-env-
|
|
3
|
-
import { n as normalizeKVListPrefix, t as createKVStorage } from "./create-storage-
|
|
4
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
5
|
-
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-
|
|
2
|
+
import { t as getActiveCloudflareBinding } from "./cloudflare-env-JD7uO5-i.js";
|
|
3
|
+
import { n as normalizeKVListPrefix, t as createKVStorage } from "./create-storage-DeGjkDl8.js";
|
|
4
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
5
|
+
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-KSuS5xrH.js";
|
|
6
6
|
import { i as setItemsOneByOne, t as chunks } from "./batch-D-ib5_0P.js";
|
|
7
7
|
import createDriver from "unstorage/drivers/cloudflare-kv-binding";
|
|
8
8
|
// src/runtime/cloudflare-kv-limits.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getActiveCloudflareBinding } from "./cloudflare-env-
|
|
2
|
-
import { a as validateCloudflareKVBatch, i as installCloudflareKVLimits, r as assertCloudflareKVWrite, t as createCloudflareDriver } from "./cloudflare-kv-
|
|
3
|
-
import { t as createFsLiteKVDriver } from "./fs-lite-
|
|
1
|
+
import { t as getActiveCloudflareBinding } from "./cloudflare-env-JD7uO5-i.js";
|
|
2
|
+
import { a as validateCloudflareKVBatch, i as installCloudflareKVLimits, r as assertCloudflareKVWrite, t as createCloudflareDriver } from "./cloudflare-kv-CkrnHHnv.js";
|
|
3
|
+
import { t as createFsLiteKVDriver } from "./fs-lite-Bmcw5tUV.js";
|
|
4
4
|
import { i as setItemsOneByOne, n as getItemsOneByOne } from "./batch-D-ib5_0P.js";
|
|
5
5
|
// src/runtime/cloudflare-kv-local.ts
|
|
6
6
|
function cloudflareExpirationSeconds(options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
2
2
|
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
3
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
4
4
|
import { defu } from "defu";
|
|
5
5
|
// ../internal/src/env.ts
|
|
6
6
|
function trimmed(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as normalizeBaseKey, i as joinKeys, n as filterKeyByDepth, o as normalizeKey, r as hasDotSegment, t as filterKeyByBase } from "./utils2-By8eee1x.js";
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
3
|
import { r as mapWithLimit } from "./batch-D-ib5_0P.js";
|
|
4
4
|
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/libs/destr.mjs
|
|
5
5
|
const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
3
|
// src/runtime/cursor-history.ts
|
|
4
4
|
const MAX_CURSOR_HISTORIES = 1024;
|
|
5
5
|
const MAX_CURSORS_PER_HISTORY = 1024;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
3
|
import { t as chunks } from "./batch-D-ib5_0P.js";
|
|
4
4
|
// src/runtime/database.ts
|
|
5
5
|
/** The table that keeps the keys of every `database` store. Each store has its rows under its own `namespace`. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
-
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
|
+
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-KSuS5xrH.js";
|
|
4
4
|
// src/runtime/deno-kv.ts
|
|
5
5
|
const MAX_DENO_KEY_BYTES = 2048;
|
|
6
6
|
function getDenoRuntime() {
|
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
// ../internal/src/dev-peer.ts
|
|
2
|
-
/**
|
|
3
|
-
* Proof that a development request came from this machine, for dev servers that run the app behind a proxy.
|
|
4
|
-
*
|
|
5
|
-
* Nitro 3 runs the app in a worker behind an env-runner proxy. The worker never sees the client's address
|
|
6
|
-
* (https://github.com/unjs/env-runner/issues/113):
|
|
7
|
-
* over a Unix socket it sees none, and over TCP it sees the proxy on `127.0.0.1`. The proxy forwards a client
|
|
8
|
-
* `x-forwarded-for` as is. The front process sees the real socket, so its Nitro dev handler removes any client copy
|
|
9
|
-
* of {@link viteHubDevPeerHeader} and, for a loopback socket only, adds an HMAC over the method, the path, a
|
|
10
|
-
* timestamp, and a nonce. The key is random for each process and reaches the worker only through its environment
|
|
11
|
-
* ({@link viteHubDevPeerKeyEnv}), never through a header. The worker takes the key out of its environment, so the
|
|
12
|
-
* processes that the app starts do not inherit it.
|
|
13
|
-
*
|
|
14
|
-
* A tunnel or a reverse proxy on this machine, such as `cloudflared`, `ngrok`, `tailscale serve`, or Caddy, connects
|
|
15
|
-
* from a loopback socket too. Such a request is not from this machine, so the front process signs no request that
|
|
16
|
-
* names another host or carries a forwarding header ({@link isViteHubForwardedRequest}). A forwarder that copies raw
|
|
17
|
-
* TCP bytes, such as `ssh -R`, sends no such sign. Only sign-in protects a dev server behind one.
|
|
18
|
-
*
|
|
19
|
-
* The worker calls {@link verifyViteHubDevPeer}. Each piece of evidence is valid once, for one method and path, for a
|
|
20
|
-
* short time. This module uses Web Crypto and no Node import, so the check also runs in Worker runtimes.
|
|
21
|
-
*/
|
|
22
2
|
/** The request header that carries the evidence from the front process to the worker. */
|
|
23
3
|
const viteHubDevPeerHeader = "x-vitehub-dev-peer";
|
|
24
4
|
/** The environment variable that carries the per-process key from the front process to the worker. */
|
|
@@ -190,10 +170,6 @@ function isViteHubLoopbackHost(host) {
|
|
|
190
170
|
}
|
|
191
171
|
return name === "localhost" || name.endsWith(".localhost") || name === "[::1]" || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(name);
|
|
192
172
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Remove a client copy of the evidence. Returns the request to sign when it came from a loopback socket, names this
|
|
195
|
-
* machine in `Host`, and carries no forwarding header.
|
|
196
|
-
*/
|
|
197
173
|
function takeSignableRequest(node) {
|
|
198
174
|
delete node.headers[viteHubDevPeerHeader];
|
|
199
175
|
if (!isViteHubLoopbackAddress(node.socket?.remoteAddress) || !node.method || !node.url?.startsWith("/")) return;
|
|
@@ -95,7 +95,7 @@ const kvErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
95
95
|
},
|
|
96
96
|
KV_INVALID_DRIVER: {
|
|
97
97
|
why: ({ driver, renamed }) => renamed ? `\`kv.driver\` is ${driver}. ViteHub renamed this driver to "${renamed}", and it does not read ${driver}.` : `\`kv.driver\` ${driver} is not a KV driver.`,
|
|
98
|
-
fix: ({ renamed }) => renamed ? `Set \`kv: { driver: "${renamed}" }
|
|
98
|
+
fix: ({ renamed }) => renamed ? `Set \`kv: { driver: "${renamed}" }\`.` : "Set `kv.driver` to \"cloudflare\", \"database\", \"deno-kv\", \"fs-lite\", \"redis\", or \"upstash\"."
|
|
99
99
|
},
|
|
100
100
|
KV_INVALID_REMOTE: {
|
|
101
101
|
why: ({ store }) => `\`remote\` of the KV store "${store}" must be \`true\` or \`false\`.`,
|
|
@@ -127,7 +127,7 @@ const kvErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
127
127
|
},
|
|
128
128
|
KV_UNKNOWN_STORE_OPTION: {
|
|
129
129
|
why: ({ driver, key, path, stores }) => stores ? `\`${path}\` has \`stores\`, so it takes no other key, and it has \`${key}\`.` : driver ? `\`${path}.${key}\` is not an option of the \`${driver}\` KV driver.` : `\`${path}.${key}\` is not an option of a KV store without \`driver\`. ViteHub picks the driver from the host and would ignore it.`,
|
|
130
|
-
fix: ({ drivers, driver, key, stores }) => stores ? `Move \`${key}\` into a store under \`stores\`, for example \`stores: { default: { driver: "fs-lite" } }\`.` : drivers.length && !driver ? `Set \`driver\` to ${drivers.map((name) => `"${name}"`).join(" or ")}, which reads \`${key}\`. ViteHub renamed some drivers, so
|
|
130
|
+
fix: ({ drivers, driver, key, stores }) => stores ? `Move \`${key}\` into a store under \`stores\`, for example \`stores: { default: { driver: "fs-lite" } }\`.` : drivers.length && !driver ? `Set \`driver\` to ${drivers.map((name) => `"${name}"`).join(" or ")}, which reads \`${key}\`. ViteHub renamed some drivers, so replace an old driver name with one of these.` : drivers.length ? `Remove \`${key}\`, or set \`driver\` to ${drivers.map((name) => `"${name}"`).join(" or ")}, which reads it.` : `Remove \`${key}\`. A KV store takes \`driver\`, \`remote\`, and the options of its driver.`
|
|
131
131
|
},
|
|
132
132
|
KV_INVALID_COUNTER: {
|
|
133
133
|
why: "kv.increment() needs a stored integer below 9007199254740991. The value did not change.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
2
|
-
import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-
|
|
2
|
+
import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
3
|
import { isRuntimeDiagnostic, parseDuration, toResultError } from "@vite-hub/runtime";
|
|
4
4
|
// src/runtime/ttl.ts
|
|
5
5
|
/**
|
package/dist/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as kvClearOptionsError, n as kvInvalidKeyError, r as kvInvalidLimitError, i as kvKeyLimitCodes, a as kvListLimitInvalid, o as kvResult, s as kvSetCodes, c as kvSetTTL, l as kvStoreNotFoundError, p as kvStoreWithMode, u as kvUnsupportedOperationError, d as kvWriteLimitCodes, f as listKVKeys } from "./errors-
|
|
1
|
+
export { t as kvClearOptionsError, n as kvInvalidKeyError, r as kvInvalidLimitError, i as kvKeyLimitCodes, a as kvListLimitInvalid, o as kvResult, s as kvSetCodes, c as kvSetTTL, l as kvStoreNotFoundError, p as kvStoreWithMode, u as kvUnsupportedOperationError, d as kvWriteLimitCodes, f as listKVKeys } from "./errors-BV0MKLrD.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
2
2
|
import { link, lstat, mkdir, mkdtemp, opendir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
import createDriver from "unstorage/drivers/fs-lite";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as default } from "./fs-lite-Bmcw5tUV.js";
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as normalizeKVOptions, s as readEnv } from "./config-
|
|
1
|
+
import { r as normalizeKVOptions, s as readEnv } from "./config-CZ4CZy9h.js";
|
|
2
2
|
import { n as getActiveCloudflareEnv } from "./cloudflare-env-lookup-Dgq5n1Aq.js";
|
|
3
|
-
import { a as kvListLimitInvalid, c as kvSetTTL, f as listKVKeys, i as kvKeyLimitCodes, m as ttlSeconds, n as kvInvalidKeyError, o as kvResult, p as kvStoreWithMode, s as kvSetCodes, t as kvClearOptionsError } from "./errors-
|
|
3
|
+
import { a as kvListLimitInvalid, c as kvSetTTL, f as listKVKeys, i as kvKeyLimitCodes, m as ttlSeconds, n as kvInvalidKeyError, o as kvResult, p as kvStoreWithMode, s as kvSetCodes, t as kvClearOptionsError } from "./errors-BV0MKLrD.js";
|
|
4
4
|
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
5
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
6
|
-
import { t as resolveRuntimeKVOptions } from "./upstash-
|
|
5
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
6
|
+
import { t as resolveRuntimeKVOptions } from "./upstash-CiqFI55W.js";
|
|
7
7
|
import { i as setItemsOneByOne, n as getItemsOneByOne } from "./batch-D-ib5_0P.js";
|
|
8
|
-
import { n as normalizeKVListPrefix, t as createKVStorage$1 } from "./create-storage-
|
|
8
|
+
import { n as normalizeKVListPrefix, t as createKVStorage$1 } from "./create-storage-DeGjkDl8.js";
|
|
9
9
|
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
10
10
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
11
11
|
import { destr } from "destr";
|
|
@@ -54,7 +54,7 @@ const otherOptionalDriverMethods = {
|
|
|
54
54
|
};
|
|
55
55
|
const lazyOptionalDriverMethods = Object.fromEntries(Object.entries(driverAtomicOperations).map(([driver, operations]) => [driver, /* @__PURE__ */ new Set([...Object.keys(operations).map((operation) => atomicDriverMethods[operation]), ...otherOptionalDriverMethods[driver] ?? []])]));
|
|
56
56
|
async function createDatabaseDriver(store, loadDatabases) {
|
|
57
|
-
const { default: factory, kvSqlClientFromDatabase } = await import("./database-
|
|
57
|
+
const { default: factory, kvSqlClientFromDatabase } = await import("./database-CtQO7n6H.js");
|
|
58
58
|
return factory(store, async () => {
|
|
59
59
|
const entry = loadDatabases ? (await loadDatabases())[store.database] : void 0;
|
|
60
60
|
if (!entry) throw kvErrorDiagnostics.KV_DATABASE_UNAVAILABLE({
|
|
@@ -69,7 +69,7 @@ async function createRuntimeDriver(store, loadDatabases) {
|
|
|
69
69
|
case "cloudflare": {
|
|
70
70
|
const { localBase } = store;
|
|
71
71
|
if (localBase) {
|
|
72
|
-
const { default: factory } = await import("./cloudflare-kv-local-
|
|
72
|
+
const { default: factory } = await import("./cloudflare-kv-local-qb92SO8d.js");
|
|
73
73
|
return factory({
|
|
74
74
|
...store,
|
|
75
75
|
localBase
|
|
@@ -80,11 +80,11 @@ async function createRuntimeDriver(store, loadDatabases) {
|
|
|
80
80
|
}
|
|
81
81
|
case "database": return createDatabaseDriver(store, loadDatabases);
|
|
82
82
|
case "deno-kv": {
|
|
83
|
-
const { default: factory } = await import("./deno-kv-
|
|
83
|
+
const { default: factory } = await import("./deno-kv-ClGWU3yO.js");
|
|
84
84
|
return factory(store);
|
|
85
85
|
}
|
|
86
86
|
case "fs-lite": {
|
|
87
|
-
const { default: factory } = await import("./fs-lite-
|
|
87
|
+
const { default: factory } = await import("./fs-lite-D33j4kWD.js");
|
|
88
88
|
return factory(store);
|
|
89
89
|
}
|
|
90
90
|
case "redis": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
2
2
|
import { t as redactInspectionText } from "./inspect-BWMcVWD8.js";
|
|
3
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
4
4
|
import { t as kvDevMaximumListLimit } from "./results-emgN7uDS.js";
|
|
5
5
|
import { kv } from "@vite-hub/kv";
|
|
6
6
|
// src/runtime/inspect-value.ts
|
|
@@ -762,7 +762,6 @@ function base64url(bytes) {
|
|
|
762
762
|
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
763
763
|
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
764
764
|
}
|
|
765
|
-
/** The bytes of a base64url value, or `undefined` when it is not canonical base64url without padding. */
|
|
766
765
|
function fromBase64url(value) {
|
|
767
766
|
if (!/^[\w-]*$/.test(value) || value.length % 4 === 1) return void 0;
|
|
768
767
|
const bytes = Uint8Array.from(atob(value.replace(/-/g, "+").replace(/_/g, "/")), (character) => character.charCodeAt(0));
|
|
@@ -789,7 +788,6 @@ function consoleSignedText(fields) {
|
|
|
789
788
|
fields.caller
|
|
790
789
|
].join("\n");
|
|
791
790
|
}
|
|
792
|
-
/** The path and query of a URL, the part of the request target that the signature covers. */
|
|
793
791
|
function requestTarget(url) {
|
|
794
792
|
return `${url.pathname}${url.search}`;
|
|
795
793
|
}
|
package/dist/operations.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as internalErrorDiagnostics, a as operationRootHeader, c as projectRootHash, d as defineOperation, f as answerOperationRpc, h as readOperationRpcCall, i as createOperationRegistry, l as runOperation, m as operationRpcRefusal, o as operationRpcHeader, s as operationsOf, t as assertOperationProject, u as toOperationFailure } from "./operations-
|
|
1
|
+
import { F as internalErrorDiagnostics, a as operationRootHeader, c as projectRootHash, d as defineOperation, f as answerOperationRpc, h as readOperationRpcCall, i as createOperationRegistry, l as runOperation, m as operationRpcRefusal, o as operationRpcHeader, s as operationsOf, t as assertOperationProject, u as toOperationFailure } from "./operations-mNN-HppH.js";
|
|
2
2
|
import { t as kvDevMaximumListLimit } from "./results-emgN7uDS.js";
|
|
3
|
-
import { n as isViteHubLoopbackPeer } from "./dev-peer-
|
|
3
|
+
import { n as isViteHubLoopbackPeer } from "./dev-peer-CpFxuBAP.js";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
// ../internal/src/secret.ts
|
|
6
6
|
const secretEncoder = new TextEncoder();
|
|
@@ -34,11 +34,6 @@ function rejectDevRequest(rejection) {
|
|
|
34
34
|
const fileOrExtensionProtocol = /^(?:file|.+-extension):/i;
|
|
35
35
|
const ipv4Octet = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)";
|
|
36
36
|
const ipv4Literal = new RegExp(`^${ipv4Octet}(?:\\.${ipv4Octet}){3}$`);
|
|
37
|
-
/**
|
|
38
|
-
* Tests IP literals like `node:net` `isIP`, without a Node import, so the Nitro-side check also runs in Worker
|
|
39
|
-
* runtimes. IPv4 uses the Node pattern (dotted decimal, no leading zeros). IPv6 uses the WHATWG URL parser, which
|
|
40
|
-
* rejects zone IDs. Browsers do not send zone IDs in `Host`.
|
|
41
|
-
*/
|
|
42
37
|
function isIPv4Literal(value) {
|
|
43
38
|
return ipv4Literal.test(value);
|
|
44
39
|
}
|
|
@@ -102,12 +97,10 @@ function readPath(value, ...path) {
|
|
|
102
97
|
for (const key of path) value = value !== null && typeof value === "object" ? Reflect.get(value, key) : void 0;
|
|
103
98
|
return value;
|
|
104
99
|
}
|
|
105
|
-
/** The Cloudflare bindings of a Request: from the Standard Context that Nitro sets, else where srvx puts them. */
|
|
106
100
|
function requestEnv(request) {
|
|
107
101
|
const env = readPath(request, "~standard", "runtime", "cloudflare", "env") ?? readPath(request, "runtime", "cloudflare", "env");
|
|
108
102
|
return env !== null && typeof env === "object" ? env : void 0;
|
|
109
103
|
}
|
|
110
|
-
/** The `waitUntil` of a Request: from its Standard Context, else from the Request or its Worker ExecutionContext. */
|
|
111
104
|
function requestWaitUntil(request) {
|
|
112
105
|
for (const owner of [
|
|
113
106
|
readPath(request, "~standard"),
|
|
@@ -235,7 +228,7 @@ function createStandaloneOperationHandler(sources, root) {
|
|
|
235
228
|
} };
|
|
236
229
|
}
|
|
237
230
|
// src/operations.ts
|
|
238
|
-
const runtime = () => import("./operations-
|
|
231
|
+
const runtime = () => import("./operations-CbpFdf91.js");
|
|
239
232
|
const store = v.optional(v.pipe(v.string(), v.check((name) => name.trim() !== "", "Name a store.")));
|
|
240
233
|
const key = v.string();
|
|
241
234
|
function defineKVOperation(definition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as createCloudflareKVStorage, t as default } from "../cloudflare-kv-
|
|
1
|
+
export { n as createCloudflareKVStorage, t as default } from "../cloudflare-kv-CkrnHHnv.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as installCloudflareRequestEnv } from "../cloudflare-env-
|
|
1
|
+
import { n as installCloudflareRequestEnv } from "../cloudflare-env-JD7uO5-i.js";
|
|
2
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as logFailure } from "../request-log-DllKQXj7.js";
|
|
2
|
-
import { t as kvInferredStoreNotice } from "../config-
|
|
2
|
+
import { t as kvInferredStoreNotice } from "../config-CZ4CZy9h.js";
|
|
3
3
|
import { disposeKVStores } from "@vite-hub/kv";
|
|
4
4
|
// src/runtime/nitro-plugin.ts
|
|
5
5
|
async function logInferredStores() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as invariant } from "../invariant-Dj2R1eMr.js";
|
|
2
2
|
import { o as normalizeKey } from "../utils2-By8eee1x.js";
|
|
3
|
-
import { n as kvErrorDiagnostics } from "../error-diagnostics-
|
|
3
|
+
import { n as kvErrorDiagnostics } from "../error-diagnostics-C7c-Bfrl.js";
|
|
4
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-
|
|
5
|
+
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-DIUSIQAC.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. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as invariant } from "../invariant-Dj2R1eMr.js";
|
|
2
2
|
import { o as normalizeKey } from "../utils2-By8eee1x.js";
|
|
3
|
-
import { n as kvErrorDiagnostics } from "../error-diagnostics-
|
|
3
|
+
import { n as kvErrorDiagnostics } from "../error-diagnostics-C7c-Bfrl.js";
|
|
4
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-
|
|
5
|
+
import { a as redisIncrementScript, i as redisIncrementResult, n as escapeRedisGlob, o as redisTTLSeconds, r as redisDeleteIfEqualsScript, t as createPortableRedisKeyLister } from "../redis-shared-DIUSIQAC.js";
|
|
6
6
|
import createDriver from "unstorage/drivers/upstash";
|
|
7
7
|
// src/runtime/upstash-driver.ts
|
|
8
8
|
const keyBatchSize = 1e3;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as upstashUrlEnvNames, i as upstashTokenEnvNames, s as readEnv } from "./config-
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { a as upstashUrlEnvNames, i as upstashTokenEnvNames, s as readEnv } from "./config-CZ4CZy9h.js";
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
3
3
|
// src/runtime/upstash.ts
|
|
4
4
|
function isMaskedValue(value) {
|
|
5
5
|
return !value || /^\*+$/.test(value);
|
package/dist/vite.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as __toESM } from "./rolldown-runtime-DegdyBIC.js";
|
|
2
2
|
import { n as invariantError, t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
3
3
|
import { a as resolve$1, i as relative$1, n as relativeDefinitionFile, r as dirname$1 } from "./inspect-BWMcVWD8.js";
|
|
4
|
-
import { t as addViteHubDevPeerDevHandler } from "./dev-peer-
|
|
4
|
+
import { t as addViteHubDevPeerDevHandler } from "./dev-peer-CpFxuBAP.js";
|
|
5
5
|
import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
|
|
6
|
-
import { A as readViteHubDevServerFile, C as markViteConfigPlugin, F as internalErrorDiagnostics, M as removeViteHubDevServerFile, P as writeViteHubDevServerFile, S as isServerEnvironment, T as shouldSkipViteProviderBuild, b as createNoExternalAddition, p as operationRpcPath, r as collectOperationContributions, v as VITEHUB_PROJECT_ROOT, w as resolveViteHubProjectRoot, x as hasNitroConfigContext, y as contributeServerEnv } from "./operations-
|
|
7
|
-
import { a as upstashUrlEnvNames, i as upstashTokenEnvNames, n as kvRedisEnvHint, o as resolveHostPreset, r as normalizeKVOptions } from "./config-
|
|
8
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
9
|
-
import { n as resolveUpstashRuntimeValues } from "./upstash-
|
|
6
|
+
import { A as readViteHubDevServerFile, C as markViteConfigPlugin, F as internalErrorDiagnostics, M as removeViteHubDevServerFile, P as writeViteHubDevServerFile, S as isServerEnvironment, T as shouldSkipViteProviderBuild, b as createNoExternalAddition, p as operationRpcPath, r as collectOperationContributions, v as VITEHUB_PROJECT_ROOT, w as resolveViteHubProjectRoot, x as hasNitroConfigContext, y as contributeServerEnv } from "./operations-mNN-HppH.js";
|
|
7
|
+
import { a as upstashUrlEnvNames, i as upstashTokenEnvNames, n as kvRedisEnvHint, o as resolveHostPreset, r as normalizeKVOptions } from "./config-CZ4CZy9h.js";
|
|
8
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-C7c-Bfrl.js";
|
|
9
|
+
import { n as resolveUpstashRuntimeValues } from "./upstash-CiqFI55W.js";
|
|
10
10
|
import { createRequire, isBuiltin } from "node:module";
|
|
11
11
|
import { access, copyFile, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
12
12
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -513,11 +513,9 @@ function isRelativeSpecifier(path) {
|
|
|
513
513
|
function isBareSpecifier(id) {
|
|
514
514
|
return !/^(?:\.{1,2}(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/]|\0|#|[a-z][a-z0-9+.-]*:)/i.test(id);
|
|
515
515
|
}
|
|
516
|
-
/** The folder that a relative import of `importer` resolves from, as esbuild's `resolveDir`. */
|
|
517
516
|
function importerDir(importer, workingDir) {
|
|
518
517
|
return importer && isAbsolute(importer) ? dirname(importer) : workingDir;
|
|
519
518
|
}
|
|
520
|
-
/** Rolldown resolves a specifier from an importer file. A bundle entry has none, so use a file in the working folder. */
|
|
521
519
|
function importerFor(importer, workingDir) {
|
|
522
520
|
return importer ?? join(workingDir, "__vitehub_entry__.js");
|
|
523
521
|
}
|
|
@@ -550,11 +548,6 @@ function collectPackageExportCandidates(packageName, exportsValue, packageRelati
|
|
|
550
548
|
}
|
|
551
549
|
return candidates;
|
|
552
550
|
}
|
|
553
|
-
/**
|
|
554
|
-
* Resolves `specifier` from a resolveId hook without running that hook again. `flag` in `custom` also skips the hook in
|
|
555
|
-
* resolutions that other plugins start from this one. `skipSelf` is still needed: when two equal resolutions run at the
|
|
556
|
-
* same time, Rolldown 1.2 can give one of them no `custom`, and the hook would then wait on its own resolution.
|
|
557
|
-
*/
|
|
558
551
|
function resolveFrom(context, specifier, request, workingDir, flag) {
|
|
559
552
|
return context.resolve(specifier, importerFor(request.importer, workingDir), {
|
|
560
553
|
custom: {
|
|
@@ -871,9 +864,6 @@ function createWasmModulePlugin(outdir, workingDir, copy) {
|
|
|
871
864
|
}
|
|
872
865
|
};
|
|
873
866
|
}
|
|
874
|
-
/**
|
|
875
|
-
* Leaves package imports external. Resolve package.json import mappings first, and preserve unmapped host imports.
|
|
876
|
-
*/
|
|
877
867
|
function createExternalPackagesPlugin() {
|
|
878
868
|
return {
|
|
879
869
|
name: "vitehub-external-packages",
|
|
@@ -959,7 +949,6 @@ function createOptionalImportPlugin() {
|
|
|
959
949
|
}
|
|
960
950
|
};
|
|
961
951
|
}
|
|
962
|
-
/** Matches import paths as esbuild's `external` does: `*` is a wildcard, and a package name also matches its subpaths. */
|
|
963
952
|
function createExternalMatcher(patterns) {
|
|
964
953
|
if (!patterns?.length) return;
|
|
965
954
|
const matchers = patterns.map((pattern) => {
|
|
@@ -971,7 +960,6 @@ function createExternalMatcher(patterns) {
|
|
|
971
960
|
});
|
|
972
961
|
return (id) => matchers.some((matches) => matches(id));
|
|
973
962
|
}
|
|
974
|
-
/** Returns the modules of the chunks that no chunk loaded from the entry chunk imports. */
|
|
975
963
|
function findUnusedChunkModules(chunks) {
|
|
976
964
|
const used = new Set(chunks.filter((chunk) => chunk.isEntry));
|
|
977
965
|
for (const chunk of used) for (const other of chunks) if (!used.has(other) && chunk.code.includes(other.fileName)) used.add(other);
|
|
@@ -3298,7 +3286,6 @@ function publishedPackagePaths(packageDir) {
|
|
|
3298
3286
|
entries
|
|
3299
3287
|
};
|
|
3300
3288
|
}
|
|
3301
|
-
/** Copies a file or folder and follows links. `node_modules` folders and paths that disappear during the copy are skipped. */
|
|
3302
3289
|
async function copyTree(source, target) {
|
|
3303
3290
|
const info = await unlessGone(() => stat(source));
|
|
3304
3291
|
if (!info) return;
|
|
@@ -4939,10 +4926,6 @@ const runs = shared[runsKey] ??= /* @__PURE__ */ new Map();
|
|
|
4939
4926
|
const startedKey = Symbol.for("vitehub.hints.started");
|
|
4940
4927
|
const startedShared = globalThis;
|
|
4941
4928
|
const started = startedShared[startedKey] ??= /* @__PURE__ */ new WeakSet();
|
|
4942
|
-
/**
|
|
4943
|
-
* The report of the ViteHub project root, where the other generated files go. A Nuxt app with `srcDir: "app"` has its
|
|
4944
|
-
* Vite root in `app/`, one folder below.
|
|
4945
|
-
*/
|
|
4946
4929
|
function hintsFile(config) {
|
|
4947
4930
|
const projectRoot = Reflect.get(config, VITEHUB_PROJECT_ROOT);
|
|
4948
4931
|
return resolve(typeof projectRoot === "string" ? projectRoot : resolveViteHubProjectRoot(config.root), viteHubHintsFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/kv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Vite-first key-value storage primitives and integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@valibot/to-json-schema": "^1.8.0",
|
|
73
|
-
"@vite-hub/runtime": "0.
|
|
73
|
+
"@vite-hub/runtime": "0.9.0",
|
|
74
74
|
"birpc": "^4.2.0",
|
|
75
75
|
"defu": "^6.1.7",
|
|
76
76
|
"destr": "^2.0.5",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@types/node": "^24.19.2",
|
|
85
85
|
"@electric-sql/pglite": "^0.5.17",
|
|
86
86
|
"@libsql/client": "^0.18.0",
|
|
87
|
-
"@vite-hub/database": "0.
|
|
87
|
+
"@vite-hub/database": "0.9.0",
|
|
88
88
|
"@types/pg": "^8.23.1",
|
|
89
89
|
"@types/proper-lockfile": "4.1.4",
|
|
90
90
|
"@vite-hub/internal": "0.0.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@upstash/redis": "^1.41.0",
|
|
103
|
-
"@vite-hub/database": "0.
|
|
103
|
+
"@vite-hub/database": "0.9.0",
|
|
104
104
|
"vite": ">=8.0.0"
|
|
105
105
|
},
|
|
106
106
|
"peerDependenciesMeta": {
|
package/dist/fs-lite-Co1NzxYo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as default } from "./fs-lite-1n_Dvy4p.js";
|