0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-31 23:31:30 -05:00

fix: re-export unstorage drivers

This commit is contained in:
Matt Kane 2024-11-22 13:10:55 +00:00
parent 82551aeef5
commit 7ef8126b0e
31 changed files with 75 additions and 3 deletions

View file

@ -69,7 +69,8 @@
"publint": "^0.2.12",
"turbo": "^2.2.3",
"typescript": "~5.6.3",
"typescript-eslint": "^8.13.0"
"typescript-eslint": "^8.13.0",
"unstorage": "^1.12.0"
},
"pnpm": {
"overrides": {

View file

@ -67,6 +67,7 @@
"./assets/services/noop": "./dist/assets/services/noop.js",
"./loaders": "./dist/content/loaders/index.js",
"./content/runtime": "./dist/content/runtime.js",
"./internal/storage/drivers/*": "./dist/storage/drivers/*.js",
"./content/runtime-assets": "./dist/content/runtime-assets.js",
"./debug": "./components/Debug.astro",
"./package.json": "./package.json",

View file

@ -344,7 +344,7 @@ export class AstroSession<TDriver extends SessionDriverName = any> {
* Ensures the storage is initialized.
* This is called automatically when a storage operation is needed.
*/
async #ensureStorage():Promise<Storage> {
async #ensureStorage(): Promise<Storage> {
if (this.#storage) {
return this.#storage;
}
@ -364,7 +364,9 @@ export class AstroSession<TDriver extends SessionDriverName = any> {
let driver: ((config: SessionConfig<TDriver>['options']) => Driver) | null = null;
const entry =
builtinDrivers[this.#config.driver as keyof typeof builtinDrivers] || this.#config.driver;
this.#config.driver in builtinDrivers
? `astro/internal/storage/drivers/${this.#config.driver}`
: this.#config.driver;
try {
// Try to load the driver from the built-in unstorage drivers.
// Otherwise, assume it's a custom driver and load by name.

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/azure-app-configuration";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/azure-cosmos";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/azure-key-vault";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/azure-storage-blob";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/azure-storage-table";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/cloudflare-kv-binding";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/cloudflare-kv-http";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/cloudflare-kv-binding";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/cloudflare-kv-http";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/cloudflare-r2-binding";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/fs";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/fs-lite";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/github";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/http";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/indexedb";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/localstorage";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/lru-cache";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/memory";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/mongodb";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/netlify-blobs";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/null";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/overlay";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/planetscale";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/redis";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/session-storage";

View file

@ -0,0 +1,2 @@
// Auto-generated file. Do not edit
export { default } from "unstorage/drivers/vercel-kv";

3
pnpm-lock.yaml generated
View file

@ -64,6 +64,9 @@ importers:
typescript-eslint:
specifier: ^8.13.0
version: 8.13.0(eslint@9.14.0(jiti@2.4.0))(typescript@5.6.3)
unstorage:
specifier: ^1.12.0
version: 1.13.1
benchmark:
dependencies:

View file

@ -0,0 +1,13 @@
// @ts-check
import { builtinDrivers } from 'unstorage';
import { promises as fs } from 'node:fs';
async function generateStorageReexports() {
await fs.mkdir(new URL('../../packages/astro/src/storage/drivers', import.meta.url), { recursive: true });
for (const key in builtinDrivers) {
const exports = `// Auto-generated file. Do not edit\nexport { default } from "${builtinDrivers[key]}";`;
await fs.writeFile(new URL(`../../packages/astro/src/storage/drivers/${key}.js`, import.meta.url), exports);
}
}
generateStorageReexports();