Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

miniflare

Package Overview
Dependencies
Maintainers
1
Versions
470
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniflare - npm Package Compare versions

Comparing version 2.0.0-next.3 to 2.0.0-rc.1

16

bootstrap.js

@@ -32,11 +32,9 @@ #!/usr/bin/env node

/* Spawn a new process using the same Node.js executable and passing the same
* command line arguments, but with required flags for source map and modules
* support.
*
* This is the only cross-platform way of doing this I can think of. On
* Mac/Linux, we can use "#!/usr/bin/env -S node ..." as a shebang, but this
* won't work on Windows (or older Linux versions, e.g. Ubuntu 18.04). If you
* can think of a better way of doing this, please open a GitHub issue.
*/
// Spawn a new process using the same Node.js executable and passing the same
// command line arguments, but with required flags for modules support.
//
// This is the only cross-platform way of doing this I can think of. On
// Mac/Linux, we can use "#!/usr/bin/env -S node ..." as a shebang, but this
// won't work on Windows (or older Linux versions, e.g. Ubuntu 18.04). If you
// can think of a better way of doing this, please open a GitHub issue.
childProcess

@@ -43,0 +41,0 @@ .spawn(

@@ -8,3 +8,2 @@ #!/usr/bin/env node

import { red } from "kleur/colors";
import sourceMap from "source-map-support";

@@ -50,3 +49,2 @@ // packages/miniflare/src/updater.ts

var __dirname = path.dirname(__filename);
sourceMap.install({ emptyCacheBetweenOperations: true });
function suppressWarnings() {

@@ -99,5 +97,9 @@ const originalEmitWarning = process.emitWarning;

}
if (options.durableObjects && Object.keys(options.durableObjects).length) {
options.modules = true;
}
const logLevel = options?.verbose ? LogLevel.VERBOSE : options?.debug ? LogLevel.DEBUG : LogLevel.INFO;
const mfOptions = options;
mfOptions.log = new Log(logLevel);
mfOptions.sourceMap = true;
const mf = new Miniflare(mfOptions);

@@ -109,2 +111,4 @@ try {

mf.log.error(e);
if (e.cause)
mf.log.error(e.cause);
process.exitCode = 1;

@@ -119,5 +123,5 @@ return;

const pkg = JSON.parse(await fs2.readFile(pkgFile, "utf8"));
const mfDir = path.resolve(".mf");
await fs2.mkdir(mfDir, { recursive: true });
const lastCheckFile = path.join(mfDir, "update-check");
const cacheDir = path.resolve("node_modules", ".mf");
await fs2.mkdir(cacheDir, { recursive: true });
const lastCheckFile = path.join(cacheDir, "update-check");
await updateCheck({ pkg, lastCheckFile, log: mf.log });

@@ -124,0 +128,0 @@ } catch (e) {

@@ -6,2 +6,3 @@ /// <reference types="node" />

import { CachePlugin } from '@miniflare/cache';
import { CacheStorage as CacheStorage_2 } from '@miniflare/cache';
import { CorePlugin } from '@miniflare/core';

@@ -20,5 +21,6 @@ import { DurableObjectId } from '@miniflare/durable-objects';

import { Log } from '@miniflare/shared';
import { LogLevel } from '@miniflare/shared';
import type { MemoryStorage } from '@miniflare/storage-memory';
import { MiniflareCore } from '@miniflare/core';
import { Options } from '@miniflare/shared';
import { MiniflareCoreOptions } from '@miniflare/core';
import { Scheduler } from '@miniflare/scheduler';

@@ -31,2 +33,6 @@ import { SchedulerPlugin } from '@miniflare/scheduler';

export { Log }
export { LogLevel }
export declare class Miniflare extends MiniflareCore<Plugins> {

@@ -37,2 +43,3 @@ #private;

getKVNamespace(namespace: string): Promise<KVNamespace>;
getCaches(): Promise<CacheStorage_2>;
getDurableObjectNamespace(objectName: string): Promise<DurableObjectNamespace>;

@@ -45,4 +52,5 @@ getDurableObjectStorage(id: DurableObjectId): Promise<DurableObjectStorage>;

export declare type MiniflareOptions = Omit<Options<Plugins>, "debug" | "verbose"> & {
export declare type MiniflareOptions = Omit<MiniflareCoreOptions<Plugins>, "debug" | "verbose"> & {
log?: Log;
sourceMap?: boolean;
};

@@ -49,0 +57,0 @@

@@ -23,2 +23,3 @@ // packages/miniflare/src/api.ts

import { WebSocketPlugin } from "@miniflare/web-sockets";
import sourceMap from "source-map-support";

@@ -82,2 +83,5 @@ // packages/miniflare/src/storage.ts

constructor(options) {
if (options?.sourceMap) {
sourceMap.install({ emptyCacheBetweenOperations: true });
}
const storageFactory = new VariedStorageFactory();

@@ -101,2 +105,6 @@ super(PLUGINS, {

}
async getCaches() {
const plugin = (await this.getPlugins()).CachePlugin;
return plugin.getCaches();
}
async getDurableObjectNamespace(objectName) {

@@ -159,3 +167,8 @@ const plugin = (await this.getPlugins()).DurableObjectsPlugin;

}
// packages/miniflare/src/index.ts
import { Log as Log2, LogLevel } from "@miniflare/shared";
export {
Log2 as Log,
LogLevel,
Miniflare,

@@ -162,0 +175,0 @@ PLUGINS,

{
"name": "miniflare",
"version": "2.0.0-next.3",
"version": "2.0.0-rc.1",
"description": "Fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -15,3 +15,6 @@ "keywords": [

"type": "module",
"exports": "./dist/src/index.js",
"exports": {
".": "./dist/src/index.js",
"./cli": "./dist/src/cli.js"
},
"types": "./dist/src/index.d.ts",

@@ -47,17 +50,17 @@ "files": [

"dependencies": {
"@miniflare/cache": "2.0.0-next.3",
"@miniflare/cli-parser": "2.0.0-next.3",
"@miniflare/core": "2.0.0-next.3",
"@miniflare/durable-objects": "2.0.0-next.3",
"@miniflare/html-rewriter": "2.0.0-next.3",
"@miniflare/http-server": "2.0.0-next.3",
"@miniflare/kv": "2.0.0-next.3",
"@miniflare/runner-vm": "2.0.0-next.3",
"@miniflare/scheduler": "2.0.0-next.3",
"@miniflare/shared": "2.0.0-next.3",
"@miniflare/sites": "2.0.0-next.3",
"@miniflare/storage-file": "2.0.0-next.3",
"@miniflare/storage-memory": "2.0.0-next.3",
"@miniflare/watcher": "2.0.0-next.3",
"@miniflare/web-sockets": "2.0.0-next.3",
"@miniflare/cache": "2.0.0-rc.1",
"@miniflare/cli-parser": "2.0.0-rc.1",
"@miniflare/core": "2.0.0-rc.1",
"@miniflare/durable-objects": "2.0.0-rc.1",
"@miniflare/html-rewriter": "2.0.0-rc.1",
"@miniflare/http-server": "2.0.0-rc.1",
"@miniflare/kv": "2.0.0-rc.1",
"@miniflare/runner-vm": "2.0.0-rc.1",
"@miniflare/scheduler": "2.0.0-rc.1",
"@miniflare/shared": "2.0.0-rc.1",
"@miniflare/sites": "2.0.0-rc.1",
"@miniflare/storage-file": "2.0.0-rc.1",
"@miniflare/storage-memory": "2.0.0-rc.1",
"@miniflare/watcher": "2.0.0-rc.1",
"@miniflare/web-sockets": "2.0.0-rc.1",
"kleur": "^4.1.4",

@@ -69,9 +72,9 @@ "semiver": "^1.1.0",

"devDependencies": {
"@miniflare/shared-test": "2.0.0-next.3",
"@miniflare/shared-test": "2.0.0-rc.1",
"@types/source-map-support": "^0.5.4"
},
"peerDependencies": {
"@miniflare/storage-redis": "2.0.0-next.3",
"ioredis": "^4.27.9",
"node-cron": "^3.0.0"
"@miniflare/storage-redis": "2.0.0-rc.1",
"cron-schedule": "^3.0.4",
"ioredis": "^4.27.9"
},

@@ -78,0 +81,0 @@ "peerDependenciesMeta": {

@@ -32,4 +32,4 @@ # 🔥 Miniflare

[122 third-party packages](http://npm.anvaka.com/#/view/2d/miniflare) with a
total install size of `88.3MB`. Miniflare 2 reduces this to **24 packages and
`11.5MB`** 🤯. This can probably be reduced further too.
total install size of `88.3MB`. Miniflare 2 reduces this to **23 packages and
`6.2MB`** 🤯.
3. ✅ **Correct:** Miniflare 2 more accurately replicates the quirks and thrown

@@ -118,2 +118,4 @@ errors of the real Workers runtime, so you'll know before you deploy if

--(no-)update-check Enable update checker (enabled by default) [boolean]
--root Path to resolve default config files relative to [string]
--mount Mount additional named workers [array:NAME=PATH]

@@ -120,0 +122,0 @@ HTTP Options:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc