@miniflare/core
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
@@ -483,3 +483,3 @@ /// <reference types="node" /> | ||
#private; | ||
static redirect(url: string | URL_2, status: ResponseRedirectStatus): Response_2; | ||
static redirect(url: string | URL_2, status?: ResponseRedirectStatus): Response_2; | ||
[kWaitUntil]?: Promise<WaitUntil>; | ||
@@ -486,0 +486,0 @@ constructor(body?: BodyInit_2, init?: ResponseInit_2 | Response_2 | Response_3); |
{ | ||
"name": "@miniflare/core", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"description": "Core module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"@iarna/toml": "^2.2.5", | ||
"@miniflare/shared": "2.0.0-rc.1", | ||
"@miniflare/shared": "2.0.0-rc.2", | ||
"busboy": "^0.3.1", | ||
@@ -49,8 +49,8 @@ "dotenv": "^10.0.0", | ||
"set-cookie-parser": "^2.4.8", | ||
"undici": "^4.9.3" | ||
"undici": "^4.10.2" | ||
}, | ||
"devDependencies": { | ||
"@miniflare/shared-test": "2.0.0-rc.1", | ||
"@miniflare/watcher": "2.0.0-rc.1", | ||
"@miniflare/web-sockets": "2.0.0-rc.1", | ||
"@miniflare/shared-test": "2.0.0-rc.2", | ||
"@miniflare/watcher": "2.0.0-rc.2", | ||
"@miniflare/web-sockets": "2.0.0-rc.2", | ||
"@types/busboy": "^0.3.1", | ||
@@ -61,3 +61,3 @@ "@types/set-cookie-parser": "^2.4.1", | ||
"peerDependencies": { | ||
"@miniflare/watcher": "2.0.0-rc.1" | ||
"@miniflare/watcher": "2.0.0-rc.2" | ||
}, | ||
@@ -64,0 +64,0 @@ "peerDependenciesMeta": { |
# `@miniflare/core` | ||
Core module for [Miniflare](https://github.com/cloudflare/miniflare): a fun, | ||
full-featured, fully-local simulator for Cloudflare Workers | ||
full-featured, fully-local simulator for Cloudflare Workers. See | ||
[🧰 Using the API](https://miniflare.dev/api.html) for more details. | ||
## Example | ||
```js | ||
import { CorePlugin, MiniflareCore } from "@miniflare/core"; | ||
import { KVPlugin } from "@miniflare/kv"; | ||
import { VMScriptRunner } from "@miniflare/runner-vm"; | ||
import { Log, LogLevel } from "@miniflare/shared"; | ||
import { MemoryStorage } from "@miniflare/storage-memory"; | ||
export class StorageFactory { | ||
storages = new Map(); | ||
storage(namespace) { | ||
let storage = this.storages.get(namespace); | ||
if (storage) return storage; | ||
this.storages.set(namespace, (storage = new MemoryStorage())); | ||
return storage; | ||
} | ||
} | ||
const plugins = { CorePlugin, KVPlugin }; | ||
const ctx = { | ||
log: new Log(LogLevel.INFO), | ||
storageFactory: new StorageFactory(), | ||
scriptRunner: new VMScriptRunner(), | ||
}; | ||
const mf = new MiniflareCore(plugins, ctx, { | ||
modules: true, | ||
script: `export default { | ||
async fetch(request, env) { | ||
return new Response(await env.TEST_NAMESPACE.get("key")); | ||
} | ||
}`, | ||
kvNamespaces: ["TEST_NAMESPACE"], | ||
}); | ||
const { TEST_NAMESPACE } = await mf.getBindings(); | ||
await TEST_NAMESPACE.put("key", "value"); | ||
const res = await mf.dispatchFetch("http://localhost"); | ||
console.log(await res.text()); // value | ||
``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125697
2540
50
7
+ Added@miniflare/shared@2.0.0-rc.2(transitive)
+ Added@miniflare/watcher@2.0.0-rc.2(transitive)
- Removed@miniflare/shared@2.0.0-rc.1(transitive)
- Removed@miniflare/watcher@2.0.0-rc.1(transitive)
Updated@miniflare/shared@2.0.0-rc.2
Updatedundici@^4.10.2