initial vitepress site with basic nav

This commit is contained in:
mrflos 2023-05-20 19:37:42 +03:00
parent a7df2e049d
commit 2029f16583
1900 changed files with 1014692 additions and 0 deletions

View file

@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
// @todo Add logger on options to debug when caches go wrong.
function createFallbackableCache(options) {
const caches = [...options.caches];
const current = caches.shift(); // eslint-disable-line functional/immutable-data
if (current === undefined) {
return createNullCache();
}
return {
get(key, defaultValue, events = {
miss: () => Promise.resolve(),
}) {
return current.get(key, defaultValue, events).catch(() => {
return createFallbackableCache({ caches }).get(key, defaultValue, events);
});
},
set(key, value) {
return current.set(key, value).catch(() => {
return createFallbackableCache({ caches }).set(key, value);
});
},
delete(key) {
return current.delete(key).catch(() => {
return createFallbackableCache({ caches }).delete(key);
});
},
clear() {
return current.clear().catch(() => {
return createFallbackableCache({ caches }).clear();
});
},
};
}
function createNullCache() {
return {
get(_key, defaultValue, events = {
miss: () => Promise.resolve(),
}) {
const value = defaultValue();
return value
.then(result => Promise.all([result, events.miss(result)]))
.then(([result]) => result);
},
set(_key, value) {
return Promise.resolve(value);
},
delete(_key) {
return Promise.resolve();
},
clear() {
return Promise.resolve();
},
};
}
exports.createFallbackableCache = createFallbackableCache;
exports.createNullCache = createNullCache;

View file

@ -0,0 +1,40 @@
import { Cache as Cache_2 } from '@algolia/cache-common';
export declare type Cache = {
/**
* Gets the value of the given `key`.
*/
readonly get: <TValue>(key: object | string, defaultValue: () => Readonly<Promise<TValue>>, events?: CacheEvents<TValue>) => Readonly<Promise<TValue>>;
/**
* Sets the given value with the given `key`.
*/
readonly set: <TValue>(key: object | string, value: TValue) => Readonly<Promise<TValue>>;
/**
* Deletes the given `key`.
*/
readonly delete: (key: object | string) => Readonly<Promise<void>>;
/**
* Clears the cache.
*/
readonly clear: () => Readonly<Promise<void>>;
};
export declare type CacheEvents<TValue> = {
/**
* The callback when the given `key` is missing from the cache.
*/
readonly miss: (value: TValue) => Readonly<Promise<any>>;
};
export declare function createFallbackableCache(options: FallbackableCacheOptions): Cache;
export declare function createNullCache(): Cache;
export declare type FallbackableCacheOptions = {
/**
* List of caches order by priority.
*/
readonly caches: readonly Cache_2[];
};
export { }

View file

@ -0,0 +1,56 @@
// @todo Add logger on options to debug when caches go wrong.
function createFallbackableCache(options) {
const caches = [...options.caches];
const current = caches.shift(); // eslint-disable-line functional/immutable-data
if (current === undefined) {
return createNullCache();
}
return {
get(key, defaultValue, events = {
miss: () => Promise.resolve(),
}) {
return current.get(key, defaultValue, events).catch(() => {
return createFallbackableCache({ caches }).get(key, defaultValue, events);
});
},
set(key, value) {
return current.set(key, value).catch(() => {
return createFallbackableCache({ caches }).set(key, value);
});
},
delete(key) {
return current.delete(key).catch(() => {
return createFallbackableCache({ caches }).delete(key);
});
},
clear() {
return current.clear().catch(() => {
return createFallbackableCache({ caches }).clear();
});
},
};
}
function createNullCache() {
return {
get(_key, defaultValue, events = {
miss: () => Promise.resolve(),
}) {
const value = defaultValue();
return value
.then(result => Promise.all([result, events.miss(result)]))
.then(([result]) => result);
},
set(_key, value) {
return Promise.resolve(value);
},
delete(_key) {
return Promise.resolve();
},
clear() {
return Promise.resolve();
},
};
}
export { createFallbackableCache, createNullCache };

2
node_modules/@algolia/cache-common/index.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
// eslint-disable-next-line functional/immutable-data, import/no-commonjs
module.exports = require('./dist/cache-common.cjs.js');

19
node_modules/@algolia/cache-common/package.json generated vendored Normal file
View file

@ -0,0 +1,19 @@
{
"name": "@algolia/cache-common",
"version": "4.17.0",
"private": false,
"description": "Common interfaces for promise-based caching libraries",
"repository": {
"type": "git",
"url": "git://github.com/algolia/algoliasearch-client-js.git"
},
"license": "MIT",
"sideEffects": false,
"main": "index.js",
"module": "dist/cache-common.esm.js",
"types": "dist/cache-common.d.ts",
"files": [
"index.js",
"dist"
]
}