New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wrangler

Package Overview
Dependencies
Maintainers
1
Versions
4357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wrangler - npm Package Compare versions

Comparing version

to
0.0.0-5f151fc93

templates/middleware/middleware-patch-console-prefix.d.ts

8

bin/wrangler.js
#!/usr/bin/env node
const { spawn } = require("child_process");
const path = require("path");
const fs = require("fs");
const os = require("os");
const MIN_NODE_VERSION = "16.13.0";
const debug =
process.env["WRANGLER_LOG"] === "debug"
? (...args) => console.log(...args)
: () => {};
const MIN_NODE_VERSION = "18.0.0";

@@ -13,0 +7,0 @@ let wranglerProcess;

{
"name": "wrangler",
"version": "0.0.0-5ef6231a5",
"version": "0.0.0-5f151fc93",
"description": "Command-line interface for all things Cloudflare Workers",

@@ -53,25 +53,15 @@ "keywords": [

"dependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"blake3-wasm": "^2.1.5",
"chokidar": "^3.5.3",
"date-fns": "^4.1.0",
"esbuild": "0.17.19",
"itty-time": "^1.0.6",
"nanoid": "^3.3.3",
"path-to-regexp": "^6.3.0",
"resolve": "^1.22.8",
"resolve.exports": "^2.0.2",
"selfsigned": "^2.0.1",
"source-map": "^0.6.1",
"unenv": "npm:unenv-nightly@2.0.0-20241018-011344-e666fcf",
"workerd": "1.20241022.0",
"xxhash-wasm": "^1.0.1",
"@cloudflare/kv-asset-handler": "0.3.4",
"miniflare": "0.0.0-5ef6231a5",
"@cloudflare/workers-shared": "0.0.0-5ef6231a5"
"@cloudflare/unenv-preset": "2.3.0",
"blake3-wasm": "2.1.5",
"esbuild": "0.24.2",
"path-to-regexp": "6.3.0",
"unenv": "2.0.0-rc.15",
"workerd": "1.20250320.0",
"@cloudflare/kv-asset-handler": "0.4.0",
"miniflare": "0.0.0-5f151fc93"
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.721.0",
"@cloudflare/types": "6.18.4",
"@cloudflare/workers-types": "^4.20241022.0",
"@cloudflare/workers-types": "^4.20250320.0",
"@cspotcode/source-map-support": "0.8.1",

@@ -83,5 +73,3 @@ "@iarna/toml": "^3.0.0",

"@sentry/utils": "^7.86.0",
"@types/body-parser": "^1.19.2",
"@types/command-exists": "^1.2.0",
"@types/express": "^4.17.13",
"@types/glob-to-regexp": "^0.4.1",

@@ -92,6 +80,6 @@ "@types/is-ci": "^3.0.0",

"@types/minimatch": "^5.1.2",
"@types/node": "^18.19.75",
"@types/node-forge": "^1.3.11",
"@types/prompts": "^2.0.14",
"@types/react": "^18.3.3",
"@types/resolve": "^1.20.6",
"@types/serve-static": "^1.13.10",
"@types/shell-quote": "^1.7.2",

@@ -102,27 +90,20 @@ "@types/signal-exit": "^3.0.1",

"@types/yargs": "^17.0.22",
"@vitest/ui": "^1.6.0",
"@vitest/ui": "~3.0.8",
"@webcontainer/env": "^1.1.0",
"body-parser": "^1.20.0",
"chalk": "^5.2.0",
"chokidar": "^4.0.1",
"cli-table3": "^0.6.3",
"clipboardy": "^3.0.0",
"cmd-shim": "^4.1.0",
"command-exists": "^1.2.9",
"concurrently": "^8.2.2",
"date-fns": "^4.1.0",
"devtools-protocol": "^0.0.1182435",
"dotenv": "^16.0.0",
"es-module-lexer": "^1.3.0",
"dotenv": "^16.3.1",
"execa": "^6.1.0",
"express": "^4.18.1",
"find-up": "^6.3.0",
"get-port": "^7.0.0",
"glob-to-regexp": "^0.4.1",
"http-terminator": "^3.2.0",
"https-proxy-agent": "7.0.2",
"ignore": "^5.2.0",
"ink": "^3.2.0",
"ink-select-input": "^4.2.1",
"ink-spinner": "^4.0.3",
"ink-table": "^3.0.0",
"is-ci": "^3.0.1",
"itty-time": "^1.0.6",
"javascript-time-ago": "^2.5.4",

@@ -133,3 +114,4 @@ "md5-file": "5.0.0",

"mock-socket": "^9.3.1",
"msw": "^2.3.0",
"msw": "2.4.3",
"node-forge": "^1.3.1",
"open": "^8.4.0",

@@ -140,10 +122,9 @@ "p-queue": "^7.2.0",

"prompts": "^2.4.2",
"ps-list": "^8.1.1",
"react": "^18.3.1",
"react-error-boundary": "^3.1.4",
"resolve": "^1.22.8",
"rimraf": "^5.0.10",
"selfsigned": "^2.0.1",
"semiver": "^1.1.0",
"serve-static": "^1.15.0",
"shell-quote": "^1.8.1",
"shellac": "^0.8.0",
"signal-exit": "^3.0.7",
"source-map": "^0.6.1",
"strip-ansi": "^7.1.0",

@@ -154,17 +135,19 @@ "supports-color": "^9.2.2",

"ts-json-schema-generator": "^1.5.0",
"undici": "^5.28.4",
"typescript": "^5.7.2",
"undici": "^5.28.5",
"update-check": "^1.5.4",
"vitest": "~2.1.1",
"vitest-websocket-mock": "^0.3.0",
"ws": "^8.17.1",
"vitest": "~3.0.8",
"vitest-websocket-mock": "^0.4.0",
"ws": "8.18.0",
"xdg-app-paths": "^8.3.0",
"xxhash-wasm": "^1.0.1",
"yargs": "^17.7.2",
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
"@cloudflare/cli": "1.1.1",
"@cloudflare/pages-shared": "^0.13.17",
"@cloudflare/eslint-config-worker": "1.1.0",
"@cloudflare/workers-tsconfig": "0.0.0",
"@cloudflare/pages-shared": "^0.11.66"
"@cloudflare/workers-shared": "0.0.0-5f151fc93",
"@cloudflare/workers-tsconfig": "0.0.0"
},
"peerDependencies": {
"@cloudflare/workers-types": "^4.20241022.0"
"@cloudflare/workers-types": "^4.20250320.0"
},

@@ -177,6 +160,7 @@ "peerDependenciesMeta": {

"optionalDependencies": {
"fsevents": "~2.3.2"
"fsevents": "~2.3.2",
"sharp": "^0.33.5"
},
"engines": {
"node": ">=16.17.0"
"node": ">=18.0.0"
},

@@ -194,12 +178,12 @@ "volta": {

"check:lint": "eslint . --max-warnings=0",
"check:type": "tsc",
"check:type": "tsc -p ./tsconfig.json && tsc -p ./templates/tsconfig.json",
"clean": "rimraf wrangler-dist miniflare-dist emitted-types",
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
"generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json",
"generate-json-schema": "node -r esbuild-register scripts/generate-json-schema.ts",
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
"test": "pnpm run assert-git-version && vitest",
"test": "dotenv -- pnpm run assert-git-version && dotenv -- vitest",
"test:ci": "pnpm run test run",
"test:debug": "pnpm run test --silent=false --verbose=true",
"test:e2e": "vitest -c ./e2e/vitest.config.mts",
"test:e2e": "dotenv -- vitest -c ./e2e/vitest.config.mts",
"test:watch": "pnpm run test --testTimeout=50000 --watch",

@@ -206,0 +190,0 @@ "type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"

@@ -11,44 +11,38 @@ <h1 align="center"> ⛅️ wrangler </h1>

> [!WARNING]
>
> Wrangler v2 is **only receiving critical security updates.** We recommend you [migrate to Wrangler v3](https://developers.cloudflare.com/workers/wrangler/migration/update-v2-to-v3/) if you can.
## Quick Start
To get started quickly with a Hello World worker, run the command below:
```bash
# Make a javascript file
echo "export default { fetch() { return new Response('hello world') } }" > index.js
# try it out
npx wrangler dev index.js
# and then deploy it
npx wrangler deploy index.js --name my-worker
# visit https://my-worker.<your workers subdomain>.workers.dev
npx wrangler init my-worker -y
```
## Create a Project
For more info, visit our [Getting Started](https://developers.cloudflare.com/workers/get-started/guide/) guide.
```bash
# Generate a new project
npx wrangler init my-worker --no-delegate-c3
# try it out
cd my-worker && npm run start
# and then deploy it
npm run deploy
```
<details><summary>Wrangler System Requirements</summary>
## Installation:
We support running the Wrangler CLI with the [Current, Active, and Maintenance](https://nodejs.org/en/about/previous-releases) versions of Node.js. Your Worker will always be executed in `workerd`, the open source Cloudflare Workers runtime.
```bash
$ npm install wrangler --save-dev
```
Wrangler is only supported on macOS 13.5+, Windows 11, and Linux distros that support glib 2.35. This follows [`workerd`'s OS support policy](https://github.com/cloudflare/workerd?tab=readme-ov-file#running-workerd).
## Configuration:
</details>
Wrangler is configured via a `wrangler.toml` file in the project root. When utilizing the `wrangler init` command, a `wrangler.toml` file will be created for you.
## Documentation
Example:
For the latest Wrangler documentation, [click here](https://developers.cloudflare.com/workers/wrangler/).
To read more about Workers in general:
- [Getting Started](https://developers.cloudflare.com/workers/get-started/guide/)
- [How Workers works](https://developers.cloudflare.com/workers/reference/how-workers-works/)
- [Observability](https://developers.cloudflare.com/workers/observability/)
- [Platform](https://developers.cloudflare.com/workers/platform/)
## Configuration
Wrangler is configured via a `wrangler.toml` or `wrangler.json` file in the project root. An example configuration generated by `npx wrangler init` or `npx create cloudflare` is as follows:
```toml
name = "my-worker"
main = "./src/index.ts" # init w/ TypeScript
main = "./src/index.ts"
compatibility_date = "YYYY-MM-DD"

@@ -61,21 +55,19 @@ ```

### `wrangler init [name]`
### Workers
Creates a Worker project. For details on configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/#init).
#### `wrangler dev`
### `wrangler dev`
Start a local development server, with live reloading and devtools.
### `wrangler deploy`
#### `wrangler deploy`
Publish the given script to the worldwide Cloudflare network.
Publish the given script to Cloudflare's global network.
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/).
## Pages
### Pages
### `wrangler pages dev [directory] [-- command]`
#### `wrangler pages dev [directory]`
Either serves a static build asset directory, or proxies itself in front of a command.
Serves a static build asset directory.

@@ -85,5 +77,1 @@ Builds and runs functions from a `./functions` directory or uses a `_worker.js` file inside the static build asset directory.

For more commands and options, refer to the [documentation](https://developers.cloudflare.com/pages/platform/functions#develop-and-preview-locally) or run `wrangler pages dev --help`.
## Documentation
For the latest Wrangler documentation, [click here](https://developers.cloudflare.com/workers/wrangler/).
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import { unstable_dev } from "wrangler";
import type { UnstableDevWorker } from "wrangler";
import type { Unstable_DevWorker } from "wrangler";
describe("Worker", () => {
let worker: UnstableDevWorker;
let worker: Unstable_DevWorker;

@@ -8,0 +8,0 @@ beforeAll(async () => {

@@ -23,6 +23,7 @@ // @ts-ignore entry point will get replaced

if (isRoutingRuleMatch(pathname, include)) {
if (worker.fetch === undefined) {
const workerAsHandler = worker as ExportedHandler;
if (workerAsHandler.fetch === undefined) {
throw new TypeError("Entry point missing `fetch` handler");
}
return worker.fetch(request, env, context);
return workerAsHandler.fetch(request, env, context);
}

@@ -29,0 +30,0 @@ }

@@ -7,3 +7,10 @@ {

"include": ["**/*.ts"],
"exclude": ["__tests__", "./init-tests/**"]
"exclude": [
"__tests__",
"./init-tests/**",
// Note: `startDevWorker` and `middleware` should also be included but some work is needed
// for that first (see: https://github.com/cloudflare/workers-sdk/issues/8303)
"startDevWorker",
"middleware"
]
}

@@ -191,4 +191,3 @@ // templates/startDevWorker/InspectorProxyWorker.ts

tryDrainRuntimeMessageBuffer = () => {
if (this.websockets.devtools === void 0)
return;
if (this.websockets.devtools === void 0) return;
for (const msg of this.runtimeMessageBuffer.splice(0)) {

@@ -348,4 +347,3 @@ if (isDevToolsEvent(msg, "Debugger.scriptParsed")) {

let hostHeader = req.headers.get("Host");
if (hostHeader == null)
return new Response(null, { status: 400 });
if (hostHeader == null) return new Response(null, { status: 400 });
try {

@@ -369,6 +367,4 @@ const host = new URL(`http://${hostHeader}`);

const allowed = ALLOWED_ORIGIN_HOSTNAMES.some((rule) => {
if (typeof rule === "string")
return origin.hostname === rule;
else
return rule.test(origin.hostname);
if (typeof rule === "string") return origin.hostname === rule;
else return rule.test(origin.hostname);
});

@@ -375,0 +371,0 @@ if (!allowed) {

@@ -88,4 +88,3 @@ // src/api/startDevWorker/utils.ts

const { proxyData } = this;
if (proxyData === void 0)
return;
if (proxyData === void 0) return;
for (const [request, deferredResponse] of this.getOrderedQueue()) {

@@ -105,8 +104,6 @@ this.requestRetryQueue.delete(request);

const encoding = request.cf?.clientAcceptEncoding;
if (encoding !== void 0)
headers.set("Accept-Encoding", encoding);
if (encoding !== void 0) headers.set("Accept-Encoding", encoding);
rewriteUrlRelatedHeaders(headers, outerUrl, innerUrl);
for (const [key, value] of Object.entries(proxyData.headers ?? {})) {
if (value === void 0)
continue;
if (value === void 0) continue;
if (key.toLowerCase() === "cookie") {

@@ -113,0 +110,0 @@ const existing = request.headers.get("cookie") ?? "";

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet