Dashboard › craft › Distillation
bbe9fd1c-ef56-4a9d-b524-8d6ccf1810f6["e803406d7335fc1a4e0cb31aa0810369","c95644ce5088bb193af89f5ef339fe54","d93e833e454813464d56212fcde87ddb","acda0da3888854e7ebf067e3cb457861","cf69618681f8343c4bc7690070e99c80","7a20a742cf69ebaa2b855bb1881d1216","b813310b190ea0a539c1bc7ef5f6a60b","62a5a6c9da5263aeaced3046e543effd","d40b6c7aca2936e725bd18a4eda29f6c"]
Date: Jul 21, 2026
deploy2({directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args}) — the Pages deploy command handler. It reads _headers, _redirects, _routes.json, and _worker.js (or directory) from the build output directory via fs6.readFileSync/fs6.lstatSync.wrangler pages deploy calls fetchResult2(COMPLIANCE_REGION_CONFIG_PUBLIC, \/accounts/${accountId}/pages/projects/${projectName}`)(GET) to fetch the project, then readsproject.production_branchto computeisProduction = project.production_branch === branch; env becomes "production"or"preview", and deploymentConfig = project.deployment_configs[env7]`.deploy2 also computes nodejsCompatMode via validateNodeCompatMode(config2?.compatibility_date ?? deploymentConfig.compatibility_date, config2?.compatibility_flags ?? deploymentConfig.compatibility_flags ?? [], {noBundle: config2?.no_bundle}), plus defineNavigatorUserAgent via isNavigatorDefined(...) and checkFetch via shouldCheckFetch(...), all using the same compatibility_date/flags fallback pattern (config2 first, else deploymentConfig).functionsDirectory defaults to path2__default.join(process5.cwd(), "functions") if customFunctionsDirectory not set; if no _worker.js and functions dir exists, buildFunctions({outputConfigPath, functionsDirectory, sourcemap: sourceMaps, buildOutputDirectory: directory, routesOutputPath, local: false, ...}) is invoked with routesOutputPath set to a temp file _routes-${Math.random()}.json under getPagesTmpDir() if no existing _routes.json.maxFileCountAllowedFromClaims(token) decodes a JWT payload via decodeJwtPayload(token) and returns decodedJwt["max_file_count_allowed"] if numeric, else MAX_ASSET_COUNT_DEFAULT; special-cases test tokens <<funfetti-auth-jwt>>, <<funfetti-auth-jwt2>>, <<aus-completion-token>> under vitest to return MAX_ASSET_COUNT_DEFAULT.Cloudflare SDK methods at lines 63685 (POST /accounts), 63708 (getAPIList("/accounts", ...)), 81224 (PUT /memberships/${membershipId}), 81230 (getAPIList("/memberships", ...)), 81243 (DELETE /memberships/${membershipId}), 81256 (GET /memberships/${membershipId}); and wrangler's own account-resolution functions at lines 112515 fetchAllAccounts2, 112569 getActiveAccountId, 112585 getOrSelectAccountId2.fetchAllAccounts2(complianceConfig, options={throwOnEmpty:true}) runs Promise.allSettled([fetchAccountsPaged(complianceConfig, '/accounts'), fetchAccountsPaged(complianceConfig, '/memberships')]); filters accountsRes.value to only accounts present in membershipIds (built from membershipsRes.value.map(m => m.account.id)); if memberships fetch rejected and isMembershipsInaccessible(reason) and accounts fetch succeeded with length>0, returns accounts as-is; if error code is 9106, throws a UserError telling the user to check API token/env vars (CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, CLOUDFLARE_EMAIL) or re-run login, or set account_id in config or CLOUDFLARE_ACCOUNT_ID.getActiveAccountId(config2) resolution order: (1) oauthFlow.getActiveTemporaryAccount(), (2) config2.account_id, (3) getCloudflareAccountIdFromEnv() (env var CLOUDFLARE_ACCOUNT_ID), (4) getAccountFromCache2()?.id.getOrSelectAccountId2(config2) — if getActiveAccountId returns a value, uses it; else calls fetchAllAccounts2; if exactly 1 account, caches it via saveAccountToCache and returns its id; if multiple, prompts via ctx.select("Select an account", ...), caching the chosen account; in non-interactive mode with multiple accounts, throws UserError listing available name/account_id pairs (redacted name if isCI()).pointer, build_command, deployment trigger commit message, deployment trigger type value "deploy", source-control configs, preview_deployment_setting ("all"/"none"/"custom"), uses_functions, production_branch, bindings (ai_bindings with project_id, KV namespace id/name, Analytics Engine index_name), framework, web_analytics_token, repo owner, repo_id.