From 3c7c9eac8bf66948a0c06ae72a6492d11154915d Mon Sep 17 00:00:00 2001 From: Samuel Macleod Date: Fri, 10 Jan 2025 20:43:53 +0000 Subject: [PATCH] Refactor --- .../api/startDevWorker/ConfigController.ts | 16 +-- packages/wrangler/src/d1/create.ts | 2 +- packages/wrangler/src/d1/delete.ts | 2 +- packages/wrangler/src/d1/execute.ts | 2 +- packages/wrangler/src/d1/export.ts | 2 +- packages/wrangler/src/d1/info.ts | 2 +- packages/wrangler/src/d1/insights.ts | 2 +- packages/wrangler/src/d1/list.ts | 2 +- packages/wrangler/src/d1/migrations/apply.ts | 2 +- packages/wrangler/src/d1/migrations/create.ts | 2 +- packages/wrangler/src/d1/migrations/list.ts | 2 +- packages/wrangler/src/d1/timeTravel/info.ts | 2 +- .../wrangler/src/d1/timeTravel/restore.ts | 2 +- packages/wrangler/src/delete.ts | 3 +- packages/wrangler/src/deploy/index.ts | 10 +- .../src/deployment-bundle/bindings.ts | 2 +- packages/wrangler/src/deployments.ts | 3 +- packages/wrangler/src/dispatch-namespace.ts | 2 +- packages/wrangler/src/generate/index.ts | 2 +- packages/wrangler/src/index.ts | 128 +----------------- packages/wrangler/src/init.ts | 2 +- .../wrangler/src/pages/deployment-tails.ts | 2 +- packages/wrangler/src/pages/secret/index.ts | 2 +- packages/wrangler/src/pipelines/index.ts | 2 +- packages/wrangler/src/secret/index.ts | 8 +- packages/wrangler/src/tail/createTail.ts | 2 +- packages/wrangler/src/tail/index.ts | 8 +- packages/wrangler/src/triggers/index.ts | 4 +- packages/wrangler/src/utils/constants.ts | 12 ++ .../src/utils/getDevCompatibilityDate.ts | 27 ++++ .../wrangler/src/utils/getLegacyScriptName.ts | 15 ++ packages/wrangler/src/utils/getRules.ts | 24 ++++ packages/wrangler/src/utils/getScriptName.ts | 27 ++++ packages/wrangler/src/utils/isLegacyEnv.ts | 7 + .../src/utils/logPossibleBugMessage.ts | 19 +++ .../wrangler/src/versions/secrets/bulk.ts | 2 +- .../wrangler/src/versions/secrets/delete.ts | 3 +- .../wrangler/src/versions/secrets/list.ts | 2 +- packages/wrangler/src/versions/secrets/put.ts | 2 +- packages/wrangler/src/versions/upload.ts | 4 +- 40 files changed, 187 insertions(+), 177 deletions(-) create mode 100644 packages/wrangler/src/utils/constants.ts create mode 100644 packages/wrangler/src/utils/getDevCompatibilityDate.ts create mode 100644 packages/wrangler/src/utils/getLegacyScriptName.ts create mode 100644 packages/wrangler/src/utils/getRules.ts create mode 100644 packages/wrangler/src/utils/getScriptName.ts create mode 100644 packages/wrangler/src/utils/isLegacyEnv.ts create mode 100644 packages/wrangler/src/utils/logPossibleBugMessage.ts diff --git a/packages/wrangler/src/api/startDevWorker/ConfigController.ts b/packages/wrangler/src/api/startDevWorker/ConfigController.ts index 23349099b0e0..561b5eac952e 100644 --- a/packages/wrangler/src/api/startDevWorker/ConfigController.ts +++ b/packages/wrangler/src/api/startDevWorker/ConfigController.ts @@ -1,14 +1,6 @@ import assert from "node:assert"; import path from "node:path"; import { watch } from "chokidar"; -import { - DEFAULT_INSPECTOR_PORT, - DEFAULT_LOCAL_PORT, - getDevCompatibilityDate, - getRules, - getScriptName, - isLegacyEnv, -} from "../.."; import { getAssetsOptions, validateAssetsArgsAndConfig } from "../../assets"; import { readConfig } from "../../config"; import { getEntry } from "../../deployment-bundle/entry"; @@ -23,6 +15,14 @@ import { getLocalPersistencePath } from "../../dev/get-local-persistence-path"; import { UserError } from "../../errors"; import { logger } from "../../logger"; import { requireApiToken, requireAuth } from "../../user"; +import { + DEFAULT_INSPECTOR_PORT, + DEFAULT_LOCAL_PORT, +} from "../../utils/constants"; +import { getDevCompatibilityDate } from "../../utils/getDevCompatibilityDate"; +import { getRules } from "../../utils/getRules"; +import { getScriptName } from "../../utils/getScriptName"; +import { isLegacyEnv } from "../../utils/isLegacyEnv"; import { memoizeGetPort } from "../../utils/memoizeGetPort"; import { printBindings } from "../../utils/print-bindings"; import { getZoneIdForPreview } from "../../zones"; diff --git a/packages/wrangler/src/d1/create.ts b/packages/wrangler/src/d1/create.ts index 5efe0a3ee1fb..bea94be1efaf 100644 --- a/packages/wrangler/src/d1/create.ts +++ b/packages/wrangler/src/d1/create.ts @@ -1,10 +1,10 @@ import TOML from "@iarna/toml"; -import { printWranglerBanner } from ".."; import { fetchResult } from "../cfetch"; import { withConfig } from "../config"; import { UserError } from "../errors"; import { logger } from "../logger"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import { LOCATION_CHOICES } from "./constants"; import type { CommonYargsArgv, diff --git a/packages/wrangler/src/d1/delete.ts b/packages/wrangler/src/d1/delete.ts index 6d89f38ca54f..9674c8b412a6 100644 --- a/packages/wrangler/src/d1/delete.ts +++ b/packages/wrangler/src/d1/delete.ts @@ -1,9 +1,9 @@ -import { printWranglerBanner } from ".."; import { fetchResult } from "../cfetch"; import { withConfig } from "../config"; import { confirm } from "../dialogs"; import { logger } from "../logger"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import { Name } from "./options"; import { getDatabaseByNameOrBinding } from "./utils"; import type { diff --git a/packages/wrangler/src/d1/execute.ts b/packages/wrangler/src/d1/execute.ts index fdc18ee1d006..24d76c5c8651 100644 --- a/packages/wrangler/src/d1/execute.ts +++ b/packages/wrangler/src/d1/execute.ts @@ -6,7 +6,6 @@ import chalk from "chalk"; import md5File from "md5-file"; import { Miniflare } from "miniflare"; import { fetch } from "undici"; -import { printWranglerBanner } from ".."; import { fetchResult } from "../cfetch"; import { configFileName, readConfig } from "../config"; import { getLocalPersistencePath } from "../dev/get-local-persistence-path"; @@ -16,6 +15,7 @@ import { logger } from "../logger"; import { APIError, readFileSync } from "../parse"; import { readableRelative } from "../paths"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import * as options from "./options"; import splitSqlQuery from "./splitter"; import { getDatabaseByNameOrBinding, getDatabaseInfoFromConfig } from "./utils"; diff --git a/packages/wrangler/src/d1/export.ts b/packages/wrangler/src/d1/export.ts index 536285c94146..81acc779432d 100644 --- a/packages/wrangler/src/d1/export.ts +++ b/packages/wrangler/src/d1/export.ts @@ -4,7 +4,6 @@ import { spinner, spinnerWhile } from "@cloudflare/cli/interactive"; import chalk from "chalk"; import { Miniflare } from "miniflare"; import { fetch } from "undici"; -import { printWranglerBanner } from ".."; import { fetchResult } from "../cfetch"; import { configFileName, readConfig } from "../config"; import { getLocalPersistencePath } from "../dev/get-local-persistence-path"; @@ -13,6 +12,7 @@ import { logger } from "../logger"; import { APIError } from "../parse"; import { readableRelative } from "../paths"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import { Name } from "./options"; import { getDatabaseByNameOrBinding, getDatabaseInfoFromConfig } from "./utils"; import type { Config } from "../config"; diff --git a/packages/wrangler/src/d1/info.ts b/packages/wrangler/src/d1/info.ts index dfa460bd45b5..56ba61f94352 100644 --- a/packages/wrangler/src/d1/info.ts +++ b/packages/wrangler/src/d1/info.ts @@ -1,9 +1,9 @@ import prettyBytes from "pretty-bytes"; -import { printWranglerBanner } from ".."; import { fetchGraphqlResult } from "../cfetch"; import { withConfig } from "../config"; import { logger } from "../logger"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import { getDatabaseByNameOrBinding, getDatabaseInfoFromId } from "./utils"; import type { CommonYargsArgv, diff --git a/packages/wrangler/src/d1/insights.ts b/packages/wrangler/src/d1/insights.ts index 9ec3d5de8e55..929b6ba262ba 100644 --- a/packages/wrangler/src/d1/insights.ts +++ b/packages/wrangler/src/d1/insights.ts @@ -1,8 +1,8 @@ -import { printWranglerBanner } from ".."; import { fetchGraphqlResult } from "../cfetch"; import { withConfig } from "../config"; import { logger } from "../logger"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import { getDatabaseByNameOrBinding, getDatabaseInfoFromId } from "./utils"; import type { CommonYargsArgv, diff --git a/packages/wrangler/src/d1/list.ts b/packages/wrangler/src/d1/list.ts index 2ab70a35eee9..a6e568614eb4 100644 --- a/packages/wrangler/src/d1/list.ts +++ b/packages/wrangler/src/d1/list.ts @@ -1,8 +1,8 @@ -import { printWranglerBanner } from ".."; import { fetchResult } from "../cfetch"; import { withConfig } from "../config"; import { logger } from "../logger"; import { requireAuth } from "../user"; +import { printWranglerBanner } from "../wrangler-banner"; import type { CommonYargsArgv, StrictYargsOptionsToInterface, diff --git a/packages/wrangler/src/d1/migrations/apply.ts b/packages/wrangler/src/d1/migrations/apply.ts index f1676409452b..5b9d741db7c0 100644 --- a/packages/wrangler/src/d1/migrations/apply.ts +++ b/packages/wrangler/src/d1/migrations/apply.ts @@ -1,13 +1,13 @@ import assert from "node:assert"; import fs from "node:fs"; import path from "path"; -import { printWranglerBanner } from "../.."; import { configFileName, withConfig } from "../../config"; import { confirm } from "../../dialogs"; import { UserError } from "../../errors"; import { isNonInteractiveOrCI } from "../../is-interactive"; import { logger } from "../../logger"; import { requireAuth } from "../../user"; +import { printWranglerBanner } from "../../wrangler-banner"; import { createBackup } from "../backups"; import { DEFAULT_MIGRATION_PATH, DEFAULT_MIGRATION_TABLE } from "../constants"; import { executeSql } from "../execute"; diff --git a/packages/wrangler/src/d1/migrations/create.ts b/packages/wrangler/src/d1/migrations/create.ts index a156d07ef7d1..78fb82041b3b 100644 --- a/packages/wrangler/src/d1/migrations/create.ts +++ b/packages/wrangler/src/d1/migrations/create.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; import path from "path"; -import { printWranglerBanner } from "../.."; import { configFileName, withConfig } from "../../config"; import { UserError } from "../../errors"; import { logger } from "../../logger"; +import { printWranglerBanner } from "../../wrangler-banner"; import { DEFAULT_MIGRATION_PATH } from "../constants"; import { Database } from "../options"; import { getDatabaseInfoFromConfig } from "../utils"; diff --git a/packages/wrangler/src/d1/migrations/list.ts b/packages/wrangler/src/d1/migrations/list.ts index e6c7ef5df26f..050c192a230d 100644 --- a/packages/wrangler/src/d1/migrations/list.ts +++ b/packages/wrangler/src/d1/migrations/list.ts @@ -1,9 +1,9 @@ import path from "path"; -import { printWranglerBanner } from "../.."; import { configFileName, withConfig } from "../../config"; import { UserError } from "../../errors"; import { logger } from "../../logger"; import { requireAuth } from "../../user"; +import { printWranglerBanner } from "../../wrangler-banner"; import { DEFAULT_MIGRATION_PATH, DEFAULT_MIGRATION_TABLE } from "../constants"; import { getDatabaseInfoFromConfig } from "../utils"; import { diff --git a/packages/wrangler/src/d1/timeTravel/info.ts b/packages/wrangler/src/d1/timeTravel/info.ts index 62de22e8b0c2..f032e6db4d9c 100644 --- a/packages/wrangler/src/d1/timeTravel/info.ts +++ b/packages/wrangler/src/d1/timeTravel/info.ts @@ -1,7 +1,7 @@ -import { printWranglerBanner } from "../.."; import { withConfig } from "../../config"; import { logger } from "../../logger"; import { requireAuth } from "../../user"; +import { printWranglerBanner } from "../../wrangler-banner"; import { Database } from "../options"; import { getDatabaseByNameOrBinding } from "../utils"; import { getBookmarkIdFromTimestamp, throwIfDatabaseIsAlpha } from "./utils"; diff --git a/packages/wrangler/src/d1/timeTravel/restore.ts b/packages/wrangler/src/d1/timeTravel/restore.ts index 2cb33c489dd9..9dc6be16e49d 100644 --- a/packages/wrangler/src/d1/timeTravel/restore.ts +++ b/packages/wrangler/src/d1/timeTravel/restore.ts @@ -1,10 +1,10 @@ -import { printWranglerBanner } from "../.."; import { fetchResult } from "../../cfetch"; import { withConfig } from "../../config"; import { confirm } from "../../dialogs"; import { UserError } from "../../errors"; import { logger } from "../../logger"; import { requireAuth } from "../../user"; +import { printWranglerBanner } from "../../wrangler-banner"; import { Database } from "../options"; import { getDatabaseByNameOrBinding } from "../utils"; import { getBookmarkIdFromTimestamp, throwIfDatabaseIsAlpha } from "./utils"; diff --git a/packages/wrangler/src/delete.ts b/packages/wrangler/src/delete.ts index 87b76bf44e26..6a05069d29f8 100644 --- a/packages/wrangler/src/delete.ts +++ b/packages/wrangler/src/delete.ts @@ -7,7 +7,8 @@ import { deleteKVNamespace, listKVNamespaces } from "./kv/helpers"; import { logger } from "./logger"; import * as metrics from "./metrics"; import { requireAuth } from "./user"; -import { getScriptName, printWranglerBanner } from "./index"; +import { getScriptName } from "./utils/getScriptName"; +import { printWranglerBanner } from "./wrangler-banner"; import type { CommonYargsArgv, StrictYargsOptionsToInterface, diff --git a/packages/wrangler/src/deploy/index.ts b/packages/wrangler/src/deploy/index.ts index f175fe623e61..e40172040f7c 100644 --- a/packages/wrangler/src/deploy/index.ts +++ b/packages/wrangler/src/deploy/index.ts @@ -5,12 +5,6 @@ import { configFileName, readConfig } from "../config"; import { getEntry } from "../deployment-bundle/entry"; import { UserError } from "../errors"; import { run } from "../experimental-flags"; -import { - getRules, - getScriptName, - isLegacyEnv, - printWranglerBanner, -} from "../index"; import { logger } from "../logger"; import { verifyWorkerMatchesCITag } from "../match-tag"; import * as metrics from "../metrics"; @@ -18,6 +12,10 @@ import { writeOutput } from "../output"; import { getLegacyAssetPaths, getSiteAssetPaths } from "../sites"; import { requireAuth } from "../user"; import { collectKeyValues } from "../utils/collectKeyValues"; +import { getRules } from "../utils/getRules"; +import { getScriptName } from "../utils/getScriptName"; +import { isLegacyEnv } from "../utils/isLegacyEnv"; +import { printWranglerBanner } from "../wrangler-banner"; import deploy from "./deploy"; import type { Config } from "../config"; import type { diff --git a/packages/wrangler/src/deployment-bundle/bindings.ts b/packages/wrangler/src/deployment-bundle/bindings.ts index a9a90516564d..8f434e9e57e9 100644 --- a/packages/wrangler/src/deployment-bundle/bindings.ts +++ b/packages/wrangler/src/deployment-bundle/bindings.ts @@ -1,5 +1,4 @@ import chalk from "chalk"; -import { isLegacyEnv } from ".."; import { fetchResult } from "../cfetch"; import { createD1Database } from "../d1/create"; import { listDatabases } from "../d1/list"; @@ -8,6 +7,7 @@ import { FatalError, UserError } from "../errors"; import { createKVNamespace, listKVNamespaces } from "../kv/helpers"; import { logger } from "../logger"; import { createR2Bucket, listR2Buckets } from "../r2/helpers"; +import { isLegacyEnv } from "../utils/isLegacyEnv"; import { printBindings } from "../utils/print-bindings"; import type { Config } from "../config"; import type { WorkerMetadataBinding } from "./create-worker-upload-form"; diff --git a/packages/wrangler/src/deployments.ts b/packages/wrangler/src/deployments.ts index c70228292e53..999b81e30184 100644 --- a/packages/wrangler/src/deployments.ts +++ b/packages/wrangler/src/deployments.ts @@ -10,7 +10,8 @@ import { mapBindings } from "./init"; import { logger } from "./logger"; import * as metrics from "./metrics"; import { requireAuth } from "./user"; -import { getScriptName, printWranglerBanner } from "."; +import { getScriptName } from "./utils/getScriptName"; +import { printWranglerBanner } from "./wrangler-banner"; import type { Config } from "./config"; import type { WorkerMetadataBinding } from "./deployment-bundle/create-worker-upload-form"; import type { ServiceMetadataRes } from "./init"; diff --git a/packages/wrangler/src/dispatch-namespace.ts b/packages/wrangler/src/dispatch-namespace.ts index 5fd70279da2d..5ae4e94d50e2 100644 --- a/packages/wrangler/src/dispatch-namespace.ts +++ b/packages/wrangler/src/dispatch-namespace.ts @@ -3,7 +3,7 @@ import { readConfig } from "./config"; import { logger } from "./logger"; import * as metrics from "./metrics"; import { requireAuth } from "./user"; -import { printWranglerBanner } from "."; +import { printWranglerBanner } from "./wrangler-banner"; import type { CommonYargsArgv, CommonYargsOptions } from "./yargs-types"; import type { CommandModule } from "yargs"; diff --git a/packages/wrangler/src/generate/index.ts b/packages/wrangler/src/generate/index.ts index 849930aaf528..301512335f18 100644 --- a/packages/wrangler/src/generate/index.ts +++ b/packages/wrangler/src/generate/index.ts @@ -4,11 +4,11 @@ import { execa } from "execa"; import { getC3CommandFromEnv } from "../environment-variables/misc-variables"; import { CommandLineArgsError, UserError } from "../errors"; import { cloneIntoDirectory, initializeGit } from "../git-client"; -import { printWranglerBanner } from "../index"; import { initHandler } from "../init"; import { logger } from "../logger"; import { getPackageManager } from "../package-manager"; import * as shellquote from "../utils/shell-quote"; +import { printWranglerBanner } from "../wrangler-banner"; import type { CommonYargsArgv, StrictYargsOptionsToInterface, diff --git a/packages/wrangler/src/index.ts b/packages/wrangler/src/index.ts index fbdf287b787d..b5d1795b64e4 100644 --- a/packages/wrangler/src/index.ts +++ b/packages/wrangler/src/index.ts @@ -1,19 +1,12 @@ -import module from "node:module"; import os from "node:os"; import { setTimeout } from "node:timers/promises"; -import TOML from "@iarna/toml"; import chalk from "chalk"; import { ProxyAgent, setGlobalDispatcher } from "undici"; import makeCLI from "yargs"; import { version as wranglerVersion } from "../package.json"; import { ai } from "./ai"; import { cloudchamber } from "./cloudchamber"; -import { - configFileName, - experimental_readRawConfig, - formatConfigSnippet, - loadDotEnv, -} from "./config"; +import { experimental_readRawConfig, loadDotEnv } from "./config"; import { demandSingleValue } from "./core"; import { CommandRegistry } from "./core/CommandRegistry"; import { createRegisterYargsCommand } from "./core/register-yargs-command"; @@ -148,11 +141,12 @@ import { import { tailHandler, tailOptions } from "./tail"; import registerTriggersSubcommands from "./triggers"; import { typesHandler, typesOptions } from "./type-generation"; -import { updateCheck } from "./update-check"; import { getAuthFromEnv } from "./user"; import { loginCommand, logoutCommand, whoamiCommand } from "./user/commands"; import { whoami } from "./user/whoami"; +import { betaCmdColor, proxy } from "./utils/constants"; import { debugLogFilepath } from "./utils/log-file"; +import { logPossibleBugMessage } from "./utils/logPossibleBugMessage"; import { vectorize } from "./vectorize/index"; import { versionsNamespace } from "./versions"; import { versionsDeployCommand } from "./versions/deploy"; @@ -181,23 +175,9 @@ import { workflowsListCommand } from "./workflows/commands/list"; import { workflowsTriggerCommand } from "./workflows/commands/trigger"; import { printWranglerBanner } from "./wrangler-banner"; import { asJson } from "./yargs-types"; -import type { Config } from "./config"; import type { LoggerLevel } from "./logger"; import type { CommonYargsArgv, SubHelp } from "./yargs-types"; -const resetColor = "\x1b[0m"; -const fgGreenColor = "\x1b[32m"; -export const betaCmdColor = "#BD5B08"; - -export const DEFAULT_LOCAL_PORT = 8787; -export const DEFAULT_INSPECTOR_PORT = 9229; -export const proxy = - process.env.https_proxy || - process.env.HTTPS_PROXY || - process.env.http_proxy || - process.env.HTTP_PROXY || - undefined; - if (proxy) { setGlobalDispatcher(new ProxyAgent(proxy)); logger.log( @@ -205,67 +185,6 @@ if (proxy) { ); } -export function getRules(config: Config): Config["rules"] { - const rules = config.rules ?? config.build?.upload?.rules ?? []; - - if (config.rules && config.build?.upload?.rules) { - throw new UserError( - `You cannot configure both [rules] and [build.upload.rules] in your ${configFileName(config.configPath)} file. Delete the \`build.upload\` section.` - ); - } - - if (config.build?.upload?.rules) { - logger.warn( - `Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration file, and add this: - -${TOML.stringify({ rules: config.build.upload.rules })}` - ); - } - return rules; -} - -export function isLegacyEnv(config: Config): boolean { - // We only read from config here, because we've already accounted for - // args["legacy-env"] in https://github.com/cloudflare/workers-sdk/blob/b24aeb5722370c2e04bce97a84a1fa1e55725d79/packages/wrangler/src/config/validation.ts#L94-L98 - return config.legacy_env; -} - -export function getScriptName( - args: { name: string | undefined; env: string | undefined }, - config: Config -): string | undefined { - if (args.name && isLegacyEnv(config) && args.env) { - throw new CommandLineArgsError( - `In legacy environment mode you cannot use --name and --env together. If you want to specify a Worker name for a specific environment you can add the following to your ${configFileName(config.configPath)} file:\n` + - formatConfigSnippet( - { - env: { - [args.env]: { - name: args.name, - }, - }, - }, - config.configPath - ) - ); - } - - return args.name ?? config.name; -} - -/** - * Alternative to the getScriptName() because special Legacy cases allowed - * "name", and "env" together in Wrangler v1 - */ -export function getLegacyScriptName( - args: { name: string | undefined; env: string | undefined }, - config: Config -) { - return args.name && args.env && isLegacyEnv(config) - ? `${args.name}-${args.env}` - : args.name ?? config.name; -} - export function createCLIParser(argv: string[]) { // Type check result against CommonYargsOptions to make sure we've included // all common options @@ -1237,44 +1156,3 @@ export async function main(argv: string[]): Promise { } } } - -export function getDevCompatibilityDate( - config: Config, - compatibilityDate = config.compatibility_date -): string { - // Get the maximum compatibility date supported by the installed Miniflare - const miniflareEntry = require.resolve("miniflare"); - const miniflareRequire = module.createRequire(miniflareEntry); - const miniflareWorkerd = miniflareRequire("workerd") as { - compatibilityDate: string; - }; - const currentDate = miniflareWorkerd.compatibilityDate; - - if (config.configPath !== undefined && compatibilityDate === undefined) { - logger.warn( - `No compatibility_date was specified. Using the installed Workers runtime's latest supported date: ${currentDate}.\n` + - `❯❯ Add one to your ${configFileName(config.configPath)} file: compatibility_date = "${currentDate}", or\n` + - `❯❯ Pass it in your terminal: wrangler dev [