Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove express-based dev registry #7706

Merged
merged 7 commits into from
Jan 10, 2025
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
5 changes: 5 additions & 0 deletions .changeset/ten-eyes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Remove the server-based dev registry in favour of the more stable file-based dev registry. There should be no user-facing impact.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ packages/quick-edit/vscode
packages/quick-edit/web

packages/wrangler/config-schema.json
packages/wrangler/metafile.json
packages/chrome-devtools-patches/built-devtools
packages/chrome-devtools-patches/.cipd
packages/chrome-devtools-patches/.gclient
Expand Down
1 change: 0 additions & 1 deletion fixtures/get-platform-proxy/tests/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export function getPlatformProxy<T>(
return originalGetPlatformProxy({
...options,
persist: false,
experimentalRegistry: true,
});
}
17 changes: 3 additions & 14 deletions fixtures/shared/src/run-wrangler-long-lived.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,13 @@ export async function runWranglerPagesDev(
) {
if (publicPath) {
return runLongLivedWrangler(
[
"pages",
"dev",
publicPath,
"--x-registry",
"--ip=127.0.0.1",
...options,
],
["pages", "dev", publicPath, "--ip=127.0.0.1", ...options],
cwd,
env
);
} else {
return runLongLivedWrangler(
["pages", "dev", "--x-registry", "--ip=127.0.0.1", ...options],
["pages", "dev", "--ip=127.0.0.1", ...options],
cwd,
env
);
Expand All @@ -58,11 +51,7 @@ export async function runWranglerDev(
options: string[],
env?: NodeJS.ProcessEnv
) {
return runLongLivedWrangler(
["dev", "--x-registry", "--ip=127.0.0.1", ...options],
cwd,
env
);
return runLongLivedWrangler(["dev", "--ip=127.0.0.1", ...options], cwd, env);
}

async function runLongLivedWrangler(
Expand Down
10 changes: 5 additions & 5 deletions packages/pages-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"devDependencies": {
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "^4.20241230.0",
"@miniflare/cache": "^2.14.2",
"@miniflare/core": "^2.14.2",
"@miniflare/html-rewriter": "^2.14.2",
"@miniflare/storage-memory": "^2.14.2",
"@miniflare/cache": "^2.14.4",
"@miniflare/core": "^2.14.4",
"@miniflare/html-rewriter": "^2.14.4",
"@miniflare/storage-memory": "^2.14.4",
"concurrently": "^8.2.2",
"glob": "^10.3.3"
"glob": "^10.4.5"
},
"volta": {
"extends": "../../package.json"
Expand Down
5 changes: 1 addition & 4 deletions packages/wrangler/e2e/dev-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ describe("unstable_dev()", () => {
});
});

describe.each([
{ cmd: "wrangler dev" },
{ cmd: "wrangler dev --no-x-registry" },
])("dev registry $cmd", ({ cmd }) => {
describe.each([{ cmd: "wrangler dev" }])("dev registry $cmd", ({ cmd }) => {
let workerName: string;
let workerName2: string;
let workerName3: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/e2e/get-platform-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe("getPlatformProxy()", () => {
});

async function runInNode(code: string) {
const w = helper.runLongLived("wrangler dev --x-registry", {
const w = helper.runLongLived("wrangler dev", {
cwd: worker,
});

Expand All @@ -130,7 +130,7 @@ describe("getPlatformProxy()", () => {
"index.mjs": dedent/*javascript*/ `
import { getPlatformProxy } from "${WRANGLER_IMPORT}"
const { env } = await getPlatformProxy({ experimentalRegistry: true });
const { env } = await getPlatformProxy();
const resp = ${code}
Expand Down
5 changes: 0 additions & 5 deletions packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@
"@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",
Expand All @@ -119,7 +117,6 @@
"@types/yargs": "^17.0.22",
"@vitest/ui": "catalog:default",
"@webcontainer/env": "^1.1.0",
"body-parser": "^1.20.0",
"chalk": "^5.2.0",
"cli-table3": "^0.6.3",
"cmd-shim": "^4.1.0",
Expand All @@ -128,11 +125,9 @@
"devtools-protocol": "^0.0.1182435",
"dotenv": "^16.3.1",
"execa": "^6.1.0",
"express": "^4.18.1",
"find-up": "^6.3.0",
"get-port": "^7.0.0",
"glob-to-regexp": "^0.4.1",
"http-terminator": "^3.2.0",
"https-proxy-agent": "7.0.2",
"ignore": "^5.2.0",
"is-ci": "^3.0.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/wrangler/scripts/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { writeFileSync } from "node:fs";
import path from "node:path";
import * as esbuild from "esbuild";
import { EXTERNAL_DEPENDENCIES } from "./deps";
Expand Down Expand Up @@ -35,6 +36,7 @@ async function buildMain(flags: BuildFlags = {}) {
outdir,
platform: "node",
format: "cjs",
metafile: true,
external: EXTERNAL_DEPENDENCIES,
sourcemap: process.env.SOURCEMAPS !== "false",
inject: [path.join(__dirname, "../import_meta_url.js")],
Expand Down Expand Up @@ -64,7 +66,8 @@ async function buildMain(flags: BuildFlags = {}) {
const ctx = await esbuild.context(options);
await ctx.watch();
} else {
await esbuild.build(options);
const res = await esbuild.build(options);
writeFileSync("metafile.json", JSON.stringify(res.metafile));
penalosa marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,6 @@ describe("normalizeAndValidateConfig()", () => {
const { diagnostics } = run(
{
RESOURCES_PROVISION: true,
FILE_BASED_REGISTRY: false,
MULTIWORKER: false,
},
() =>
Expand Down Expand Up @@ -2695,7 +2694,6 @@ describe("normalizeAndValidateConfig()", () => {
const { diagnostics } = run(
{
RESOURCES_PROVISION: true,
FILE_BASED_REGISTRY: false,
MULTIWORKER: false,
},
() =>
Expand Down Expand Up @@ -3025,7 +3023,6 @@ describe("normalizeAndValidateConfig()", () => {
const { diagnostics } = run(
{
RESOURCES_PROVISION: true,
FILE_BASED_REGISTRY: false,
MULTIWORKER: false,
},
() =>
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/src/__tests__/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,6 @@ describe.sequential("wrangler dev", () => {
--test-scheduled Test scheduled events by visiting /__scheduled in browser [boolean] [default: false]
--log-level Specify logging level [choices: \\"debug\\", \\"info\\", \\"log\\", \\"warn\\", \\"error\\", \\"none\\"] [default: \\"log\\"]
--show-interactive-dev-session Show interactive dev session (defaults to true if the terminal supports interactivity) [boolean]
--experimental-registry, --x-registry Use the experimental file based dev registry for multi-worker development [boolean] [default: true]
--experimental-vectorize-bind-to-prod Bind to production Vectorize indexes in local development mode [boolean] [default: false]",
"warn": "",
}
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/src/__tests__/pages/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe("pages", () => {
--persist-to Specify directory to use for local persistence (defaults to .wrangler/state) [string]
--log-level Specify logging level [choices: \\"debug\\", \\"info\\", \\"log\\", \\"warn\\", \\"error\\", \\"none\\"]
--show-interactive-dev-session Show interactive dev session (defaults to true if the terminal supports interactivity) [boolean]
--experimental-registry, --x-registry Use the experimental file based dev registry for multi-worker development [boolean] [default: true]
--experimental-vectorize-bind-to-prod Bind to production Vectorize indexes in local development mode [boolean] [default: false]"
`);
});
Expand Down
62 changes: 0 additions & 62 deletions packages/wrangler/src/__tests__/unstableDev.test.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/wrangler/src/api/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export async function unstable_dev(
showInteractiveDevSession,
testMode,
testScheduled,
fileBasedRegistry = true,
vectorizeBindToProd,
// 2. options for alpha/beta products/libs
d1Databases,
Expand Down Expand Up @@ -218,16 +217,13 @@ export async function unstable_dev(
logLevel: options?.logLevel ?? defaultLogLevel,
port: options?.port ?? 0,
experimentalProvision: undefined,
experimentalDevEnv: undefined,
experimentalRegistry: fileBasedRegistry,
experimentalVectorizeBindToProd: vectorizeBindToProd ?? false,
enableIpc: options?.experimental?.enableIpc,
};

//outside of test mode, rebuilds work fine, but only one instance of wrangler will work at a time
const devServer = await run(
{
FILE_BASED_REGISTRY: fileBasedRegistry,
// TODO: can we make this work?
MULTIWORKER: false,
RESOURCES_PROVISION: false,
Expand Down
7 changes: 0 additions & 7 deletions packages/wrangler/src/api/integrations/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ export type GetPlatformProxyOptions = {
* If `false` is specified no data is persisted on the filesystem.
*/
persist?: boolean | { path: string };
/**
* Use the experimental file-based dev registry for service discovery
*
* Note: this feature is experimental
*/
experimentalRegistry?: boolean;
};

/**
Expand Down Expand Up @@ -110,7 +104,6 @@ export async function getPlatformProxy<

const miniflareOptions = await run(
{
FILE_BASED_REGISTRY: Boolean(options.experimentalRegistry ?? true),
MULTIWORKER: false,
RESOURCES_PROVISION: false,
},
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export * from "./api/integrations";

// Export internal APIs required by the Vitest integration as `unstable_`
export { default as unstable_splitSqlQuery } from "./d1/splitter";
export { startWorkerRegistryServer as unstable_startWorkerRegistryServer } from "./dev-registry";

// `miniflare-cli/assets` dynamically imports`@cloudflare/pages-shared/environment-polyfills`.
// `@cloudflare/pages-shared/environment-polyfills/types.ts` defines `global`
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/src/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export type DeployArgs = StrictYargsOptionsToInterface<typeof deployOptions>;
export async function deployHandler(args: DeployArgs) {
await run(
{
FILE_BASED_REGISTRY: false,
RESOURCES_PROVISION: args.experimentalProvision ?? false,
MULTIWORKER: false,
},
Expand Down
Loading
Loading