.gitignore + untrack build outputs (node_modules, dist) — the nested repo needs its own ignore rules; the pipeline rebuilds anyway
deploy / build-and-publish (push) Successful in 45s
deploy / build-and-publish (push) Successful in 45s
This commit is contained in:
-70
@@ -1,70 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _utils = require("./utils/index.cjs");
|
||||
const DRIVER_NAME = "vercel-runtime-cache";
|
||||
module.exports = (0, _utils.defineDriver)(opts => {
|
||||
const base = (0, _utils.normalizeKey)(opts?.base);
|
||||
const r = key => (0, _utils.encodeURLSegment)(DRIVER_NAME, (0, _utils.joinKeys)(base, key), key).replace(/%3A/g, ":");
|
||||
let _fallback;
|
||||
const getClient = () => getContext()?.cache || (_fallback ??= getFallbackCache());
|
||||
return {
|
||||
name: DRIVER_NAME,
|
||||
getInstance: getClient,
|
||||
async hasItem(key) {
|
||||
const value = await getClient().get(r(key));
|
||||
return value !== void 0 && value !== null;
|
||||
},
|
||||
async getItem(key) {
|
||||
const value = await getClient().get(r(key));
|
||||
return value === void 0 ? null : value;
|
||||
},
|
||||
async setItem(key, value, tOptions) {
|
||||
const ttl = tOptions?.ttl ?? opts?.ttl;
|
||||
const tags = [...(tOptions?.tags || []), ...(opts?.tags || [])].filter(Boolean);
|
||||
await getClient().set(r(key), value, {
|
||||
ttl,
|
||||
tags
|
||||
});
|
||||
},
|
||||
async removeItem(key) {
|
||||
await getClient().delete(r(key));
|
||||
},
|
||||
async getKeys(_base) {
|
||||
return [];
|
||||
},
|
||||
async clear(_base) {
|
||||
if (opts?.tags && opts.tags.length > 0) {
|
||||
await getClient().expireTag(opts.tags);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
const SYMBOL_FOR_REQ_CONTEXT = /* @__PURE__ */Symbol.for("@vercel/request-context");
|
||||
function getContext() {
|
||||
const fromSymbol = globalThis;
|
||||
return fromSymbol[SYMBOL_FOR_REQ_CONTEXT]?.get?.() ?? {};
|
||||
}
|
||||
function getFallbackCache() {
|
||||
const cache = tryRequireVCFunctions()?.getCache?.({
|
||||
keyHashFunction: key => key,
|
||||
namespaceSeparator: ":"
|
||||
});
|
||||
if (!cache) {
|
||||
throw new Error("Runtime cache is not available!");
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
let _vcFunctionsLib;
|
||||
function tryRequireVCFunctions() {
|
||||
if (!_vcFunctionsLib) {
|
||||
const {
|
||||
createRequire
|
||||
} = globalThis.process?.getBuiltinModule?.("node:module") || {};
|
||||
_vcFunctionsLib = createRequire?.(require('url').pathToFileURL(__filename).toString())("@vercel/functions");
|
||||
}
|
||||
return _vcFunctionsLib;
|
||||
}
|
||||
Reference in New Issue
Block a user