wrangler
Advanced tools
Comparing version 0.0.0-50407ed4 to 0.0.0-50437494e
@@ -23,3 +23,3 @@ #!/usr/bin/env node | ||
console.error( | ||
`Wrangler requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js. | ||
`Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of Node.js. | ||
@@ -32,26 +32,2 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.` | ||
let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS; | ||
if (pathToCACerts) { | ||
// TODO: | ||
// - should we log a warning here? | ||
// - maybe we can generate a certificate that concatenates with ours? | ||
// | ||
// I do think it'll be rare that someone wants to add a cert AND | ||
// use Cloudflare WARP, but let's wait till the situation actually | ||
// arises before we do anything about it | ||
} else { | ||
const osTempDir = os.tmpdir(); | ||
const certDir = path.join(osTempDir, "wrangler-cert"); | ||
const certPath = path.join(certDir, "Cloudflare_CA.pem"); | ||
// copy cert to the system temp dir if needed | ||
if (!fs.existsSync(certPath)) { | ||
fs.mkdirSync(certDir, { recursive: true }); | ||
fs.writeFileSync( | ||
certPath, | ||
fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8") | ||
); | ||
} | ||
pathToCACerts = certPath; | ||
} | ||
return spawn( | ||
@@ -68,6 +44,2 @@ process.execPath, | ||
stdio: ["inherit", "inherit", "inherit", "ipc"], | ||
env: { | ||
...process.env, | ||
NODE_EXTRA_CA_CERTS: pathToCACerts, | ||
}, | ||
} | ||
@@ -82,44 +54,6 @@ ) | ||
} | ||
}); | ||
} | ||
/** | ||
* Runs a locally-installed version of wrangler, delegating from this version. | ||
* @throws {MODULE_NOT_FOUND} if there isn't a locally installed version of wrangler. | ||
*/ | ||
function runDelegatedWrangler() { | ||
const packageJsonPath = require.resolve("wrangler/package.json", { | ||
paths: [process.cwd()], | ||
}); | ||
const { | ||
bin: { wrangler: binaryPath }, | ||
version, | ||
} = JSON.parse(fs.readFileSync(packageJsonPath)); | ||
const resolvedBinaryPath = path.resolve(packageJsonPath, "..", binaryPath); | ||
// Make sure the user knows we're delegating to a different installation | ||
const currentPackageJsonPath = path.resolve(__dirname, "..", "package.json"); | ||
const currentPackage = JSON.parse(fs.readFileSync(currentPackageJsonPath)); | ||
const argv = process.argv.slice(2).join(" "); | ||
console.log( | ||
`Delegating to locally-installed wrangler@${version} over global wrangler@${currentPackage.version}... | ||
Run \`npx wrangler ${argv}\` to use the local version directly. | ||
` | ||
); | ||
// this call to `spawn` is simpler because the delegated version will do all | ||
// of the other work. | ||
return spawn( | ||
process.execPath, | ||
[resolvedBinaryPath, ...process.argv.slice(2)], | ||
{ | ||
stdio: ["inherit", "inherit", "inherit", "ipc"], | ||
} | ||
) | ||
.on("exit", (code) => | ||
process.exit(code === undefined || code === null ? 0 : code) | ||
) | ||
.on("message", (message) => { | ||
if (process.send) { | ||
process.send(message); | ||
}) | ||
.on("disconnect", () => { | ||
if (process.disconnect) { | ||
process.disconnect(); | ||
} | ||
@@ -129,33 +63,2 @@ }); | ||
/** | ||
* Indicates if this invocation of `wrangler` should delegate | ||
* to a locally-installed version. | ||
*/ | ||
function shouldDelegate() { | ||
try { | ||
// `require.resolve` will throw if it can't find | ||
// a locally-installed version of `wrangler` | ||
const delegatedPackageJson = require.resolve("wrangler/package.json", { | ||
paths: [process.cwd()], | ||
}); | ||
const thisPackageJson = path.resolve(__dirname, "..", "package.json"); | ||
// if it's the same path, then we're already a local install -- no need to delegate | ||
return thisPackageJson !== delegatedPackageJson; | ||
} catch (e) { | ||
// there's no local version to delegate to -- `require.resolve` threw | ||
return false; | ||
} | ||
} | ||
async function main() { | ||
wranglerProcess = shouldDelegate() ? runDelegatedWrangler() : runWrangler(); | ||
} | ||
process.on("SIGINT", () => { | ||
wranglerProcess && wranglerProcess.kill(); | ||
}); | ||
process.on("SIGTERM", () => { | ||
wranglerProcess && wranglerProcess.kill(); | ||
}); | ||
// semiver implementation via https://github.com/lukeed/semiver/blob/ae7eebe6053c96be63032b14fb0b68e2553fcac4/src/index.js | ||
@@ -193,2 +96,10 @@ | ||
void main(); | ||
if (module === require.main) { | ||
wranglerProcess = runWrangler(); | ||
process.on("SIGINT", () => { | ||
wranglerProcess && wranglerProcess.kill(); | ||
}); | ||
process.on("SIGTERM", () => { | ||
wranglerProcess && wranglerProcess.kill(); | ||
}); | ||
} |
390
package.json
{ | ||
"name": "wrangler", | ||
"version": "0.0.0-50407ed4", | ||
"description": "Command-line interface for all things Cloudflare Workers", | ||
"keywords": [ | ||
"wrangler", | ||
"cloudflare", | ||
"workers", | ||
"cloudflare workers", | ||
"edge", | ||
"compute", | ||
"serverless", | ||
"serverless application", | ||
"serverless module", | ||
"wasm", | ||
"web", | ||
"assembly", | ||
"webassembly", | ||
"rust", | ||
"emscripten", | ||
"typescript", | ||
"graphql", | ||
"router", | ||
"http", | ||
"cli" | ||
], | ||
"homepage": "https://github.com/cloudflare/wrangler2#readme", | ||
"bugs": { | ||
"url": "https://github.com/cloudflare/wrangler2/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cloudflare/wrangler2.git", | ||
"directory": "packages/wrangler" | ||
}, | ||
"license": "MIT OR Apache-2.0", | ||
"author": "wrangler@cloudflare.com", | ||
"main": "wrangler-dist/cli.js", | ||
"types": "wrangler-dist/cli.d.ts", | ||
"bin": { | ||
"wrangler": "./bin/wrangler.js", | ||
"wrangler2": "./bin/wrangler.js" | ||
}, | ||
"files": [ | ||
"src", | ||
"bin", | ||
"miniflare-config-stubs", | ||
"miniflare-dist", | ||
"wrangler-dist", | ||
"templates", | ||
"vendor", | ||
"import_meta_url.js", | ||
"kv-asset-handler.js", | ||
"Cloudflare_CA.pem" | ||
], | ||
"scripts": { | ||
"assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts", | ||
"build": "npm run clean && npm run bundle && npm run emit-types", | ||
"bundle": "node -r esbuild-register scripts/bundle.ts", | ||
"check:type": "node -r esbuild-register scripts/tsc-all.ts", | ||
"clean": "rimraf wrangler-dist miniflare-dist emitted-types", | ||
"dev": "npm run clean && concurrently -c black,blue --kill-others-on-fail false 'npm run bundle -- --watch' 'npm run check:type -- --watch --preserveWatchOutput'", | ||
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts", | ||
"prepublishOnly": "SOURCEMAPS=false npm run build", | ||
"start": "npm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js", | ||
"test": "npm run assert-git-version && jest --silent=false --verbose=true", | ||
"test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch", | ||
"test:ci": "npm run test -- --verbose=true --coverage" | ||
}, | ||
"jest": { | ||
"coverageReporters": [ | ||
"json", | ||
"html", | ||
"text", | ||
"cobertura" | ||
], | ||
"moduleNameMapper": { | ||
"clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js", | ||
"miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js" | ||
}, | ||
"restoreMocks": true, | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/src/__tests__/jest.setup.ts" | ||
], | ||
"testRegex": ".*.(test|spec)\\.[jt]sx?$", | ||
"testTimeout": 30000, | ||
"transform": { | ||
"^.+\\.c?(t|j)sx?$": [ | ||
"esbuild-jest", | ||
{ | ||
"sourcemap": true | ||
} | ||
] | ||
}, | ||
"transformIgnorePatterns": [ | ||
"node_modules/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes|npx-import)" | ||
] | ||
}, | ||
"dependencies": { | ||
"@cloudflare/kv-asset-handler": "^0.2.0", | ||
"@esbuild-plugins/node-globals-polyfill": "^0.1.1", | ||
"@esbuild-plugins/node-modules-polyfill": "^0.1.4", | ||
"@miniflare/core": "2.10.0", | ||
"@miniflare/d1": "2.10.0", | ||
"@miniflare/durable-objects": "2.10.0", | ||
"blake3-wasm": "^2.1.5", | ||
"chokidar": "^3.5.3", | ||
"esbuild": "0.14.51", | ||
"miniflare": "2.10.0", | ||
"nanoid": "^3.3.3", | ||
"path-to-regexp": "^6.2.0", | ||
"selfsigned": "^2.0.1", | ||
"source-map": "^0.7.4", | ||
"xxhash-wasm": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/types": "^6.18.4", | ||
"@cloudflare/workers-types": "^4.20221111.1", | ||
"@databases/split-sql-query": "^1.0.3", | ||
"@databases/sql": "^3.2.0", | ||
"@iarna/toml": "^3.0.0", | ||
"@microsoft/api-extractor": "^7.28.3", | ||
"@miniflare/tre": "^3.0.0-next.8", | ||
"@types/better-sqlite3": "^7.6.0", | ||
"@types/busboy": "^1.5.0", | ||
"@types/command-exists": "^1.2.0", | ||
"@types/express": "^4.17.13", | ||
"@types/glob-to-regexp": "0.4.1", | ||
"@types/javascript-time-ago": "^2.0.3", | ||
"@types/mime": "^2.0.3", | ||
"@types/prompts": "^2.0.14", | ||
"@types/react": "^17.0.37", | ||
"@types/serve-static": "^1.13.10", | ||
"@types/signal-exit": "^3.0.1", | ||
"@types/supports-color": "^8.1.1", | ||
"@types/ws": "^8.5.3", | ||
"@types/yargs": "^17.0.10", | ||
"@webcontainer/env": "^1.0.1", | ||
"body-parser": "^1.20.0", | ||
"chalk": "^2.4.2", | ||
"clipboardy": "^3.0.0", | ||
"cmd-shim": "^4.1.0", | ||
"command-exists": "^1.2.9", | ||
"concurrently": "^7.2.2", | ||
"devtools-protocol": "^0.0.955664", | ||
"dotenv": "^16.0.0", | ||
"execa": "^6.1.0", | ||
"express": "^4.18.1", | ||
"finalhandler": "^1.2.0", | ||
"find-up": "^6.3.0", | ||
"get-port": "^6.1.2", | ||
"glob-to-regexp": "0.4.1", | ||
"http-terminator": "^3.2.0", | ||
"ignore": "^5.2.0", | ||
"ink": "^3.2.0", | ||
"ink-select-input": "^4.2.1", | ||
"ink-spinner": "^4.0.3", | ||
"ink-table": "^3.0.0", | ||
"ink-testing-library": "^2.1.0", | ||
"ink-text-input": "^4.0.3", | ||
"is-ci": "^3.0.1", | ||
"javascript-time-ago": "^2.5.4", | ||
"jest-fetch-mock": "^3.0.3", | ||
"jest-websocket-mock": "^2.3.0", | ||
"mime": "^3.0.0", | ||
"minimatch": "^5.1.0", | ||
"msw": "^0.49.1", | ||
"npx-import": "^1.1.3", | ||
"open": "^8.4.0", | ||
"p-queue": "^7.2.0", | ||
"pretty-bytes": "^6.0.0", | ||
"prompts": "^2.4.2", | ||
"react": "^17.0.2", | ||
"react-error-boundary": "^3.1.4", | ||
"remove-accents-esm": "^0.0.1", | ||
"semiver": "^1.1.0", | ||
"serve-static": "^1.15.0", | ||
"signal-exit": "^3.0.7", | ||
"supports-color": "^9.2.2", | ||
"timeago.js": "^4.0.2", | ||
"tmp-promise": "^3.0.3", | ||
"ts-dedent": "^2.2.0", | ||
"undici": "5.11.0", | ||
"update-check": "^1.5.4", | ||
"ws": "^8.5.0", | ||
"xdg-app-paths": "^7.3.0", | ||
"yargs": "^17.4.1" | ||
}, | ||
"optionalDependencies": { | ||
"fsevents": "~2.3.2" | ||
}, | ||
"engines": { | ||
"node": ">=16.13.0" | ||
} | ||
} | ||
"name": "wrangler", | ||
"version": "0.0.0-50437494e", | ||
"description": "Command-line interface for all things Cloudflare Workers", | ||
"keywords": [ | ||
"wrangler", | ||
"cloudflare", | ||
"workers", | ||
"cloudflare workers", | ||
"edge", | ||
"compute", | ||
"serverless", | ||
"serverless application", | ||
"serverless module", | ||
"wasm", | ||
"web", | ||
"assembly", | ||
"webassembly", | ||
"rust", | ||
"emscripten", | ||
"typescript", | ||
"graphql", | ||
"router", | ||
"http", | ||
"cli" | ||
], | ||
"homepage": "https://github.com/cloudflare/workers-sdk#readme", | ||
"bugs": { | ||
"url": "https://github.com/cloudflare/workers-sdk/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cloudflare/workers-sdk.git", | ||
"directory": "packages/wrangler" | ||
}, | ||
"license": "MIT OR Apache-2.0", | ||
"author": "wrangler@cloudflare.com", | ||
"main": "wrangler-dist/cli.js", | ||
"types": "wrangler-dist/cli.d.ts", | ||
"bin": { | ||
"wrangler": "./bin/wrangler.js", | ||
"wrangler2": "./bin/wrangler.js" | ||
}, | ||
"files": [ | ||
"bin", | ||
"miniflare-dist", | ||
"wrangler-dist", | ||
"templates", | ||
"kv-asset-handler.js", | ||
"config-schema.json" | ||
], | ||
"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", | ||
"esbuild": "0.17.19", | ||
"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-20240919-125358-9a64854", | ||
"workerd": "1.20240925.0", | ||
"xxhash-wasm": "^1.0.1", | ||
"@cloudflare/kv-asset-handler": "0.3.4", | ||
"miniflare": "0.0.0-50437494e", | ||
"@cloudflare/workers-shared": "0.0.0-50437494e" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/types": "^6.18.4", | ||
"@cloudflare/workers-types": "^4.20240925.0", | ||
"@cspotcode/source-map-support": "0.8.1", | ||
"@iarna/toml": "^3.0.0", | ||
"@microsoft/api-extractor": "^7.47.0", | ||
"@sentry/node": "^7.86.0", | ||
"@sentry/types": "^7.86.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", | ||
"@types/is-ci": "^3.0.0", | ||
"@types/javascript-time-ago": "^2.0.3", | ||
"@types/mime": "^3.0.4", | ||
"@types/minimatch": "^5.1.2", | ||
"@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", | ||
"@types/signal-exit": "^3.0.1", | ||
"@types/supports-color": "^8.1.1", | ||
"@types/ws": "^8.5.7", | ||
"@types/yargs": "^17.0.22", | ||
"@vitest/ui": "^1.6.0", | ||
"@webcontainer/env": "^1.1.0", | ||
"body-parser": "^1.20.0", | ||
"chalk": "^5.2.0", | ||
"cli-table3": "^0.6.3", | ||
"clipboardy": "^3.0.0", | ||
"cmd-shim": "^4.1.0", | ||
"command-exists": "^1.2.9", | ||
"concurrently": "^8.2.2", | ||
"devtools-protocol": "^0.0.1182435", | ||
"dotenv": "^16.0.0", | ||
"es-module-lexer": "^1.3.0", | ||
"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", | ||
"javascript-time-ago": "^2.5.4", | ||
"md5-file": "5.0.0", | ||
"mime": "^3.0.0", | ||
"minimatch": "^5.1.0", | ||
"mock-socket": "^9.3.1", | ||
"msw": "^2.3.0", | ||
"open": "^8.4.0", | ||
"p-queue": "^7.2.0", | ||
"patch-console": "^1.0.0", | ||
"pretty-bytes": "^6.0.0", | ||
"prompts": "^2.4.2", | ||
"ps-list": "^8.1.1", | ||
"react": "^18.3.1", | ||
"react-error-boundary": "^3.1.4", | ||
"semiver": "^1.1.0", | ||
"serve-static": "^1.15.0", | ||
"shell-quote": "^1.8.1", | ||
"shellac": "^0.8.0", | ||
"signal-exit": "^3.0.7", | ||
"strip-ansi": "^7.1.0", | ||
"supports-color": "^9.2.2", | ||
"timeago.js": "^4.0.2", | ||
"ts-dedent": "^2.2.0", | ||
"ts-json-schema-generator": "^1.5.0", | ||
"undici": "^5.28.4", | ||
"update-check": "^1.5.4", | ||
"vitest": "~2.1.1", | ||
"vitest-websocket-mock": "^0.3.0", | ||
"ws": "^8.17.1", | ||
"xdg-app-paths": "^8.3.0", | ||
"yargs": "^17.7.2", | ||
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz", | ||
"@cloudflare/cli": "1.1.1", | ||
"@cloudflare/eslint-config-worker": "1.1.0", | ||
"@cloudflare/pages-shared": "^0.11.62", | ||
"@cloudflare/workers-tsconfig": "0.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@cloudflare/workers-types": "^4.20240925.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@cloudflare/workers-types": { | ||
"optional": true | ||
} | ||
}, | ||
"optionalDependencies": { | ||
"fsevents": "~2.3.2" | ||
}, | ||
"engines": { | ||
"node": ">=16.17.0" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"workers-sdk": { | ||
"prerelease": true | ||
}, | ||
"scripts": { | ||
"assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts", | ||
"build": "pnpm run clean && pnpm run bundle && pnpm run emit-types && pnpm run generate-json-schema", | ||
"bundle": "node -r esbuild-register scripts/bundle.ts", | ||
"check:lint": "eslint . --max-warnings=0", | ||
"check:type": "tsc", | ||
"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", | ||
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js", | ||
"test": "pnpm run assert-git-version && 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:watch": "pnpm run test --testTimeout=50000 --watch", | ||
"type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json" | ||
} | ||
} |
<h1 align="center"> ⛅️ wrangler </h1> | ||
<section align="center" id="shieldio-badges"> | ||
<a href="https://www.npmjs.com/package/wrangler"><img alt="npm" src="https://img.shields.io/npm/dw/wrangler?style=flat-square"></a> | ||
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/cloudflare/wrangler2?style=flat-square"> | ||
<img alt="GitHub commit activity (branch)" src="https://img.shields.io/github/commit-activity/w/cloudflare/wrangler2/main?style=flat-square"> | ||
<a href="https://discord.gg/CloudflareDev"><img alt="Discord" src="https://img.shields.io/discord/595317990191398933?color=%23F48120&style=flat-square"></a> | ||
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/cloudflare/workers-sdk?style=flat-square"> | ||
<img alt="GitHub commit activity (branch)" src="https://img.shields.io/github/commit-activity/w/cloudflare/workers-sdk/main?style=flat-square"> | ||
<a href="https://discord.cloudflare.com"><img alt="Discord" src="https://img.shields.io/discord/595317990191398933?color=%23F48120&style=flat-square"></a> | ||
</section> | ||
> This package is for wrangler v2.x, released first in May 2022. If you're looking for v1.x of the `@cloudflare/wrangler` package, visit https://www.npmjs.com/package/@cloudflare/wrangler / https://github.com/cloudflare/wrangler. | ||
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/). | ||
> [!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 | ||
@@ -20,4 +22,4 @@ | ||
npx wrangler dev index.js | ||
# and then publish it | ||
npx wrangler publish index.js --name my-worker | ||
# and then deploy it | ||
npx wrangler deploy index.js --name my-worker | ||
# visit https://my-worker.<your workers subdomain>.workers.dev | ||
@@ -30,6 +32,6 @@ ``` | ||
# Generate a new project | ||
npx wrangler init my-worker | ||
npx wrangler init my-worker --no-delegate-c3 | ||
# try it out | ||
cd my-worker && npm run start | ||
# and then publish it | ||
# and then deploy it | ||
npm run deploy | ||
@@ -48,11 +50,11 @@ ``` | ||
example: | ||
Example: | ||
```toml | ||
name = "my-worker" | ||
main = "./src/index.ts" # init w/ TypeScript | ||
name = "my-worker" | ||
compatibility_date = "YYY-MM-DD" | ||
compatibility_date = "YYYY-MM-DD" | ||
``` | ||
for more detailed information about configuration, see the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration) | ||
For more detailed information about configuration, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/configuration/). | ||
@@ -69,7 +71,7 @@ ## Commands | ||
### `wrangler publish` | ||
### `wrangler deploy` | ||
Publish the given script to the worldwide Cloudflare network. | ||
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/commands). | ||
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/). | ||
@@ -76,0 +78,0 @@ ## Pages |
{ | ||
"extends": "../../tsconfig.json", | ||
"extends": "@cloudflare/workers-tsconfig/tsconfig.json", | ||
"compilerOptions": { | ||
@@ -4,0 +4,0 @@ "types": ["node", "jest"] |
const urls = new Set(); | ||
export function checkedFetch(request, init) { | ||
const url = new URL( | ||
(typeof request === "string" ? new Request(request, init) : request).url | ||
); | ||
function checkURL(request, init) { | ||
const url = | ||
request instanceof URL | ||
? request | ||
: new URL( | ||
(typeof request === "string" | ||
? new Request(request, init) | ||
: request | ||
).url | ||
); | ||
if (url.port && url.port !== "443" && url.protocol === "https:") { | ||
@@ -12,7 +18,14 @@ if (!urls.has(url.toString())) { | ||
`WARNING: known issue with \`fetch()\` requests to custom HTTPS ports in published Workers:\n` + | ||
` - ${url.toString()} - the custom port will be ignored when the Worker is published using the \`wrangler publish\` command.\n` | ||
` - ${url.toString()} - the custom port will be ignored when the Worker is published using the \`wrangler deploy\` command.\n` | ||
); | ||
} | ||
} | ||
return globalThis.fetch(request, init); | ||
} | ||
globalThis.fetch = new Proxy(globalThis.fetch, { | ||
apply(target, thisArg, argArray) { | ||
const [request, init] = argArray; | ||
checkURL(request, init); | ||
return Reflect.apply(target, thisArg, argArray); | ||
}, | ||
}); |
declare module "__ENTRY_POINT__" { | ||
import type { Middleware } from "./middleware/common"; | ||
const worker: ExportedHandler & { middleware?: Middleware[] }; | ||
import { Middleware } from "./middleware/common"; | ||
import { WorkerEntrypoint } from "cloudflare:workers"; | ||
export type WorkerEntrypointConstructor = typeof WorkerEntrypoint; | ||
const worker: ExportedHandler | WorkerEntrypointConstructor; | ||
export default worker; | ||
export const __INTERNAL_WRANGLER_MIDDLEWARE__: Middleware[]; | ||
} | ||
@@ -6,0 +11,0 @@ |
@@ -0,3 +1,3 @@ | ||
import { afterAll, beforeAll, describe, expect, it } from "vitest"; | ||
import { unstable_dev } from "wrangler"; | ||
import { describe, expect, it, beforeAll, afterAll } from "vitest"; | ||
@@ -4,0 +4,0 @@ describe("Worker", () => { |
@@ -0,4 +1,4 @@ | ||
import { afterAll, beforeAll, describe, expect, it } from "vitest"; | ||
import { unstable_dev } from "wrangler"; | ||
import type { UnstableDevWorker } from "wrangler"; | ||
import { describe, expect, it, beforeAll, afterAll } from "vitest"; | ||
@@ -9,3 +9,3 @@ describe("Worker", () => { | ||
beforeAll(async () => { | ||
worker = await unstable_dev("src/index.js", { | ||
worker = await unstable_dev("src/index.ts", { | ||
experimental: { disableExperimentalWarning: true }, | ||
@@ -12,0 +12,0 @@ }); |
@@ -8,9 +8,14 @@ export type Awaitable<T> = T | Promise<T>; | ||
export type IncomingRequest = Request< | ||
unknown, | ||
IncomingRequestCfProperties<unknown> | ||
>; | ||
export interface MiddlewareContext { | ||
dispatch: Dispatcher; | ||
next(request: Request, env: any): Awaitable<Response>; | ||
next(request: IncomingRequest, env: any): Awaitable<Response>; | ||
} | ||
export type Middleware = ( | ||
request: Request, | ||
request: IncomingRequest, | ||
env: any, | ||
@@ -36,3 +41,3 @@ ctx: ExecutionContext, | ||
function __facade_invokeChain__( | ||
request: Request, | ||
request: IncomingRequest, | ||
env: any, | ||
@@ -54,3 +59,3 @@ ctx: ExecutionContext, | ||
export function __facade_invoke__( | ||
request: Request, | ||
request: IncomingRequest, | ||
env: any, | ||
@@ -57,0 +62,0 @@ ctx: ExecutionContext, |
@@ -1,21 +0,15 @@ | ||
// // This loads all middlewares exposed on the middleware object | ||
// // and then starts the invocation chain. | ||
// // The big idea is that we can add these to the middleware export dynamically | ||
// // through wrangler, or we can potentially let users directly add them as a sort | ||
// // of "plugin" system. | ||
// This loads all middlewares exposed on the middleware object and then starts | ||
// the invocation chain. The big idea is that we can add these to the middleware | ||
// export dynamically through wrangler, or we can potentially let users directly | ||
// add them as a sort of "plugin" system. | ||
import { | ||
Dispatcher, | ||
Middleware, | ||
__facade_invoke__, | ||
__facade_register__, | ||
} from "./common"; | ||
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "__ENTRY_POINT__"; | ||
import { __facade_invoke__, __facade_register__, Dispatcher } from "./common"; | ||
import type { WorkerEntrypointConstructor } from "__ENTRY_POINT__"; | ||
import worker from "__ENTRY_POINT__"; | ||
// We need to preserve all of the exports from the worker | ||
// Preserve all the exports from the worker | ||
export * from "__ENTRY_POINT__"; | ||
class __Facade_ScheduledController__ implements ScheduledController { | ||
#noRetry: ScheduledController["noRetry"]; | ||
readonly #noRetry: ScheduledController["noRetry"]; | ||
@@ -39,16 +33,30 @@ constructor( | ||
const __facade_modules_fetch__: Middleware = function (request, env, ctx) { | ||
if (worker.fetch === undefined) throw new Error("No fetch handler!"); // TODO: proper error message | ||
return worker.fetch(request, env, ctx); | ||
}; | ||
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler { | ||
// If we don't have any middleware defined, just return the handler as is | ||
if ( | ||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined || | ||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0 | ||
) { | ||
return worker; | ||
} | ||
// Otherwise, register all middleware once | ||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) { | ||
__facade_register__(middleware); | ||
} | ||
const facade: ExportedHandler<unknown> = { | ||
fetch(request, env, ctx) { | ||
// Get the chain of middleware from the worker object | ||
if (worker.middleware && worker.middleware.length > 0) { | ||
for (const middleware of worker.middleware) { | ||
__facade_register__(middleware); | ||
} | ||
const fetchDispatcher: ExportedHandlerFetchHandler = function ( | ||
request, | ||
env, | ||
ctx | ||
) { | ||
if (worker.fetch === undefined) { | ||
throw new Error("Handler does not export a fetch() function."); | ||
} | ||
return worker.fetch(request, env, ctx); | ||
}; | ||
const __facade_modules_dispatch__: Dispatcher = function (type, init) { | ||
return { | ||
...worker, | ||
fetch(request, env, ctx) { | ||
const dispatcher: Dispatcher = function (type, init) { | ||
if (type === "scheduled" && worker.scheduled !== undefined) { | ||
@@ -63,22 +71,66 @@ const controller = new __Facade_ScheduledController__( | ||
}; | ||
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher); | ||
}, | ||
}; | ||
} | ||
function wrapWorkerEntrypoint( | ||
klass: WorkerEntrypointConstructor | ||
): WorkerEntrypointConstructor { | ||
// If we don't have any middleware defined, just return the handler as is | ||
if ( | ||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined || | ||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0 | ||
) { | ||
return klass; | ||
} | ||
// Otherwise, register all middleware once | ||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) { | ||
__facade_register__(middleware); | ||
} | ||
// `extend`ing `klass` here so other RPC methods remain callable | ||
return class extends klass { | ||
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = ( | ||
request, | ||
env, | ||
ctx | ||
) => { | ||
this.env = env; | ||
this.ctx = ctx; | ||
if (super.fetch === undefined) { | ||
throw new Error("Entrypoint class does not define a fetch() function."); | ||
} | ||
return super.fetch(request); | ||
}; | ||
#dispatcher: Dispatcher = (type, init) => { | ||
if (type === "scheduled" && super.scheduled !== undefined) { | ||
const controller = new __Facade_ScheduledController__( | ||
Date.now(), | ||
init.cron ?? "", | ||
() => {} | ||
); | ||
return super.scheduled(controller); | ||
} | ||
}; | ||
fetch(request: Request<unknown, IncomingRequestCfProperties>) { | ||
return __facade_invoke__( | ||
request, | ||
env, | ||
ctx, | ||
__facade_modules_dispatch__, | ||
__facade_modules_fetch__ | ||
this.env, | ||
this.ctx, | ||
this.#dispatcher, | ||
this.#fetchDispatcher | ||
); | ||
} else { | ||
// We didn't have any middleware so we can skip the invocation chain, | ||
// and just call the fetch handler directly | ||
// We "don't care" if this is undefined as we want to have the same behaviour | ||
// as if the worker completely bypassed middleware. | ||
return worker.fetch!(request, env, ctx); | ||
} | ||
}, | ||
scheduled: worker.scheduled, | ||
}; | ||
}; | ||
} | ||
export default facade; | ||
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined; | ||
if (typeof ENTRY === "object") { | ||
WRAPPED_ENTRY = wrapExportedHandler(ENTRY); | ||
} else if (typeof ENTRY === "function") { | ||
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY); | ||
} | ||
export default WRAPPED_ENTRY; |
import { | ||
__facade_invoke__, | ||
__facade_register__, | ||
__facade_registerInternal__, | ||
Awaitable, | ||
Dispatcher, | ||
IncomingRequest, | ||
Middleware, | ||
__facade_invoke__, | ||
__facade_register__, | ||
__facade_registerInternal__, | ||
} from "./common"; | ||
export { __facade_register__, __facade_registerInternal__ }; | ||
@@ -186,4 +188,2 @@ | ||
__FACADE_EVENT_TARGET__.dispatchEvent(facadeEvent); | ||
// @ts-expect-error `waitUntil` types are currently broken, blocked on | ||
// https://github.com/cloudflare/workerd/pull/191 | ||
event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__])); | ||
@@ -201,4 +201,2 @@ } | ||
facadeEvent[__facade_dispatched__] = true; | ||
// @ts-expect-error `waitUntil` types are currently broken, blocked on | ||
// https://github.com/cloudflare/workerd/pull/191 | ||
event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__])); | ||
@@ -215,3 +213,3 @@ | ||
__facade_invoke__( | ||
event.request, | ||
event.request as IncomingRequest, | ||
globalThis, | ||
@@ -233,5 +231,3 @@ ctx, | ||
__FACADE_EVENT_TARGET__.dispatchEvent(facadeEvent); | ||
// @ts-expect-error `waitUntil` types are currently broken, blocked on | ||
// https://github.com/cloudflare/workerd/pull/191 | ||
event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__])); | ||
}); |
import type { Middleware } from "./common"; | ||
interface JsonError { | ||
message?: string; | ||
name?: string; | ||
stack?: string; | ||
cause?: JsonError; | ||
} | ||
function reduceError(e: any): JsonError { | ||
return { | ||
name: e?.name, | ||
message: e?.message ?? String(e), | ||
stack: e?.stack, | ||
cause: e?.cause === undefined ? undefined : reduceError(e.cause), | ||
}; | ||
} | ||
// See comment in `bundle.ts` for details on why this is needed | ||
@@ -8,7 +24,3 @@ const jsonError: Middleware = async (request, env, _ctx, middlewareCtx) => { | ||
} catch (e: any) { | ||
const error = { | ||
name: e?.name, | ||
message: e?.message ?? String(e), | ||
stack: e?.stack, | ||
}; | ||
const error = reduceError(e); | ||
return Response.json(error, { | ||
@@ -15,0 +27,0 @@ status: 500, |
@@ -12,5 +12,19 @@ import type { Middleware } from "./common"; | ||
} | ||
return middlewareCtx.next(request, env); | ||
const resp = await middlewareCtx.next(request, env); | ||
// If you open the `/__scheduled` page in a browser, the browser will automatically make a request to `/favicon.ico`. | ||
// For scheduled Workers _without_ a fetch handler, this will result in a 500 response that clutters the log with unhelpful error messages. | ||
// To avoid this, inject a 404 response to favicon.ico loads on the `/__scheduled` page | ||
if ( | ||
request.headers.get("referer")?.endsWith("/__scheduled") && | ||
url.pathname === "/favicon.ico" && | ||
resp.status === 500 | ||
) { | ||
return new Response(null, { status: 404 }); | ||
} | ||
return resp; | ||
}; | ||
export default scheduled; |
@@ -8,3 +8,3 @@ /** | ||
* - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers) | ||
* - Run `wrangler publish --name my-worker` to publish your worker | ||
* - Run `wrangler deploy --name my-worker` to deploy your worker | ||
* | ||
@@ -11,0 +11,0 @@ * Learn more at https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/ |
@@ -6,3 +6,3 @@ /** | ||
* - Open a browser tab at http://localhost:8787/ to see your worker in action | ||
* - Run `wrangler publish src/index.ts --name my-worker` to publish your worker | ||
* - Run `wrangler deploy src/index.ts --name my-worker` to deploy your worker | ||
* | ||
@@ -21,2 +21,5 @@ * Learn more at https://developers.cloudflare.com/workers/ | ||
// MY_BUCKET: R2Bucket; | ||
// | ||
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/ | ||
// MY_SERVICE: Fetcher; | ||
} | ||
@@ -23,0 +26,0 @@ |
// @ts-ignore entry point will get replaced | ||
import worker from "__ENTRY_POINT__"; | ||
import { isRoutingRuleMatch } from "./pages-dev-util"; | ||
// @ts-ignore entry point will get replaced | ||
export * from "__ENTRY_POINT__"; | ||
import { isRoutingRuleMatch } from "./pages-dev-util"; | ||
@@ -7,0 +8,0 @@ // @ts-ignore routes are injected |
@@ -48,3 +48,6 @@ /** | ||
// /foo* => /foo.* => ^/foo.*$ | ||
transformedRule = `^${transformedRule.replace("*", ".*")}$`; | ||
// /*.* => /*\.* => /.*\..* => ^/.*\..*$ | ||
transformedRule = `^${transformedRule | ||
.replaceAll(/\./g, "\\.") | ||
.replaceAll(/\*/g, ".*")}$`; | ||
@@ -51,0 +54,0 @@ // ^/foo.*$ => /^\/foo.*$/ |
@@ -6,5 +6,2 @@ // This Worker is used as a default when no Pages Functions are present. | ||
async fetch(request, env, context) { | ||
// @ts-expect-error due to a bug in `@cloudflare/workers-types`, the `cf` | ||
// types from the `request` parameter and `RequestInit` are incompatible. | ||
// We'll get this fixed very soon. | ||
const response = await env.ASSETS.fetch(request.url, request); | ||
@@ -11,0 +8,0 @@ return new Response(response.body, response); |
@@ -44,3 +44,3 @@ import { match } from "path-to-regexp"; | ||
P extends string = string, | ||
Data extends Record<string, unknown> = Record<string, unknown> | ||
Data extends Record<string, unknown> = Record<string, unknown>, | ||
> = (context: EventContext<Env, P, Data>) => Response | Promise<Response>; | ||
@@ -52,3 +52,3 @@ | ||
Data extends Record<string, unknown> = Record<string, unknown>, | ||
PluginArgs = unknown | ||
PluginArgs = unknown, | ||
> = ( | ||
@@ -127,7 +127,9 @@ context: EventPluginContext<Env, P, Data, PluginArgs> | ||
let { request } = workerContext; | ||
const { env, next, data } = workerContext; | ||
const { env, next } = workerContext; | ||
let { data } = workerContext; | ||
const url = new URL(request.url); | ||
// TODO: Replace this with something actually legible. | ||
const relativePathname = `/${ | ||
url.pathname.split(workerContext.functionPath)[1] || "" | ||
url.pathname.replace(workerContext.functionPath, "") || "" | ||
}`.replace(/^\/\//, "/"); | ||
@@ -138,3 +140,7 @@ | ||
if (input !== undefined) { | ||
request = new Request(input, init); | ||
let url = input; | ||
if (typeof input === "string") { | ||
url = new URL(input, request.url).toString(); | ||
} | ||
request = new Request(url, init); | ||
} | ||
@@ -147,7 +153,16 @@ | ||
const context = { | ||
request, | ||
request: new Request(request.clone()), | ||
functionPath: workerContext.functionPath + path, | ||
next: pluginNext, | ||
params, | ||
data, | ||
get data() { | ||
return data; | ||
}, | ||
set data(value) { | ||
if (typeof value !== "object" || value === null) { | ||
throw new Error("context.data must be an object"); | ||
} | ||
// user has overriden context.data, so we need to merge it with the existing data | ||
data = value; | ||
}, | ||
pluginArgs, | ||
@@ -162,9 +177,5 @@ env, | ||
// https://fetch.spec.whatwg.org/#null-body-status | ||
return new Response( | ||
[101, 204, 205, 304].includes(response.status) ? null : response.body, | ||
{ ...response, headers: new Headers(response.headers) } | ||
); | ||
return cloneResponse(response); | ||
} else { | ||
return next(); | ||
return next(request); | ||
} | ||
@@ -178,1 +189,9 @@ }; | ||
} | ||
// This makes a Response mutable | ||
const cloneResponse = (response: Response) => | ||
// https://fetch.spec.whatwg.org/#null-body-status | ||
new Response( | ||
[101, 204, 205, 304].includes(response.status) ? null : response.body, | ||
response | ||
); |
@@ -32,3 +32,3 @@ import { match } from "path-to-regexp"; | ||
P extends string = string, | ||
Data extends Record<string, unknown> = Record<string, unknown> | ||
Data extends Record<string, unknown> = Record<string, unknown>, | ||
> = (context: EventContext<Env, P, Data>) => Response | Promise<Response>; | ||
@@ -124,3 +124,3 @@ /* end @cloudflare/workers-types */ | ||
const handlerIterator = executeRequest(request); | ||
const data = {}; // arbitrary data the user can set between functions | ||
let data = {}; // arbitrary data the user can set between functions | ||
let isFailOpen = false; | ||
@@ -146,3 +146,12 @@ | ||
params, | ||
data, | ||
get data() { | ||
return data; | ||
}, | ||
set data(value) { | ||
if (typeof value !== "object" || value === null) { | ||
throw new Error("context.data must be an object"); | ||
} | ||
// user has overriden context.data, so we need to merge it with the existing data | ||
data = value; | ||
}, | ||
env, | ||
@@ -149,0 +158,0 @@ waitUntil: workerContext.waitUntil.bind(workerContext), |
{ | ||
"compilerOptions": { | ||
/* Visit https://aka.ms/tsconfig.json to read more about this file */ | ||
/* Projects */ | ||
// "incremental": true, /* Enable incremental compilation */ | ||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ | ||
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ | ||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ | ||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ | ||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ | ||
/* Language and Environment */ | ||
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, | ||
@@ -18,90 +7,17 @@ "lib": [ | ||
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, | ||
"jsx": "react" /* Specify what JSX code is generated. */, | ||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ | ||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ | ||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ | ||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ | ||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ | ||
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ | ||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ | ||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ | ||
/* Modules */ | ||
"module": "es2022" /* Specify what module code is generated. */, | ||
// "rootDir": "./", /* Specify the root folder within your source files. */ | ||
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, | ||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ | ||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ | ||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ | ||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ | ||
"jsx": "react-jsx" /* Specify what JSX code is generated. */, | ||
"module": "ESNext" /* Specify what module code is generated. */, | ||
"moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */, | ||
"types": [ | ||
"@cloudflare/workers-types", | ||
"jest" | ||
"@cloudflare/workers-types" | ||
] /* Specify type package names to be included without being referenced in a source file. */, | ||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ | ||
"resolveJsonModule": true /* Enable importing .json files */, | ||
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */ | ||
/* JavaScript Support */ | ||
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */, | ||
"checkJs": false /* Enable error reporting in type-checked JavaScript files. */, | ||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ | ||
/* Emit */ | ||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ | ||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */ | ||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ | ||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */ | ||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ | ||
// "outDir": "./", /* Specify an output folder for all emitted files. */ | ||
// "removeComments": true, /* Disable emitting comments. */ | ||
"noEmit": true /* Disable emitting files from a compilation. */, | ||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ | ||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ | ||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ | ||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ | ||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ | ||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ | ||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ | ||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ | ||
// "newLine": "crlf", /* Set the newline character for emitting files. */ | ||
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ | ||
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ | ||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ | ||
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ | ||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */ | ||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ | ||
/* Interop Constraints */ | ||
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, | ||
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, | ||
// "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, | ||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ | ||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, | ||
/* Type Checking */ | ||
"strict": true /* Enable all strict type-checking options. */, | ||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ | ||
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ | ||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ | ||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ | ||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ | ||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ | ||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ | ||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ | ||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ | ||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ | ||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ | ||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ | ||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ | ||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ | ||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ | ||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ | ||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ | ||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ | ||
/* Completeness */ | ||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ | ||
"noUncheckedIndexedAccess": true, | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
} | ||
} |
{ | ||
"extends": "../tsconfig.json", | ||
"extends": "@cloudflare/workers-tsconfig/tsconfig.json", | ||
"compilerOptions": { | ||
@@ -4,0 +4,0 @@ "types": ["@cloudflare/workers-types"] |
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 too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
9820943
87
2
4
19
86
48
31851
+ Addedresolve@^1.22.8
+ Addedresolve.exports@^2.0.2
+ Addedunenv@npm:unenv-nightly@2.0.0-20240919-125358-9a64854
+ Addedworkerd@1.20240925.0
+ Added@cloudflare/kv-asset-handler@0.3.4(transitive)
+ Added@cloudflare/workerd-darwin-64@1.20240925.0(transitive)
+ Added@cloudflare/workerd-darwin-arm64@1.20240925.0(transitive)
+ Added@cloudflare/workerd-linux-64@1.20240925.0(transitive)
+ Added@cloudflare/workerd-linux-arm64@1.20240925.0(transitive)
+ Added@cloudflare/workerd-windows-64@1.20240925.0(transitive)
+ Added@cloudflare/workers-types@4.20241004.0(transitive)
+ Added@cspotcode/source-map-support@0.8.1(transitive)
+ Added@esbuild-plugins/node-globals-polyfill@0.2.3(transitive)
+ Added@esbuild-plugins/node-modules-polyfill@0.2.2(transitive)
+ Added@esbuild/android-arm@0.17.19(transitive)
+ Added@esbuild/android-arm64@0.17.19(transitive)
+ Added@esbuild/android-x64@0.17.19(transitive)
+ Added@esbuild/darwin-arm64@0.17.19(transitive)
+ Added@esbuild/darwin-x64@0.17.19(transitive)
+ Added@esbuild/freebsd-arm64@0.17.19(transitive)
+ Added@esbuild/freebsd-x64@0.17.19(transitive)
+ Added@esbuild/linux-arm@0.17.19(transitive)
+ Added@esbuild/linux-arm64@0.17.19(transitive)
+ Added@esbuild/linux-ia32@0.17.19(transitive)
+ Added@esbuild/linux-loong64@0.17.19(transitive)
+ Added@esbuild/linux-mips64el@0.17.19(transitive)
+ Added@esbuild/linux-ppc64@0.17.19(transitive)
+ Added@esbuild/linux-riscv64@0.17.19(transitive)
+ Added@esbuild/linux-s390x@0.17.19(transitive)
+ Added@esbuild/linux-x64@0.17.19(transitive)
+ Added@esbuild/netbsd-x64@0.17.19(transitive)
+ Added@esbuild/openbsd-x64@0.17.19(transitive)
+ Added@esbuild/sunos-x64@0.17.19(transitive)
+ Added@esbuild/win32-arm64@0.17.19(transitive)
+ Added@esbuild/win32-ia32@0.17.19(transitive)
+ Added@esbuild/win32-x64@0.17.19(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.9(transitive)
+ Addedacorn@8.12.1(transitive)
+ Addedacorn-walk@8.3.4(transitive)
+ Addedas-table@1.0.55(transitive)
+ Addedcapnp-ts@0.7.0(transitive)
+ Addedcookie@0.7.2(transitive)
+ Addeddata-uri-to-buffer@2.0.2(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddefu@6.1.4(transitive)
+ Addedesbuild@0.17.19(transitive)
+ Addedexit-hook@2.2.1(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-source@2.0.12(transitive)
+ Addedglob-to-regexp@0.4.1(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedminiflare@0.0.0-50437494e(transitive)
+ Addedms@2.1.3(transitive)
+ Addedohash@1.1.4(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpathe@1.1.2(transitive)
+ Addedprintable-characters@1.0.42(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve.exports@2.0.2(transitive)
+ Addedstacktracey@2.1.8(transitive)
+ Addedstoppable@1.1.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtslib@2.7.0(transitive)
+ Addedufo@1.5.4(transitive)
+ Addedundici@5.28.4(transitive)
+ Addedunenv-nightly@2.0.0-20240919-125358-9a64854(transitive)
+ Addedworkerd@1.20240925.0(transitive)
+ Addedyouch@3.3.4(transitive)
+ Addedzod@3.23.8(transitive)
- Removed@miniflare/core@2.10.0
- Removed@miniflare/d1@2.10.0
- Removed@miniflare/durable-objects@2.10.0
- Removed@cloudflare/kv-asset-handler@0.2.0(transitive)
- Removed@esbuild-plugins/node-globals-polyfill@0.1.1(transitive)
- Removed@esbuild-plugins/node-modules-polyfill@0.1.4(transitive)
- Removed@iarna/toml@2.2.5(transitive)
- Removed@miniflare/cache@2.10.0(transitive)
- Removed@miniflare/cli-parser@2.10.0(transitive)
- Removed@miniflare/core@2.10.0(transitive)
- Removed@miniflare/d1@2.10.0(transitive)
- Removed@miniflare/durable-objects@2.10.0(transitive)
- Removed@miniflare/html-rewriter@2.10.0(transitive)
- Removed@miniflare/http-server@2.10.0(transitive)
- Removed@miniflare/kv@2.10.0(transitive)
- Removed@miniflare/queues@2.10.0(transitive)
- Removed@miniflare/r2@2.10.0(transitive)
- Removed@miniflare/runner-vm@2.10.0(transitive)
- Removed@miniflare/scheduler@2.10.0(transitive)
- Removed@miniflare/shared@2.10.0(transitive)
- Removed@miniflare/sites@2.10.0(transitive)
- Removed@miniflare/storage-file@2.10.0(transitive)
- Removed@miniflare/storage-memory@2.10.0(transitive)
- Removed@miniflare/watcher@2.10.0(transitive)
- Removed@miniflare/web-sockets@2.10.0(transitive)
- Removed@types/better-sqlite3@7.6.11(transitive)
- Removed@types/stack-trace@0.0.29(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedbuiltins@5.1.0(transitive)
- Removedbusboy@1.6.0(transitive)
- Removedcookie@0.4.2(transitive)
- Removedcron-schedule@3.0.6(transitive)
- Removedcross-spawn@7.0.3(transitive)
- Removeddotenv@10.0.0(transitive)
- Removedesbuild@0.14.51(transitive)
- Removedesbuild-android-64@0.14.51(transitive)
- Removedesbuild-android-arm64@0.14.51(transitive)
- Removedesbuild-darwin-64@0.14.51(transitive)
- Removedesbuild-darwin-arm64@0.14.51(transitive)
- Removedesbuild-freebsd-64@0.14.51(transitive)
- Removedesbuild-freebsd-arm64@0.14.51(transitive)
- Removedesbuild-linux-32@0.14.51(transitive)
- Removedesbuild-linux-64@0.14.51(transitive)
- Removedesbuild-linux-arm@0.14.51(transitive)
- Removedesbuild-linux-arm64@0.14.51(transitive)
- Removedesbuild-linux-mips64le@0.14.51(transitive)
- Removedesbuild-linux-ppc64le@0.14.51(transitive)
- Removedesbuild-linux-riscv64@0.14.51(transitive)
- Removedesbuild-linux-s390x@0.14.51(transitive)
- Removedesbuild-netbsd-64@0.14.51(transitive)
- Removedesbuild-openbsd-64@0.14.51(transitive)
- Removedesbuild-sunos-64@0.14.51(transitive)
- Removedesbuild-windows-32@0.14.51(transitive)
- Removedesbuild-windows-64@0.14.51(transitive)
- Removedesbuild-windows-arm64@0.14.51(transitive)
- Removedexeca@6.1.0(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedhtml-rewriter-wasm@0.4.1(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhuman-signals@3.0.1(transitive)
- Removedis-stream@3.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedkleur@4.1.5(transitive)
- Removedmerge-stream@2.0.0(transitive)
- Removedmimic-fn@4.0.0(transitive)
- Removedminiflare@2.10.0(transitive)
- Removednpm-run-path@5.3.0(transitive)
- Removednpx-import@1.1.4(transitive)
- Removedonetime@6.0.0(transitive)
- Removedparse-package-name@1.0.0(transitive)
- Removedpath-key@3.1.14.0.0(transitive)
- Removedsemiver@1.1.0(transitive)
- Removedsemver@7.6.3(transitive)
- Removedset-cookie-parser@2.7.0(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsource-map@0.7.4(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstreamsearch@1.1.0(transitive)
- Removedstrip-final-newline@3.0.0(transitive)
- Removedundici@5.9.1(transitive)
- Removedurlpattern-polyfill@4.0.3(transitive)
- Removedvalidate-npm-package-name@4.0.0(transitive)
- Removedwhich@2.0.2(transitive)
- Removedyouch@2.2.2(transitive)
Updatedesbuild@0.17.19
Updatedminiflare@0.0.0-50437494e
Updatedpath-to-regexp@^6.3.0
Updatedsource-map@^0.6.1