miniflare
Advanced tools
Comparing version 0.0.0-67711c215 to 0.0.0-68a2a8460
@@ -13,3 +13,7 @@ // src/workers/assets/assets-kv.worker.ts | ||
let { filePath, contentType } = entry, response = await env[SharedBindings.MAYBE_SERVICE_BLOBS].fetch( | ||
new URL(filePath, "http://placeholder") | ||
new URL( | ||
// somewhere in blobservice I think this is being decoded again | ||
filePath.split("/").map((x) => encodeURIComponent(x)).join("/"), | ||
"http://placeholder" | ||
) | ||
), newResponse = new Response(response.body, response); | ||
@@ -16,0 +20,0 @@ return newResponse.headers.append( |
@@ -29,5 +29,5 @@ var __create = Object.create; | ||
// ../../node_modules/.pnpm/http-cache-semantics@4.1.0/node_modules/http-cache-semantics/index.js | ||
// ../../node_modules/.pnpm/http-cache-semantics@4.1.1/node_modules/http-cache-semantics/index.js | ||
var require_http_cache_semantics = __commonJS({ | ||
"../../node_modules/.pnpm/http-cache-semantics@4.1.0/node_modules/http-cache-semantics/index.js"(exports, module) { | ||
"../../node_modules/.pnpm/http-cache-semantics@4.1.1/node_modules/http-cache-semantics/index.js"(exports, module) { | ||
"use strict"; | ||
@@ -41,2 +41,3 @@ var statusCodeCacheableByDefault = /* @__PURE__ */ new Set([ | ||
301, | ||
308, | ||
404, | ||
@@ -96,6 +97,6 @@ 405, | ||
return cc; | ||
let parts = header.trim().split(/\s*,\s*/); | ||
let parts = header.trim().split(/,/); | ||
for (let part of parts) { | ||
let [k, v] = part.split(/\s*=\s*/, 2); | ||
cc[k] = v === void 0 ? !0 : v.replace(/^"|"$/g, ""); | ||
let [k, v] = part.split(/=/, 2); | ||
cc[k.trim()] = v === void 0 ? !0 : v.trim().replace(/^"|"$/g, ""); | ||
} | ||
@@ -102,0 +103,0 @@ return cc; |
@@ -689,3 +689,3 @@ // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs | ||
function isObject(value) { | ||
return value && typeof value == "object"; | ||
return !!value && typeof value == "object"; | ||
} | ||
@@ -695,2 +695,5 @@ function getType(value) { | ||
} | ||
function isInternal(value) { | ||
return isObject(value) && value[Symbol.for("cloudflare:internal-class")]; | ||
} | ||
var ProxyServer = class { | ||
@@ -710,3 +713,3 @@ constructor(_state, env) { | ||
let type = getType(value); | ||
if (type === "Object" && !isPlainObject(value) || type === "Promise") { | ||
if ((type === "Object" || isInternal(value)) && !isPlainObject(value) || type === "Promise") { | ||
let address = this.nextHeapAddress++; | ||
@@ -713,0 +716,0 @@ this.heap.set(address, value), assert2(value !== null); |
@@ -60,5 +60,7 @@ var __defProp = Object.defineProperty; | ||
maxRetires: z.number().min(0).max(100).optional(), | ||
// deprecated | ||
maxRetries: z.number().min(0).max(100).optional(), | ||
deadLetterQueue: z.ostring(), | ||
retryDelay: QueueMessageDelaySchema | ||
}), QueueConsumerSchema = /* @__PURE__ */ z.intersection( | ||
}).transform((queue) => (queue.maxRetires !== void 0 && (queue.maxRetries = queue.maxRetires), queue)), QueueConsumerSchema = /* @__PURE__ */ z.intersection( | ||
QueueConsumerOptionsSchema, | ||
@@ -180,3 +182,5 @@ z.object({ workerName: z.string() }) | ||
get #maybeProducer() { | ||
return this.#producers[this.name]; | ||
return Object.values(this.#producers).find( | ||
(p) => p?.queueName === this.name | ||
); | ||
} | ||
@@ -201,3 +205,3 @@ get #maybeConsumer() { | ||
assert(consumer !== void 0); | ||
let batchSize = consumer.maxBatchSize ?? DEFAULT_BATCH_SIZE, maxAttempts = (consumer.maxRetires ?? DEFAULT_RETRIES) + 1, maxAttemptsS = maxAttempts === 1 ? "" : "s", batch = this.#messages.splice(0, batchSize), startTime = Date.now(), endTime, response; | ||
let batchSize = consumer.maxBatchSize ?? DEFAULT_BATCH_SIZE, maxAttempts = (consumer.maxRetries ?? DEFAULT_RETRIES) + 1, maxAttemptsS = maxAttempts === 1 ? "" : "s", batch = this.#messages.splice(0, batchSize), startTime = Date.now(), endTime, response; | ||
try { | ||
@@ -268,13 +272,17 @@ response = await this.#dispatchBatch(consumer.workerName, batch), endTime = Date.now(); | ||
message = async (req) => { | ||
if (this.#maybeConsumer === void 0) | ||
return new Response(); | ||
validateMessageSize(req.headers); | ||
let contentType = validateContentType(req.headers), delay = validateMessageDelay(req.headers), body = Buffer2.from(await req.arrayBuffer()); | ||
return this.#maybeConsumer === void 0 ? new Response() : (this.#enqueue( | ||
let contentType = validateContentType(req.headers), delay = validateMessageDelay(req.headers) ?? this.#maybeProducer?.deliveryDelay, body = Buffer2.from(await req.arrayBuffer()); | ||
return this.#enqueue( | ||
[{ contentType, delaySecs: delay, body }], | ||
this.#maybeProducer?.deliveryDelay | ||
), new Response()); | ||
), new Response(); | ||
}; | ||
batch = async (req) => { | ||
if (this.#maybeConsumer === void 0) | ||
return new Response(); | ||
validateBatchSize(req.headers); | ||
let delay = validateMessageDelay(req.headers) ?? this.#maybeProducer?.deliveryDelay, body = QueuesBatchRequestSchema.parse(await req.json()); | ||
return this.#maybeConsumer === void 0 ? new Response() : (this.#enqueue(body.messages, delay), new Response()); | ||
return this.#enqueue(body.messages, delay), new Response(); | ||
}; | ||
@@ -281,0 +289,0 @@ }; |
{ | ||
"name": "miniflare", | ||
"version": "0.0.0-67711c215", | ||
"version": "0.0.0-68a2a8460", | ||
"description": "Fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -41,4 +41,4 @@ "keywords": [ | ||
"undici": "^5.28.4", | ||
"workerd": "1.20240821.1", | ||
"ws": "^8.17.1", | ||
"workerd": "1.20241022.0", | ||
"ws": "^8.18.0", | ||
"youch": "^3.2.2", | ||
@@ -49,3 +49,3 @@ "zod": "^3.22.3" | ||
"@ava/typescript": "^4.1.0", | ||
"@cloudflare/workers-types": "^4.20240821.1", | ||
"@cloudflare/workers-types": "^4.20241022.0", | ||
"@microsoft/api-extractor": "^7.47.0", | ||
@@ -57,3 +57,3 @@ "@types/debug": "^4.1.7", | ||
"@types/mime": "^3.0.4", | ||
"@types/node": "20.8.3", | ||
"@types/node": "^18.19.59", | ||
"@types/rimraf": "^4.0.5", | ||
@@ -77,2 +77,3 @@ "@types/stoppable": "^1.1.1", | ||
"expect-type": "^0.15.0", | ||
"heap-js": "^2.5.0", | ||
"http-cache-semantics": "^4.1.0", | ||
@@ -86,3 +87,4 @@ "kleur": "^4.1.5", | ||
"@cloudflare/kv-asset-handler": "0.3.4", | ||
"@cloudflare/workers-shared": "0.0.0-67711c215" | ||
"@cloudflare/workers-shared": "0.0.0-68a2a8460", | ||
"@cloudflare/workflows-shared": "0.1.1" | ||
}, | ||
@@ -89,0 +91,0 @@ "engines": { |
@@ -217,2 +217,16 @@ # 🔥 Miniflare | ||
### `interface WorkflowOptions` | ||
- `name: string` | ||
The name of the Workflow. | ||
- `className: string` | ||
The name of the class exported from the Worker that implements the `WorkflowEntrypoint`. | ||
- `scriptName?`: string | ||
The name of the script that includes the `WorkflowEntrypoint`. This is optional because it defaults to the current script if not set. | ||
#### Core | ||
@@ -578,2 +592,18 @@ | ||
#### Assets | ||
- `directory?: string` | ||
Path to serve Workers static asset files from. | ||
- `binding?: string` | ||
Binding name to inject as a `Fetcher` binding to allow access to static assets from within the Worker. | ||
- `assetOptions?: { html_handling?: HTMLHandlingOptions, not_found_handling?: NotFoundHandlingOptions}` | ||
Configuration for file-based asset routing - see [docs](https://developers.cloudflare.com/workers/static-assets/routing/#routing-configuration) for options | ||
#### Workflows | ||
- `workflows?: WorkflowOptions[]` | ||
Configuration for one or more Workflows in your project. | ||
#### Analytics Engine, Sending Email, Vectorize and Workers for Platforms | ||
@@ -719,2 +749,6 @@ | ||
- `workflowsPersist?: Persistence` | ||
Where to persist data stored in Workflows. See docs for `Persistence`. | ||
#### Analytics Engine, Browser Rendering, Sending Email, Vectorize, Workers AI and Workers for Platforms | ||
@@ -721,0 +755,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
2705453
40
42149
882
387
38
50
12
+ Added@cloudflare/workerd-darwin-64@1.20241022.0(transitive)
+ Added@cloudflare/workerd-darwin-arm64@1.20241022.0(transitive)
+ Added@cloudflare/workerd-linux-64@1.20241022.0(transitive)
+ Added@cloudflare/workerd-linux-arm64@1.20241022.0(transitive)
+ Added@cloudflare/workerd-windows-64@1.20241022.0(transitive)
+ Addedworkerd@1.20241022.0(transitive)
- Removed@cloudflare/workerd-darwin-64@1.20240821.1(transitive)
- Removed@cloudflare/workerd-darwin-arm64@1.20240821.1(transitive)
- Removed@cloudflare/workerd-linux-64@1.20240821.1(transitive)
- Removed@cloudflare/workerd-linux-arm64@1.20240821.1(transitive)
- Removed@cloudflare/workerd-windows-64@1.20240821.1(transitive)
- Removedworkerd@1.20240821.1(transitive)
Updatedworkerd@1.20241022.0
Updatedws@^8.18.0