Skip to content

Commit

Permalink
Merge branch 'main' into fix/optional-opts
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 31, 2024
2 parents fae841e + cf7f3ce commit ddfc00e
Show file tree
Hide file tree
Showing 15 changed files with 1,619 additions and 1,594 deletions.
4 changes: 2 additions & 2 deletions docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await storage.has("foo:bar");

### `getItem(key, opts?)`

Gets the value of a key in storage. Resolves to either a JavaScript primitive value or `undefined`.
Gets the value of a key in storage. Resolves to either a JavaScript primitive value or `null`.

```js
await storage.getItem("foo:bar");
Expand Down Expand Up @@ -341,7 +341,7 @@ const postStorage = prefixStorage<Post>(storage, "assets:posts");
await postStorage.getItem("foo.json"); // => <Post>
```

In [strict mode](https://www.typescriptlang.org/tsconfig#strict), it will also return the `undefined` type to help you handle the case when `getItem` is missing.
In [strict mode](https://www.typescriptlang.org/tsconfig#strict), it will also return the `null` type to help you handle the case when `getItem` is missing.

```ts
"use strict";
Expand Down
20 changes: 20 additions & 0 deletions docs/2.drivers/null.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
icon: bi:trash3-fill
---

# Null

> Discards all data.
::warning
This driver does NOT store any data. It will discard any data written to it and will always return null similar to [`/dev/null`](https://en.wikipedia.org/wiki/Null_device)
::

```js
import { createStorage } from "unstorage";
import nullDriver from "unstorage/drivers/null";

const storage = createStorage({
driver: nullDriver(),
});
```
Binary file modified docs/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dev": "undocs dev"
},
"devDependencies": {
"undocs": "^0.2.26"
"undocs": "^0.2.30"
}
}
7 changes: 2 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import unjs from "eslint-config-unjs";

export default unjs({
ignores: [
"drivers",
"/server*",
"docs/.*"
],
ignores: ["drivers", "/server*", "docs/.*"],
rules: {
"unicorn/no-null": 0,
"unicorn/prevent-abbreviations": 0,
Expand All @@ -16,5 +12,6 @@ export default unjs({
"unicorn/prefer-logical-operator-over-ternary": 0,
"unicorn/prefer-ternary": 0,
"unicorn/prefer-string-raw": 0,
"@typescript-eslint/no-empty-object-type": 0,
},
});
74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"server.d.ts"
],
"scripts": {
"bench": "jiti test/server.bench.ts",
"build": "unbuild",
"demo": "vite demo",
"dev": "vitest",
Expand All @@ -39,75 +40,74 @@
"prepack": "pnpm build",
"release": "pnpm test && changelogen --release && git push --follow-tags && pnpm publish",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
"bench": "jiti test/server.bench.ts",
"test:types": "tsc --noEmit --skipLibCheck",
"unstorage": "pnpm jiti src/cli"
},
"dependencies": {
"anymatch": "^3.1.3",
"chokidar": "^3.6.0",
"chokidar": "^4.0.1",
"destr": "^2.0.3",
"h3": "^1.12.0",
"listhen": "^1.7.2",
"h3": "^1.13.0",
"listhen": "^1.9.0",
"lru-cache": "^10.4.3",
"mri": "^1.2.0",
"node-fetch-native": "^1.6.4",
"ofetch": "^1.3.4",
"ofetch": "^1.4.1",
"ufo": "^1.5.4"
},
"devDependencies": {
"@azure/app-configuration": "^1.7.0",
"@azure/cosmos": "^4.1.1",
"@azure/data-tables": "^13.2.2",
"@azure/identity": "^4.4.1",
"@azure/keyvault-secrets": "^4.8.0",
"@azure/storage-blob": "^12.24.0",
"@azure/identity": "^4.5.0",
"@azure/keyvault-secrets": "^4.9.0",
"@azure/storage-blob": "^12.25.0",
"@capacitor/preferences": "^6.0.2",
"@cloudflare/workers-types": "^4.20240903.0",
"@netlify/blobs": "^7.4.0",
"@cloudflare/workers-types": "^4.20241022.0",
"@netlify/blobs": "^8.1.0",
"@planetscale/database": "^1.19.0",
"@types/ioredis-mock": "^8.2.5",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.5.4",
"@upstash/redis": "^1.34.0",
"@vercel/kv": "^1.0.1",
"@vitejs/plugin-vue": "^5.1.3",
"@vitest/coverage-v8": "^2.0.5",
"@vue/compiler-sfc": "^3.5.1",
"azurite": "^3.32.0",
"changelogen": "^0.5.5",
"eslint": "^9.9.1",
"eslint-config-unjs": "^0.3.2",
"@types/node": "^22.8.5",
"@upstash/redis": "^1.34.3",
"@vercel/kv": "^3.0.0",
"@vitejs/plugin-vue": "^5.1.4",
"@vitest/coverage-v8": "^2.1.4",
"@vue/compiler-sfc": "^3.5.12",
"azurite": "^3.33.0",
"changelogen": "^0.5.7",
"eslint": "^9.13.0",
"eslint-config-unjs": "^0.4.1",
"fake-indexeddb": "^6.0.0",
"idb-keyval": "^6.2.1",
"ioredis": "^5.4.1",
"ioredis-mock": "^8.9.0",
"jiti": "^1.21.6",
"jsdom": "^25.0.0",
"mitata": "^0.1.14",
"monaco-editor": "^0.51.0",
"mongodb": "^6.8.0",
"mongodb-memory-server": "^10.0.0",
"msw": "^1.3.3",
"jiti": "^2.3.3",
"jsdom": "^25.0.1",
"mitata": "^1.0.10",
"monaco-editor": "^0.52.0",
"mongodb": "^6.10.0",
"mongodb-memory-server": "^10.1.2",
"msw": "^1.3.5",
"prettier": "^3.3.3",
"types-cloudflare-worker": "^1.2.0",
"typescript": "^5.5.4",
"typescript": "^5.6.3",
"unbuild": "^2.0.0",
"vite": "^5.4.3",
"vitest": "^2.0.5",
"vue": "^3.5.1"
"vite": "^5.4.10",
"vitest": "^2.1.4",
"vue": "^3.5.12"
},
"peerDependencies": {
"@azure/app-configuration": "^1.7.0",
"@azure/cosmos": "^4.1.1",
"@azure/data-tables": "^13.2.2",
"@azure/identity": "^4.4.1",
"@azure/keyvault-secrets": "^4.8.0",
"@azure/storage-blob": "^12.24.0",
"@azure/identity": "^4.5.0",
"@azure/keyvault-secrets": "^4.9.0",
"@azure/storage-blob": "^12.25.0",
"@capacitor/preferences": "^6.0.2",
"@netlify/blobs": "^6.5.0 || ^7.0.0",
"@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0",
"@planetscale/database": "^1.19.0",
"@upstash/redis": "^1.34.0",
"@upstash/redis": "^1.34.3",
"@vercel/kv": "^1.0.1",
"idb-keyval": "^6.2.1",
"ioredis": "^5.4.1"
Expand Down Expand Up @@ -153,5 +153,5 @@
"optional": true
}
},
"packageManager": "pnpm@9.9.0"
"packageManager": "pnpm@9.12.3"
}
Loading

0 comments on commit ddfc00e

Please sign in to comment.