Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/dirty-houses-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": minor
---

Added new "open local explorer" hotkey for experimental/WIP local resource explorer

When running `wrangler dev` with the experimental local explorer feature enabled, you can now press a hotkey to open the local resource explorer UI.
2 changes: 1 addition & 1 deletion fixtures/get-platform-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "catalog:default",
"@types/jest-image-snapshot": "^6.4.0",
"jest-image-snapshot": "^6.4.0",
"jest-image-snapshot": "^6.5.1",
"typescript": "catalog:default",
"undici": "catalog:default",
"vitest": "catalog:default",
Expand Down
26 changes: 24 additions & 2 deletions fixtures/interactive-dev-tests/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ if (process.platform === "win32") {
});

const readyRegexp = /Ready on (http:\/\/[a-z0-9.]+:[0-9]+)/;
async function startWranglerDev(args: string[], skipWaitingForReady = false) {
async function startWranglerDev(
args: string[],
skipWaitingForReady = false,
env?: Record<string, string>
) {
const stdoutStream = new stream.PassThrough();
const stdoutInterface = rl.createInterface(stdoutStream);

Expand All @@ -120,6 +124,11 @@ if (process.platform === "win32") {
(resolve) => (exitResolve = resolve)
);

const ptyOptionsWithEnv = {
...ptyOptions,
env: env ?? (process.env as Record<string, string>),
} satisfies pty.IPtyForkOptions;

const pty = await import("@cdktf/node-pty-prebuilt-multiarch");
const ptyProcess = pty.spawn(
process.execPath,
Expand All @@ -130,7 +139,7 @@ if (process.platform === "win32") {
"--port=0",
"--inspector-port=0",
],
ptyOptions
ptyOptionsWithEnv
);
const result: PtyProcess = {
pty: ptyProcess,
Expand Down Expand Up @@ -270,6 +279,19 @@ if (process.platform === "win32") {
expect(wrangler.stdout).not.toContain("to exit");
expect(wrangler.stdout).not.toContain("rebuild container");
});
it("should not show local explorer hotkey by default", async () => {
const wrangler = await startWranglerDev(args);
wrangler.pty.kill();
expect(wrangler.stdout).not.toContain("open local explorer");
});
it("should show local explorer hotkey when X_LOCAL_EXPLORER=true", async () => {
const wrangler = await startWranglerDev(args, false, {
...(process.env as Record<string, string>),
X_LOCAL_EXPLORER: "true",
});
wrangler.pty.kill();
expect(wrangler.stdout).toContain("open local explorer");
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion fixtures/workers-with-assets-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@cloudflare/workers-types": "catalog:default",
"@types/jest-image-snapshot": "^6.4.0",
"@types/node": "catalog:default",
"jest-image-snapshot": "^6.4.0",
"jest-image-snapshot": "^6.5.1",
"playwright-chromium": "catalog:default",
"typescript": "catalog:default",
"undici": "catalog:default",
Expand Down
5 changes: 2 additions & 3 deletions packages/miniflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"capnp:workerd": "capnp-es node_modules/workerd/workerd.capnp -ots:src/runtime/config/generated --src-prefix=node_modules/workerd",
"check:lint": "eslint --max-warnings=0 --cache \"{src,test}/**/*.ts\" \"types/**/*.ts\"",
"check:type": "tsc",
"clean": "rimraf ./dist ./dist-types",
"clean": "node -r esbuild-register ../../tools/clean/clean.ts ./dist ./dist-types",
"dev": "concurrently -n esbuild,typechk,typewrk -c yellow,blue,blue.dim \"node scripts/build.mjs watch\" \"node scripts/types.mjs tsconfig.json watch\" \"node scripts/types.mjs src/workers/tsconfig.json watch\"",
"generate:api": "pnpm generate:openapi && pnpm generate:types",
"generate:openapi": "node -r esbuild-register scripts/filter-openapi.ts -i $OPENAPI_INPUT_PATH",
"generate:types": "openapi-ts && prettier --write src/workers/local-explorer/openapi.local.json src/workers/local-explorer/generated",
"lint:fix": "pnpm run check:lint --fix",
"test": "vitest run",
"posttest": "rimraf ./.tmp",
"posttest": "node -r esbuild-register ../../tools/clean/clean.ts ./.tmp",
"test:ci": "pnpm run test",
"types:build": "node scripts/types.mjs tsconfig.json && node scripts/types.mjs src/workers/tsconfig.json"
},
Expand Down Expand Up @@ -98,7 +98,6 @@
"mime": "^3.0.0",
"postal-mime": "^2.4.3",
"pretty-bytes": "^6.0.0",
"rimraf": "catalog:default",
"source-map": "^0.6.1",
"stoppable": "1.1.0",
"ts-dedent": "^2.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/pages-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"eslint": "catalog:default",
"glob": "^10.4.5",
"html-rewriter-wasm": "^0.4.1",
"rimraf": "catalog:default",
"typescript": "catalog:default",
"vitest": "catalog:default"
},
Expand Down
1 change: 0 additions & 1 deletion packages/workers-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"eslint": "catalog:default",
"ignore": "^5.2.0",
"mime": "^4.0.7",
"rimraf": "catalog:default",
"toucan-js": "4.0.0",
"typescript": "catalog:default",
"vitest": "~2.1.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/workflows-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"build": "esbuild ./src/local-binding-worker.ts --format=esm --bundle --outfile=dist/local-binding-worker.mjs --sourcemap=external --external:cloudflare:*",
"check:lint": "eslint . --max-warnings=0 --cache",
"check:type": "tsc",
"clean": "rimraf dist",
"clean": "node -r esbuild-register ../../tools/clean/clean.ts dist",
"deploy": "echo 'no deploy'",
"dev": "pnpm run bundle:local-binding --watch",
"test:ci": "vitest run",
Expand All @@ -47,7 +47,6 @@
"@types/mime": "^3.0.4",
"esbuild": "catalog:default",
"eslint": "catalog:default",
"rimraf": "catalog:default",
"typescript": "catalog:default",
"vitest": "catalog:default"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/wrangler/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ export default defineConfig([
"workers-sdk/no-vitest-import-expect": "error",
},
},
// Bucket 2: r2, cloudchamber, containers, vectorize
{
files: [
"src/__tests__/{r2,cloudchamber,containers,vectorize}/**/*.test.ts",
],
rules: {
"workers-sdk/no-vitest-import-expect": "error",
},
},
]);
3 changes: 1 addition & 2 deletions packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"build": "pnpm run clean && pnpm tsup && pnpm run generate-json-schema",
"check:lint": "eslint . --max-warnings=0 --cache",
"check:type": "tsc -p ./tsconfig.json && tsc -p ./templates/tsconfig.json",
"clean": "rimraf wrangler-dist miniflare-dist emitted-types",
"clean": "node -r esbuild-register ../../tools/clean/clean.ts wrangler-dist miniflare-dist emitted-types",
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm tsup --watch src --watch ../containers-shared/src --watch ../cli\" \"pnpm run check:type --watch --preserveWatchOutput\"",
"generate-json-schema": "node -r esbuild-register scripts/generate-json-schema.ts",
"start": "pnpm run build && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
Expand Down Expand Up @@ -152,7 +152,6 @@
"prompts": "^2.4.2",
"recast": "0.23.11",
"resolve": "^1.22.8",
"rimraf": "catalog:default",
"semiver": "^1.1.0",
"shell-quote": "^1.8.1",
"signal-exit": "^3.0.7",
Expand Down
25 changes: 25 additions & 0 deletions packages/wrangler/src/__tests__/cli-hotkeys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,30 @@ describe("Hot Keys", () => {
process.stdout.columns = originalColumns;
}
});

it("hides options with disabled property enabled", async () => {
const handlerA = vi.fn();
const handlerB = vi.fn();

registerHotKeys([
{
keys: ["a"],
label: "visible option",
handler: handlerA,
},
{
keys: ["b"],
label: "hidden option",
disabled: true,
handler: handlerB,
},
]);

expect(std.out).toMatchInlineSnapshot(`
"╭──────────────────────╮
│ [a] visible option │
╰──────────────────────╯"
`);
});
});
});
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/apply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
import { writeWranglerConfig } from "@cloudflare/workers-utils/test-helpers";
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, test } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { mockCLIOutput } from "../helpers/mock-cli-output";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
runDockerCmdWithOutput,
} from "@cloudflare/containers-shared";
import { UserError } from "@cloudflare/workers-utils";
/* eslint-disable workers-sdk/no-vitest-import-expect -- tests use vi.mock patterns */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { mockConsoleMethods } from "../helpers/mock-console";
import { runInTempDir } from "../helpers/run-in-tmp";
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/src/__tests__/cloudchamber/common.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import { describe, it } from "vitest";
import { parseImageName } from "../../cloudchamber/common";

describe("parseImageName", () => {
it("works", () => {
it("works", ({ expect }) => {
type TestCase = [
input: string,
expected: { name?: string; tag?: string; digest?: string; err?: boolean },
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import * as fs from "node:fs";
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
import * as TOML from "smol-toml";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers and module-level helpers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_DEPLOYMENTS_COMPLEX } from "../helpers/mock-cloudchamber";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/curl.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { collectCLIOutput } from "../helpers/collect-cli-output";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_DEPLOYMENTS_COMPLEX } from "../helpers/mock-cloudchamber";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/delete.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- large test file */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_DEPLOYMENTS_COMPLEX } from "../helpers/mock-cloudchamber";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/images.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getCloudflareContainerRegistry } from "@cloudflare/containers-shared";
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { mockConsoleMethods } from "../helpers/mock-console";
import { useMockIsTTY } from "../helpers/mock-istty";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/limits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
dockerImageInspect,
InstanceType,
} from "@cloudflare/containers-shared";
/* eslint-disable workers-sdk/no-vitest-import-expect -- tests use expect with rejects patterns */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import {
ensureContainerLimits,
ensureImageFitsLimits,
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/list.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_DEPLOYMENTS_COMPLEX } from "../helpers/mock-cloudchamber";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/cloudchamber/modify.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers and module-level helpers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_DEPLOYMENTS_COMPLEX } from "../helpers/mock-cloudchamber";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { mkdirSync, writeFileSync } from "node:fs";
import path from "node:path";
import { getCloudflareContainerRegistry } from "@cloudflare/containers-shared";
import { UserError } from "@cloudflare/workers-utils";
/* eslint-disable workers-sdk/no-vitest-import-expect -- large test file with 30+ tests */
import { beforeEach, describe, expect, it, vi } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { getNormalizedContainerOptions } from "../../containers/config";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { runInTempDir } from "../helpers/run-in-tmp";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/delete.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers and module-level helpers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccount, setWranglerConfig } from "../cloudchamber/utils";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { mockCLIOutput } from "../helpers/mock-cli-output";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
import { ApplicationAffinityHardwareGeneration } from "@cloudflare/containers-shared/src/client/models/ApplicationAffinityHardwareGeneration";
import { writeWranglerConfig } from "@cloudflare/workers-utils/test-helpers";
import { http, HttpResponse } from "msw";
/* eslint-disable workers-sdk/no-vitest-import-expect -- module-level helper functions use expect */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { clearCachedAccount } from "../../cloudchamber/locations";
import { mockAccountV4 as mockContainersAccount } from "../cloudchamber/utils";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/images.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getCloudflareContainerRegistry } from "@cloudflare/containers-shared";
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccount, setWranglerConfig } from "../cloudchamber/utils";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { mockConsoleMethods } from "../helpers/mock-console";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/info.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import * as user from "../../user";
import { mockAccount, setWranglerConfig } from "../cloudchamber/utils";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
Expand Down
2 changes: 2 additions & 0 deletions packages/wrangler/src/__tests__/containers/list.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { http, HttpResponse } from "msw";
import patchConsole from "patch-console";
/* eslint-disable workers-sdk/no-vitest-import-expect -- expect used in MSW handlers */
import { afterEach, beforeEach, describe, expect, it } from "vitest";
/* eslint-enable workers-sdk/no-vitest-import-expect */
import { mockAccount, setWranglerConfig } from "../cloudchamber/utils";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
import { MOCK_APPLICATIONS } from "../helpers/mock-cloudchamber";
Expand Down
Loading
Loading