Socket
Socket
Sign inDemoInstall

wrangler

Package Overview
Dependencies
Maintainers
1
Versions
3491
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 0.0.0-235c4398 to 0.0.0-2384560dd

templates/middleware/middleware-mock-analytics-engine.d.ts

28

bin/wrangler.js

@@ -31,26 +31,2 @@ #!/usr/bin/env node

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(

@@ -67,6 +43,2 @@ process.execPath,

stdio: ["inherit", "inherit", "inherit", "ipc"],
env: {
...process.env,
NODE_EXTRA_CA_CERTS: pathToCACerts,
},
}

@@ -73,0 +45,0 @@ )

116

package.json
{
"name": "wrangler",
"version": "0.0.0-235c4398",
"version": "0.0.0-2384560dd",
"description": "Command-line interface for all things Cloudflare Workers",

@@ -50,32 +50,4 @@ "keywords": [

"kv-asset-handler.js",
"Cloudflare_CA.pem",
"config-schema.json"
],
"jest": {
"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": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
"testTimeout": 50000,
"transform": {
"^.+\\.c?(t|j)sx?$": [
"esbuild-jest",
{
"sourcemap": true
}
]
},
"transformIgnorePatterns": [
"node_modules/.pnpm/(?!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|strip-ansi|ansi-regex)"
],
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
}
},
"dependencies": {

@@ -88,19 +60,20 @@ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",

"nanoid": "^3.3.3",
"path-to-regexp": "^6.2.0",
"path-to-regexp": "^6.3.0",
"resolve": "^1.22.8",
"resolve.exports": "^2.0.2",
"selfsigned": "^2.0.1",
"source-map": "0.6.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.1",
"miniflare": "3.20240405.2"
"@cloudflare/kv-asset-handler": "0.3.4",
"@cloudflare/workers-shared": "0.0.0-2384560dd",
"miniflare": "0.0.0-2384560dd"
},
"devDependencies": {
"@cloudflare/ai": "^1.0.35",
"@cloudflare/eslint-config-worker": "*",
"@cloudflare/types": "^6.18.4",
"@cloudflare/workers-types": "^4.20240419.0",
"@cloudflare/workers-types": "^4.20240925.0",
"@cspotcode/source-map-support": "0.8.1",
"@iarna/toml": "^3.0.0",
"@microsoft/api-extractor": "^7.28.3",
"@microsoft/api-extractor": "^7.47.0",
"@sentry/node": "^7.86.0",

@@ -110,13 +83,11 @@ "@sentry/types": "^7.86.0",

"@types/body-parser": "^1.19.2",
"@types/busboy": "^1.5.0",
"@types/command-exists": "^1.2.0",
"@types/express": "^4.17.13",
"@types/glob-to-regexp": "0.4.1",
"@types/glob-to-regexp": "^0.4.1",
"@types/is-ci": "^3.0.0",
"@types/javascript-time-ago": "^2.0.3",
"@types/jest": "^29.5.5",
"@types/mime": "^2.0.3",
"@types/mime": "^3.0.4",
"@types/minimatch": "^5.1.2",
"@types/prompts": "^2.0.14",
"@types/react": "^17.0.37",
"@types/react": "^18.3.3",
"@types/resolve": "^1.20.6",

@@ -126,9 +97,9 @@ "@types/serve-static": "^1.13.10",

"@types/signal-exit": "^3.0.1",
"@types/source-map-support": "^0.5.7",
"@types/supports-color": "^8.1.1",
"@types/ws": "^8.5.3",
"@types/yargs": "^17.0.10",
"@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": "^2.4.2",
"chalk": "^5.2.0",
"cli-table3": "^0.6.3",

@@ -138,13 +109,11 @@ "clipboardy": "^3.0.0",

"command-exists": "^1.2.9",
"concurrently": "^7.2.2",
"devtools-protocol": "^0.0.955664",
"concurrently": "^8.2.2",
"devtools-protocol": "^0.0.1182435",
"dotenv": "^16.0.0",
"es-module-lexer": "^1.3.0",
"esbuild-jest": "0.5.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",
"get-port": "^7.0.0",
"glob-to-regexp": "^0.4.1",
"http-terminator": "^3.2.0",

@@ -157,12 +126,9 @@ "https-proxy-agent": "7.0.2",

"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": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-websocket-mock": "^2.5.0",
"md5-file": "5.0.0",
"mime": "^3.0.0",
"minimatch": "^5.1.0",
"msw": "^0.49.1",
"mock-socket": "^9.3.1",
"msw": "^2.3.0",
"open": "^8.4.0",

@@ -173,5 +139,5 @@ "p-queue": "^7.2.0",

"prompts": "^2.4.2",
"react": "^17.0.2",
"ps-list": "^8.1.1",
"react": "^18.3.1",
"react-error-boundary": "^3.1.4",
"remove-accents-esm": "^0.0.1",
"semiver": "^1.1.0",

@@ -182,3 +148,3 @@ "serve-static": "^1.15.0",

"signal-exit": "^3.0.7",
"strip-ansi": "^7.0.1",
"strip-ansi": "^7.1.0",
"supports-color": "^9.2.2",

@@ -188,17 +154,17 @@ "timeago.js": "^4.0.2",

"ts-json-schema-generator": "^1.5.0",
"undici": "5.28.3",
"undici": "^5.28.4",
"update-check": "^1.5.4",
"ws": "^8.5.0",
"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/pages-shared": "^0.11.29",
"@cloudflare/cli": "1.1.1",
"@cloudflare/eslint-config-worker": "1.1.0",
"@cloudflare/pages-shared": "^0.11.62",
"@cloudflare/workers-tsconfig": "0.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"peerDependencies": {
"@cloudflare/workers-types": "^4.20240419.0"
"@cloudflare/workers-types": "^4.20240925.0"
},

@@ -210,5 +176,11 @@ "peerDependenciesMeta": {

},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"engines": {
"node": ">=16.17.0"
},
"volta": {
"extends": "../../package.json"
},
"workers-sdk": {

@@ -221,3 +193,3 @@ "prerelease": true

"bundle": "node -r esbuild-register scripts/bundle.ts",
"check:lint": "eslint .",
"check:lint": "eslint . --max-warnings=0",
"check:type": "tsc",

@@ -229,6 +201,6 @@ "clean": "rimraf wrangler-dist miniflare-dist emitted-types",

"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
"test": "pnpm run assert-git-version && jest",
"test:ci": "pnpm run test",
"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.ts",
"test:e2e": "vitest -c ./e2e/vitest.config.mts",
"test:watch": "pnpm run test --testTimeout=50000 --watch",

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

@@ -11,2 +11,6 @@ <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

@@ -13,0 +17,0 @@

@@ -12,3 +12,3 @@ const urls = new Set();

).url
);
);
if (url.port && url.port !== "443" && url.protocol === "https:") {

@@ -15,0 +15,0 @@ if (!urls.has(url.toString())) {

@@ -6,6 +6,6 @@ declare module "__ENTRY_POINT__" {

export type WorkerEntrypointConstructor = typeof WorkerEntrypoint;
export type WithMiddleware<T> = T & { middleware?: Middleware[] };
const worker: WithMiddleware<ExportedHandler | WorkerEntrypointConstructor>;
const worker: ExportedHandler | WorkerEntrypointConstructor;
export default worker;
export const __INTERNAL_WRANGLER_MIDDLEWARE__: Middleware[];
}

@@ -12,0 +12,0 @@

@@ -6,8 +6,5 @@ // This loads all middlewares exposed on the middleware object and then starts

import ENTRY from "__ENTRY_POINT__";
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "__ENTRY_POINT__";
import { __facade_invoke__, __facade_register__, Dispatcher } from "./common";
import type {
WithMiddleware,
WorkerEntrypointConstructor,
} from "__ENTRY_POINT__";
import type { WorkerEntrypointConstructor } from "__ENTRY_POINT__";

@@ -37,11 +34,12 @@ // Preserve all the exports from the worker

function wrapExportedHandler(
worker: WithMiddleware<ExportedHandler>
): ExportedHandler {
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
// If we don't have any middleware defined, just return the handler as is
if (worker.middleware === undefined || worker.middleware.length === 0) {
if (
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
) {
return worker;
}
// Otherwise, register all middleware once
for (const middleware of worker.middleware) {
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
__facade_register__(middleware);

@@ -80,10 +78,13 @@ }

function wrapWorkerEntrypoint(
klass: WithMiddleware<WorkerEntrypointConstructor>
klass: WorkerEntrypointConstructor
): WorkerEntrypointConstructor {
// If we don't have any middleware defined, just return the handler as is
if (klass.middleware === undefined || klass.middleware.length === 0) {
if (
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
) {
return klass;
}
// Otherwise, register all middleware once
for (const middleware of klass.middleware) {
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
__facade_register__(middleware);

@@ -90,0 +91,0 @@ }

@@ -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;

@@ -17,3 +17,3 @@ /// <reference path="middleware-serve-static-assets.d.ts"/>

const staticAssets: Middleware = async (request, env, _ctx, middlewareCtx) => {
const staticAssets: Middleware = async (request, env, ctx, middlewareCtx) => {
let options: Partial<Options> = {

@@ -31,3 +31,3 @@ ASSET_MANIFEST,

waitUntil(promise) {
return _ctx.waitUntil(promise);
return ctx.waitUntil(promise);
},

@@ -34,0 +34,0 @@ },

@@ -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,
> = (

@@ -55,0 +55,0 @@ context: EventPluginContext<Env, P, Data, PluginArgs>

@@ -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>;

@@ -35,0 +35,0 @@ /* end @cloudflare/workers-types */

@@ -63,3 +63,6 @@ import assert from "node:assert";

export class InspectorProxyWorker implements DurableObject {
constructor(_state: DurableObjectState, readonly env: Env) {}
constructor(
_state: DurableObjectState,
readonly env: Env
) {}

@@ -66,0 +69,0 @@ websockets: {

@@ -36,3 +36,6 @@ import {

export class ProxyWorker implements DurableObject {
constructor(readonly state: DurableObjectState, readonly env: Env) {}
constructor(
readonly state: DurableObjectState,
readonly env: Env
) {}

@@ -125,4 +128,6 @@ proxyData?: ProxyData;

// set request.url in the UserWorker
const innerUrl = new URL(request.url);
Object.assign(innerUrl, proxyData.userWorkerInnerUrlOverrides);
const innerUrl = urlFromParts(
proxyData.userWorkerInnerUrlOverrides ?? {},
request.url
);
headers.set("MF-Original-URL", innerUrl.href);

@@ -278,24 +283,3 @@ headers.set("MF-Disable-Pretty-Error", "true"); // disables the UserWorker miniflare instance from rendering the pretty error -- instead the ProxyWorker miniflare instance will intercept the json error response and render the pretty error page

end.append(
`
<script>
(function() {
var ws;
function recover() {
ws = null;
setTimeout(initLiveReload, 100);
}
function initLiveReload() {
if (ws) return;
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
ws.onclose = recover;
ws.onerror = recover;
ws.onmessage = location.reload.bind(location);
}
})();
</script>
`,
{ html: true }
);
end.append(liveReloadScript, { html: true });
}

@@ -308,2 +292,23 @@ },

const liveReloadScript = `
<script defer type="application/javascript">
(function() {
var ws;
function recover() {
ws = null;
setTimeout(initLiveReload, 100);
}
function initLiveReload() {
if (ws) return;
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
ws.onclose = recover;
ws.onerror = recover;
ws.onmessage = location.reload.bind(location);
}
initLiveReload();
})();
</script>
`;
/**

@@ -310,0 +315,0 @@ * Rewrite references to URLs in request/response headers.

{
"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,89 +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"
] /* 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. */
}
}

@@ -97,4 +97,6 @@ // src/api/startDevWorker/utils.ts

Object.assign(userWorkerUrl, proxyData.userWorkerUrl);
const innerUrl = new URL(request.url);
Object.assign(innerUrl, proxyData.userWorkerInnerUrlOverrides);
const innerUrl = urlFromParts(
proxyData.userWorkerInnerUrlOverrides ?? {},
request.url
);
headers.set("MF-Original-URL", innerUrl.href);

@@ -189,24 +191,3 @@ headers.set("MF-Disable-Pretty-Error", "true");

websocketUrl.protocol = websocketUrl.protocol === "http:" ? "ws:" : "wss:";
end.append(
`
<script>
(function() {
var ws;
function recover() {
ws = null;
setTimeout(initLiveReload, 100);
}
function initLiveReload() {
if (ws) return;
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
ws.onclose = recover;
ws.onerror = recover;
ws.onmessage = location.reload.bind(location);
}
})();
</script>
`,
{ html: true }
);
end.append(liveReloadScript, { html: true });
}

@@ -217,2 +198,22 @@ }

}
var liveReloadScript = `
<script defer type="application/javascript">
(function() {
var ws;
function recover() {
ws = null;
setTimeout(initLiveReload, 100);
}
function initLiveReload() {
if (ws) return;
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
ws.onclose = recover;
ws.onerror = recover;
ws.onmessage = location.reload.bind(location);
}
initLiveReload();
})();
</script>
`;
function rewriteUrlRelatedHeaders(headers, from, to) {

@@ -219,0 +220,0 @@ const setCookie = headers.getAll("Set-Cookie");

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

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