wrangler 4.65.0 → 4.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/wrangler-dist/cli.js
CHANGED
|
@@ -5866,7 +5866,7 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
5866
5866
|
}
|
|
5867
5867
|
}
|
|
5868
5868
|
}
|
|
5869
|
-
var require_XDGAppPaths, require_XDG, require_OSPaths, require_node, require_mod_cjs, require_node2, require_mod_cjs2, require_node3, require_mod_cjs3; exports.unstable_defaultWranglerConfig = void 0; exports.experimental_patchConfig = void 0; var getJSONPath, PatchConfigError, MAX_WORKFLOW_NAME_LENGTH, ALLOWED_STRING_ID_PATTERN, ALLOWED_WORKFLOW_INSTANCE_ID_REGEX, ALLOWED_WORKFLOW_NAME_REGEX, mod_esm_exports, import_mod_cjs, mod_esm_default, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getWranglerSendErrorReportsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getSubdomainMixedStateCheckDisabled, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching, getWranglerHideBanner, getCloudflareEnv, getOpenNextDeployFromEnv, getLocalExplorerEnabledFromEnv, Diagnostics, appendEnvName, isString, isValidName, isValidDateTimeStringFormat, isStringArray, isOneOf, all, isMutuallyExclusiveWith, isBoolean, validateRequiredProperty, validateAtLeastOnePropertyRequired, validateOptionalProperty, validateTypedArray, validateOptionalTypedArray, isRequiredProperty, isOptionalProperty, hasProperty, validateAdditionalProperties, getBindingNames, isBindingList, isNamespaceList, isRecord, validateUniqueNameProperty, bucketFormatMessage, friendlyBindingNames, bindingTypeFriendlyNames, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateStreamingTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, workflowNameFormatMessage, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability, validatePythonModules, supportedPagesConfigFields;
|
|
5869
|
+
var require_XDGAppPaths, require_XDG, require_OSPaths, require_node, require_mod_cjs, require_node2, require_mod_cjs2, require_node3, require_mod_cjs3; exports.unstable_defaultWranglerConfig = void 0; exports.experimental_patchConfig = void 0; var getJSONPath, PatchConfigError, MAX_WORKFLOW_NAME_LENGTH, ALLOWED_STRING_ID_PATTERN, ALLOWED_WORKFLOW_INSTANCE_ID_REGEX, ALLOWED_WORKFLOW_NAME_REGEX, mod_esm_exports, import_mod_cjs, mod_esm_default, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getWranglerSendErrorReportsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getSubdomainMixedStateCheckDisabled, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching, getWranglerHideBanner, getCloudflareEnv, getOpenNextDeployFromEnv, getLocalExplorerEnabledFromEnv, getWranglerCacheDirFromEnv, Diagnostics, appendEnvName, isString, isValidName, isValidDateTimeStringFormat, isStringArray, isOneOf, all, isMutuallyExclusiveWith, isBoolean, validateRequiredProperty, validateAtLeastOnePropertyRequired, validateOptionalProperty, validateTypedArray, validateOptionalTypedArray, isRequiredProperty, isOptionalProperty, hasProperty, validateAdditionalProperties, getBindingNames, isBindingList, isNamespaceList, isRecord, validateUniqueNameProperty, bucketFormatMessage, friendlyBindingNames, bindingTypeFriendlyNames, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateStreamingTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, workflowNameFormatMessage, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability, validatePythonModules, supportedPagesConfigFields;
|
|
5870
5870
|
var init_dist = __esm({
|
|
5871
5871
|
"../workers-utils/dist/index.mjs"() {
|
|
5872
5872
|
init_import_meta_url();
|
|
@@ -6715,6 +6715,9 @@ var init_dist = __esm({
|
|
|
6715
6715
|
variableName: "X_LOCAL_EXPLORER",
|
|
6716
6716
|
defaultValue: false
|
|
6717
6717
|
});
|
|
6718
|
+
getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({
|
|
6719
|
+
variableName: "WRANGLER_CACHE_DIR"
|
|
6720
|
+
});
|
|
6718
6721
|
Diagnostics = class {
|
|
6719
6722
|
static {
|
|
6720
6723
|
__name(this, "Diagnostics");
|
|
@@ -50980,7 +50983,7 @@ var name, version;
|
|
|
50980
50983
|
var init_package = __esm({
|
|
50981
50984
|
"package.json"() {
|
|
50982
50985
|
name = "wrangler";
|
|
50983
|
-
version = "4.
|
|
50986
|
+
version = "4.66.0";
|
|
50984
50987
|
}
|
|
50985
50988
|
});
|
|
50986
50989
|
|
|
@@ -56888,17 +56891,25 @@ var init_is_interactive = __esm({
|
|
|
56888
56891
|
}
|
|
56889
56892
|
});
|
|
56890
56893
|
function getCacheFolder() {
|
|
56891
|
-
|
|
56892
|
-
|
|
56894
|
+
const envCacheDir = getWranglerCacheDirFromEnv();
|
|
56895
|
+
if (envCacheDir) {
|
|
56896
|
+
return envCacheDir;
|
|
56893
56897
|
}
|
|
56894
56898
|
const closestNodeModulesDirectory = findUpSync2("node_modules", {
|
|
56895
56899
|
type: "directory"
|
|
56896
56900
|
});
|
|
56897
|
-
|
|
56898
|
-
|
|
56899
|
-
|
|
56901
|
+
const nodeModulesCache = closestNodeModulesDirectory ? path32__namespace.join(closestNodeModulesDirectory, ".cache", "wrangler") : null;
|
|
56902
|
+
const wranglerCache = path32__namespace.join(process.cwd(), ".wrangler", "cache");
|
|
56903
|
+
if (nodeModulesCache && fs24.existsSync(nodeModulesCache)) {
|
|
56904
|
+
return nodeModulesCache;
|
|
56905
|
+
}
|
|
56906
|
+
if (fs24.existsSync(wranglerCache)) {
|
|
56907
|
+
return wranglerCache;
|
|
56908
|
+
}
|
|
56909
|
+
if (nodeModulesCache) {
|
|
56910
|
+
return nodeModulesCache;
|
|
56900
56911
|
}
|
|
56901
|
-
return
|
|
56912
|
+
return wranglerCache;
|
|
56902
56913
|
}
|
|
56903
56914
|
function showCacheMessage(fields, folder) {
|
|
56904
56915
|
if (!cacheMessageShown && !isNonInteractiveOrCI()) {
|
|
@@ -56915,16 +56926,10 @@ function showCacheMessage(fields, folder) {
|
|
|
56915
56926
|
function getConfigCache(fileName) {
|
|
56916
56927
|
try {
|
|
56917
56928
|
const cacheFolder = getCacheFolder();
|
|
56918
|
-
|
|
56919
|
-
|
|
56920
|
-
|
|
56921
|
-
|
|
56922
|
-
);
|
|
56923
|
-
showCacheMessage(Object.keys(configCache), cacheFolder);
|
|
56924
|
-
return configCache;
|
|
56925
|
-
} else {
|
|
56926
|
-
return {};
|
|
56927
|
-
}
|
|
56929
|
+
const configCacheLocation = path32__namespace.join(cacheFolder, fileName);
|
|
56930
|
+
const configCache = JSON.parse(fs24.readFileSync(configCacheLocation, "utf-8"));
|
|
56931
|
+
showCacheMessage(Object.keys(configCache), cacheFolder);
|
|
56932
|
+
return configCache;
|
|
56928
56933
|
} catch {
|
|
56929
56934
|
return {};
|
|
56930
56935
|
}
|
|
@@ -56947,12 +56952,12 @@ function purgeConfigCaches() {
|
|
|
56947
56952
|
if (cacheFolder) {
|
|
56948
56953
|
fs24.rmSync(cacheFolder, { recursive: true, force: true });
|
|
56949
56954
|
}
|
|
56950
|
-
__cacheFolder = void 0;
|
|
56951
56955
|
}
|
|
56952
|
-
var cacheMessageShown,
|
|
56956
|
+
var cacheMessageShown, arrayFormatter;
|
|
56953
56957
|
var init_config_cache = __esm({
|
|
56954
56958
|
"src/config-cache.ts"() {
|
|
56955
56959
|
init_import_meta_url();
|
|
56960
|
+
init_dist();
|
|
56956
56961
|
init_find_up();
|
|
56957
56962
|
init_is_interactive();
|
|
56958
56963
|
init_logger();
|
|
@@ -216459,7 +216464,7 @@ var init_astro2 = __esm({
|
|
|
216459
216464
|
return {
|
|
216460
216465
|
wranglerConfig: {
|
|
216461
216466
|
main: `${outputDir}/_worker.js/index.js`,
|
|
216462
|
-
compatibility_flags: ["
|
|
216467
|
+
compatibility_flags: ["global_fetch_strictly_public"],
|
|
216463
216468
|
assets: {
|
|
216464
216469
|
binding: "ASSETS",
|
|
216465
216470
|
directory: outputDir
|
|
@@ -216779,7 +216784,7 @@ var init_qwik2 = __esm({
|
|
|
216779
216784
|
return {
|
|
216780
216785
|
wranglerConfig: {
|
|
216781
216786
|
main: "./dist/_worker.js",
|
|
216782
|
-
compatibility_flags: ["
|
|
216787
|
+
compatibility_flags: ["global_fetch_strictly_public"],
|
|
216783
216788
|
assets: {
|
|
216784
216789
|
binding: "ASSET",
|
|
216785
216790
|
directory: "./dist"
|
|
@@ -216797,6 +216802,30 @@ var init_qwik2 = __esm({
|
|
|
216797
216802
|
__name(addAssetsIgnoreFile, "addAssetsIgnoreFile");
|
|
216798
216803
|
}
|
|
216799
216804
|
});
|
|
216805
|
+
function extractConfigObject(node2) {
|
|
216806
|
+
if (t3.ObjectExpression.check(node2)) {
|
|
216807
|
+
return node2;
|
|
216808
|
+
}
|
|
216809
|
+
if (t3.ArrowFunctionExpression.check(node2)) {
|
|
216810
|
+
if (t3.ObjectExpression.check(node2.body)) {
|
|
216811
|
+
return node2.body;
|
|
216812
|
+
}
|
|
216813
|
+
if (t3.BlockStatement.check(node2.body)) {
|
|
216814
|
+
return extractFromBlockStatement(node2.body);
|
|
216815
|
+
}
|
|
216816
|
+
}
|
|
216817
|
+
if (t3.FunctionExpression.check(node2)) {
|
|
216818
|
+
return extractFromBlockStatement(node2.body);
|
|
216819
|
+
}
|
|
216820
|
+
return null;
|
|
216821
|
+
}
|
|
216822
|
+
function extractFromBlockStatement(block) {
|
|
216823
|
+
const returnStmt = block.body.find((s7) => t3.ReturnStatement.check(s7));
|
|
216824
|
+
if (returnStmt && t3.ReturnStatement.check(returnStmt) && returnStmt.argument && t3.ObjectExpression.check(returnStmt.argument)) {
|
|
216825
|
+
return returnStmt.argument;
|
|
216826
|
+
}
|
|
216827
|
+
return null;
|
|
216828
|
+
}
|
|
216800
216829
|
function checkIfViteConfigUsesCloudflarePlugin(projectPath) {
|
|
216801
216830
|
const filePath = getViteConfigPath(projectPath);
|
|
216802
216831
|
let importsCloudflarePlugin = false;
|
|
@@ -216816,14 +216845,16 @@ function checkIfViteConfigUsesCloudflarePlugin(projectPath) {
|
|
|
216816
216845
|
if (callee.name !== "defineConfig") {
|
|
216817
216846
|
return this.traverse(n8);
|
|
216818
216847
|
}
|
|
216819
|
-
const
|
|
216820
|
-
if (!
|
|
216848
|
+
const configObject = extractConfigObject(n8.node.arguments[0]);
|
|
216849
|
+
if (!configObject) {
|
|
216821
216850
|
logger.debug(
|
|
216822
|
-
`Vite config uses
|
|
216851
|
+
`Vite config uses an unsupported expression type. Skipping Cloudflare plugin check.`
|
|
216823
216852
|
);
|
|
216824
216853
|
return this.traverse(n8);
|
|
216825
216854
|
}
|
|
216826
|
-
const pluginsProp =
|
|
216855
|
+
const pluginsProp = configObject.properties.find(
|
|
216856
|
+
(prop) => isPluginsProp(prop)
|
|
216857
|
+
);
|
|
216827
216858
|
if (!pluginsProp || !t3.ArrayExpression.check(pluginsProp.value)) {
|
|
216828
216859
|
logger.debug(
|
|
216829
216860
|
`Vite config does not have a valid plugins array. Skipping Cloudflare plugin check.`
|
|
@@ -216878,13 +216909,17 @@ function transformViteConfig(projectPath, options = {}) {
|
|
|
216878
216909
|
if (callee.name !== "defineConfig") {
|
|
216879
216910
|
return this.traverse(n8);
|
|
216880
216911
|
}
|
|
216881
|
-
const
|
|
216882
|
-
if (!
|
|
216912
|
+
const configObject = extractConfigObject(n8.node.arguments[0]);
|
|
216913
|
+
if (!configObject) {
|
|
216914
|
+
const argType = n8.node.arguments[0]?.type ?? "unknown";
|
|
216883
216915
|
throw new UserError(esm_default3`
|
|
216884
|
-
Cannot modify Vite config:
|
|
216916
|
+
Cannot modify Vite config: could not extract a config object (found ${argType}).
|
|
216885
216917
|
|
|
216886
|
-
The Cloudflare plugin can only be automatically added to Vite configs that use
|
|
216887
|
-
|
|
216918
|
+
The Cloudflare plugin can only be automatically added to Vite configs that use:
|
|
216919
|
+
- A simple object: defineConfig({ plugins: [...] })
|
|
216920
|
+
- An arrow function returning an object: defineConfig(() => ({ plugins: [...] }))
|
|
216921
|
+
|
|
216922
|
+
If your config uses a more complex pattern, please manually add the plugin:
|
|
216888
216923
|
|
|
216889
216924
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
216890
216925
|
|
|
@@ -216893,7 +216928,9 @@ function transformViteConfig(projectPath, options = {}) {
|
|
|
216893
216928
|
});
|
|
216894
216929
|
`);
|
|
216895
216930
|
}
|
|
216896
|
-
const pluginsProp =
|
|
216931
|
+
const pluginsProp = configObject.properties.find(
|
|
216932
|
+
(prop) => isPluginsProp(prop)
|
|
216933
|
+
);
|
|
216897
216934
|
if (!pluginsProp || !t3.ArrayExpression.check(pluginsProp.value)) {
|
|
216898
216935
|
throw new UserError(esm_default3`
|
|
216899
216936
|
Cannot modify Vite config: could not find a valid plugins array.
|
|
@@ -216954,6 +216991,8 @@ var init_vite_config = __esm({
|
|
|
216954
216991
|
init_codemod();
|
|
216955
216992
|
b3 = recast5.types.builders;
|
|
216956
216993
|
t3 = recast5.types.namedTypes;
|
|
216994
|
+
__name(extractConfigObject, "extractConfigObject");
|
|
216995
|
+
__name(extractFromBlockStatement, "extractFromBlockStatement");
|
|
216957
216996
|
__name(checkIfViteConfigUsesCloudflarePlugin, "checkIfViteConfigUsesCloudflarePlugin");
|
|
216958
216997
|
__name(getViteConfigPath, "getViteConfigPath");
|
|
216959
216998
|
knownIncompatiblePlugins = ["nitro", "nitroV2Plugin", "netlify"];
|
|
@@ -217255,7 +217294,6 @@ var init_solid_start2 = __esm({
|
|
|
217255
217294
|
return {
|
|
217256
217295
|
wranglerConfig: {
|
|
217257
217296
|
main: "./.output/server/index.mjs",
|
|
217258
|
-
compatibility_flags: ["nodejs_compat"],
|
|
217259
217297
|
assets: {
|
|
217260
217298
|
binding: "ASSETS",
|
|
217261
217299
|
directory: "./.output/public"
|
|
@@ -217333,7 +217371,6 @@ var init_sveltekit = __esm({
|
|
|
217333
217371
|
return {
|
|
217334
217372
|
wranglerConfig: {
|
|
217335
217373
|
main: ".svelte-kit/cloudflare/_worker.js",
|
|
217336
|
-
compatibility_flags: ["nodejs_als"],
|
|
217337
217374
|
assets: {
|
|
217338
217375
|
binding: "ASSETS",
|
|
217339
217376
|
directory: ".svelte-kit/cloudflare"
|
|
@@ -217374,7 +217411,6 @@ var init_tanstack = __esm({
|
|
|
217374
217411
|
}
|
|
217375
217412
|
return {
|
|
217376
217413
|
wranglerConfig: {
|
|
217377
|
-
compatibility_flags: ["nodejs_compat"],
|
|
217378
217414
|
main: "@tanstack/react-start/server-entry"
|
|
217379
217415
|
}
|
|
217380
217416
|
};
|
|
@@ -217747,7 +217783,6 @@ var init_waku2 = __esm({
|
|
|
217747
217783
|
return {
|
|
217748
217784
|
wranglerConfig: {
|
|
217749
217785
|
main: "./dist/server/serve-cloudflare.js",
|
|
217750
|
-
compatibility_flags: ["nodejs_compat"],
|
|
217751
217786
|
assets: {
|
|
217752
217787
|
binding: "ASSETS",
|
|
217753
217788
|
directory: "./dist/public",
|
|
@@ -217773,7 +217808,7 @@ function getFramework2(frameworkId) {
|
|
|
217773
217808
|
const framework = targetedFramework ?? staticFramework;
|
|
217774
217809
|
return new framework.class({ id: framework.id, name: framework.name });
|
|
217775
217810
|
}
|
|
217776
|
-
var staticFramework, allKnownFrameworks;
|
|
217811
|
+
var staticFramework, allKnownFrameworks, allKnownFrameworksIds;
|
|
217777
217812
|
var init_get_framework2 = __esm({
|
|
217778
217813
|
"src/autoconfig/frameworks/get-framework.ts"() {
|
|
217779
217814
|
init_import_meta_url();
|
|
@@ -217816,6 +217851,9 @@ var init_get_framework2 = __esm({
|
|
|
217816
217851
|
{ id: "waku", name: "Waku", class: Waku2 },
|
|
217817
217852
|
{ id: "cloudflare-pages", name: "Cloudflare Pages", class: CloudflarePages }
|
|
217818
217853
|
];
|
|
217854
|
+
allKnownFrameworksIds = new Set(
|
|
217855
|
+
allKnownFrameworks.map(({ id }) => id)
|
|
217856
|
+
);
|
|
217819
217857
|
__name(getFramework2, "getFramework");
|
|
217820
217858
|
}
|
|
217821
217859
|
});
|
|
@@ -217896,6 +217934,9 @@ function assertNonConfigured(details) {
|
|
|
217896
217934
|
"Error: expected the current project not to be already configured"
|
|
217897
217935
|
);
|
|
217898
217936
|
}
|
|
217937
|
+
function throwMultipleFrameworksNonInteractiveError(settings) {
|
|
217938
|
+
throw new MultipleFrameworksCIError(settings.map((b11) => b11.name));
|
|
217939
|
+
}
|
|
217899
217940
|
async function hasIndexHtml(dir) {
|
|
217900
217941
|
const children = await fs14.readdir(dir);
|
|
217901
217942
|
for (const child of children) {
|
|
@@ -217961,11 +218002,13 @@ async function detectFramework(projectPath, wranglerConfig) {
|
|
|
217961
218002
|
captureException(err);
|
|
217962
218003
|
});
|
|
217963
218004
|
const buildSettings = await project.getBuildSettings();
|
|
217964
|
-
if (
|
|
217965
|
-
throw new
|
|
218005
|
+
if (project.workspace?.isRoot) {
|
|
218006
|
+
throw new UserError(
|
|
218007
|
+
"The Wrangler application detection logic has been run in the root of a workspace, this is not supported. Change your working directory to one of the applications in the workspace and try again."
|
|
218008
|
+
);
|
|
217966
218009
|
}
|
|
218010
|
+
const detectedFramework = findDetectedFramework(buildSettings);
|
|
217967
218011
|
const packageManager = convertDetectedPackageManager(project.packageManager);
|
|
217968
|
-
const detectedFramework = buildSettings[0];
|
|
217969
218012
|
if (await isPagesProject(projectPath, wranglerConfig, detectedFramework)) {
|
|
217970
218013
|
return {
|
|
217971
218014
|
detectedFramework: {
|
|
@@ -217979,6 +218022,46 @@ async function detectFramework(projectPath, wranglerConfig) {
|
|
|
217979
218022
|
}
|
|
217980
218023
|
return { detectedFramework, packageManager };
|
|
217981
218024
|
}
|
|
218025
|
+
function findDetectedFramework(settings) {
|
|
218026
|
+
if (settings.length === 0) {
|
|
218027
|
+
return void 0;
|
|
218028
|
+
}
|
|
218029
|
+
if (settings.length === 1) {
|
|
218030
|
+
return settings[0];
|
|
218031
|
+
}
|
|
218032
|
+
const settingsForOnlyKnownFrameworks = settings.filter(
|
|
218033
|
+
({ framework }) => allKnownFrameworksIds.has(framework.id)
|
|
218034
|
+
);
|
|
218035
|
+
if (settingsForOnlyKnownFrameworks.length === 0) {
|
|
218036
|
+
if (isNonInteractiveOrCI()) {
|
|
218037
|
+
throwMultipleFrameworksNonInteractiveError(settings);
|
|
218038
|
+
}
|
|
218039
|
+
return settings[0];
|
|
218040
|
+
}
|
|
218041
|
+
if (settingsForOnlyKnownFrameworks.length === 1) {
|
|
218042
|
+
return settingsForOnlyKnownFrameworks[0];
|
|
218043
|
+
}
|
|
218044
|
+
if (settingsForOnlyKnownFrameworks.length === 2) {
|
|
218045
|
+
const frameworkIdsFound = new Set(
|
|
218046
|
+
settings.map(({ framework }) => framework.id)
|
|
218047
|
+
);
|
|
218048
|
+
const viteId = "vite";
|
|
218049
|
+
if (frameworkIdsFound.has(viteId)) {
|
|
218050
|
+
const knownNonViteSettings = settingsForOnlyKnownFrameworks.find(
|
|
218051
|
+
({ framework }) => framework.id !== viteId
|
|
218052
|
+
);
|
|
218053
|
+
if (knownNonViteSettings) {
|
|
218054
|
+
return knownNonViteSettings;
|
|
218055
|
+
}
|
|
218056
|
+
}
|
|
218057
|
+
}
|
|
218058
|
+
if (isNonInteractiveOrCI()) {
|
|
218059
|
+
throw new MultipleFrameworksCIError(
|
|
218060
|
+
settingsForOnlyKnownFrameworks.map((b11) => b11.name)
|
|
218061
|
+
);
|
|
218062
|
+
}
|
|
218063
|
+
return settingsForOnlyKnownFrameworks[0];
|
|
218064
|
+
}
|
|
217982
218065
|
function getWorkerNameFromProject(projectPath) {
|
|
217983
218066
|
const packageJsonPath = path32.resolve(projectPath, "package.json");
|
|
217984
218067
|
let packageJsonName;
|
|
@@ -218230,7 +218313,7 @@ async function confirmAutoConfigDetails(autoConfigDetails) {
|
|
|
218230
218313
|
}
|
|
218231
218314
|
return updatedAutoConfigDetails;
|
|
218232
218315
|
}
|
|
218233
|
-
var
|
|
218316
|
+
var MultipleFrameworksCIError, invalidWorkerNameCharsRegex, invalidWorkerNameStartEndRegex, workerNameLengthLimit;
|
|
218234
218317
|
var init_details2 = __esm({
|
|
218235
218318
|
"src/autoconfig/details.ts"() {
|
|
218236
218319
|
init_import_meta_url();
|
|
@@ -218239,9 +218322,11 @@ var init_details2 = __esm({
|
|
|
218239
218322
|
init_lib5();
|
|
218240
218323
|
init_node5();
|
|
218241
218324
|
init_esm10();
|
|
218325
|
+
init_esm2();
|
|
218242
218326
|
init_config_cache();
|
|
218243
218327
|
init_handle_errors();
|
|
218244
218328
|
init_dialogs();
|
|
218329
|
+
init_is_interactive();
|
|
218245
218330
|
init_logger();
|
|
218246
218331
|
init_metrics2();
|
|
218247
218332
|
init_package_manager();
|
|
@@ -218250,23 +218335,33 @@ var init_details2 = __esm({
|
|
|
218250
218335
|
init_telemetry_utils();
|
|
218251
218336
|
__name(convertDetectedPackageManager, "convertDetectedPackageManager");
|
|
218252
218337
|
__name(assertNonConfigured, "assertNonConfigured");
|
|
218253
|
-
|
|
218338
|
+
MultipleFrameworksCIError = class extends FatalError {
|
|
218254
218339
|
static {
|
|
218255
|
-
__name(this, "
|
|
218340
|
+
__name(this, "MultipleFrameworksCIError");
|
|
218256
218341
|
}
|
|
218257
218342
|
constructor(frameworks2) {
|
|
218258
218343
|
super(
|
|
218259
|
-
`Wrangler was unable to automatically configure your project to work with Cloudflare, since multiple frameworks were found: ${frameworks2.join(", ")}
|
|
218344
|
+
esm_default3`Wrangler was unable to automatically configure your project to work with Cloudflare, since multiple frameworks were found: ${frameworks2.join(", ")}.
|
|
218345
|
+
|
|
218346
|
+
To fix this issue either:
|
|
218347
|
+
- check your project's configuration to make sure that the target framework
|
|
218348
|
+
is the only configured one and try again
|
|
218349
|
+
- run \`wrangler setup\` locally to get an interactive user experience where
|
|
218350
|
+
you can specify what framework you want to target
|
|
218351
|
+
|
|
218352
|
+
`,
|
|
218260
218353
|
1,
|
|
218261
218354
|
{ telemetryMessage: true }
|
|
218262
218355
|
);
|
|
218263
218356
|
}
|
|
218264
218357
|
};
|
|
218358
|
+
__name(throwMultipleFrameworksNonInteractiveError, "throwMultipleFrameworksNonInteractiveError");
|
|
218265
218359
|
__name(hasIndexHtml, "hasIndexHtml");
|
|
218266
218360
|
__name(findAssetsDir, "findAssetsDir");
|
|
218267
218361
|
__name(getWorkerName, "getWorkerName");
|
|
218268
218362
|
__name(isPagesProject, "isPagesProject");
|
|
218269
218363
|
__name(detectFramework, "detectFramework");
|
|
218364
|
+
__name(findDetectedFramework, "findDetectedFramework");
|
|
218270
218365
|
__name(getWorkerNameFromProject, "getWorkerNameFromProject");
|
|
218271
218366
|
__name(getDetailsForAutoConfig, "getDetailsForAutoConfig");
|
|
218272
218367
|
__name(getProjectBuildCommand, "getProjectBuildCommand");
|
|
@@ -218330,8 +218425,7 @@ var init_add_wrangler_assetsignore = __esm({
|
|
|
218330
218425
|
const s7 = spinner();
|
|
218331
218426
|
s7.start("Adding Wrangler files to the .assetsignore file");
|
|
218332
218427
|
const linesToAppend = [
|
|
218333
|
-
"",
|
|
218334
|
-
...!existingAssetsIgnoreContent.match(/\n\s*$/) ? [""] : []
|
|
218428
|
+
...assetsIgnorePreExisted ? ["", ...!existingAssetsIgnoreContent.match(/\n\s*$/) ? [""] : []] : []
|
|
218335
218429
|
];
|
|
218336
218430
|
if (!hasDotWrangler && wranglerAssetsIgnoreFilesToAdd.length > 1) {
|
|
218337
218431
|
linesToAppend.push("# wrangler files");
|
|
@@ -218413,8 +218507,7 @@ var init_add_wrangler_gitignore = __esm({
|
|
|
218413
218507
|
const s7 = spinner();
|
|
218414
218508
|
s7.start("Adding Wrangler files to the .gitignore file");
|
|
218415
218509
|
const linesToAppend = [
|
|
218416
|
-
"",
|
|
218417
|
-
...!existingGitIgnoreContent.match(/\n\s*$/) ? [""] : []
|
|
218510
|
+
...gitIgnorePreExisted ? ["", ...!existingGitIgnoreContent.match(/\n\s*$/) ? [""] : []] : []
|
|
218418
218511
|
];
|
|
218419
218512
|
if (!hasDotWrangler && wranglerGitIgnoreFilesToAdd.length > 1) {
|
|
218420
218513
|
linesToAppend.push("# wrangler files");
|
|
@@ -218488,10 +218581,10 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions = {}) {
|
|
|
218488
218581
|
const { npx } = packageManager;
|
|
218489
218582
|
autoConfigSummary = await buildOperationsSummary(
|
|
218490
218583
|
{ ...autoConfigDetails, outputDir: autoConfigDetails.outputDir },
|
|
218491
|
-
{
|
|
218584
|
+
ensureNodejsCompatIsInConfig({
|
|
218492
218585
|
...wranglerConfig,
|
|
218493
218586
|
...dryRunConfigurationResults.wranglerConfig
|
|
218494
|
-
},
|
|
218587
|
+
}),
|
|
218495
218588
|
{
|
|
218496
218589
|
build: dryRunConfigurationResults.buildCommandOverride ?? autoConfigDetails.buildCommand,
|
|
218497
218590
|
deploy: dryRunConfigurationResults.deployCommandOverride ?? `${npx} wrangler deploy`,
|
|
@@ -218553,13 +218646,15 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
|
|
|
218553
218646
|
},
|
|
218554
218647
|
null,
|
|
218555
218648
|
2
|
|
218556
|
-
)
|
|
218649
|
+
) + "\n"
|
|
218557
218650
|
);
|
|
218558
218651
|
}
|
|
218559
218652
|
await saveWranglerJsonc(
|
|
218560
218653
|
autoConfigDetails.projectPath,
|
|
218561
|
-
|
|
218562
|
-
|
|
218654
|
+
ensureNodejsCompatIsInConfig({
|
|
218655
|
+
...wranglerConfig,
|
|
218656
|
+
...configurationResults.wranglerConfig
|
|
218657
|
+
})
|
|
218563
218658
|
);
|
|
218564
218659
|
addWranglerToGitIgnore(autoConfigDetails.projectPath);
|
|
218565
218660
|
if (autoConfigDetails.outputDir === autoConfigDetails.projectPath) {
|
|
@@ -218595,11 +218690,21 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
|
|
|
218595
218690
|
);
|
|
218596
218691
|
return autoConfigSummary;
|
|
218597
218692
|
}
|
|
218598
|
-
|
|
218599
|
-
|
|
218600
|
-
|
|
218601
|
-
|
|
218693
|
+
function ensureNodejsCompatIsInConfig(wranglerConfig) {
|
|
218694
|
+
if (wranglerConfig.compatibility_flags?.includes("nodejs_compat")) {
|
|
218695
|
+
return wranglerConfig;
|
|
218696
|
+
}
|
|
218697
|
+
return {
|
|
218698
|
+
...wranglerConfig,
|
|
218699
|
+
compatibility_flags: [
|
|
218700
|
+
...wranglerConfig.compatibility_flags?.filter(
|
|
218701
|
+
(flag) => !flag.startsWith("nodejs_")
|
|
218702
|
+
) ?? [],
|
|
218703
|
+
"nodejs_compat"
|
|
218704
|
+
]
|
|
218602
218705
|
};
|
|
218706
|
+
}
|
|
218707
|
+
async function saveWranglerJsonc(projectPath, wranglerConfig) {
|
|
218603
218708
|
let existingWranglerConfig = {};
|
|
218604
218709
|
const wranglerConfigPath = getDirWranglerJsonConfigPath(projectPath);
|
|
218605
218710
|
if (wranglerConfigPath) {
|
|
@@ -218614,11 +218719,11 @@ async function saveWranglerJsonc(projectPath, baseWranglerConfig, configurationW
|
|
|
218614
218719
|
JSON.stringify(
|
|
218615
218720
|
{
|
|
218616
218721
|
...existingWranglerConfig,
|
|
218617
|
-
...
|
|
218722
|
+
...wranglerConfig
|
|
218618
218723
|
},
|
|
218619
218724
|
null,
|
|
218620
218725
|
2
|
|
218621
|
-
)
|
|
218726
|
+
) + "\n"
|
|
218622
218727
|
);
|
|
218623
218728
|
}
|
|
218624
218729
|
async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite, projectCommands, packageJsonScriptsOverrides) {
|
|
@@ -218707,6 +218812,7 @@ var init_run = __esm({
|
|
|
218707
218812
|
init_telemetry_utils();
|
|
218708
218813
|
init_uses_typescript();
|
|
218709
218814
|
__name(runAutoConfig, "runAutoConfig");
|
|
218815
|
+
__name(ensureNodejsCompatIsInConfig, "ensureNodejsCompatIsInConfig");
|
|
218710
218816
|
__name(saveWranglerJsonc, "saveWranglerJsonc");
|
|
218711
218817
|
__name(buildOperationsSummary, "buildOperationsSummary");
|
|
218712
218818
|
__name(getDirWranglerJsonConfigPath, "getDirWranglerJsonConfigPath");
|
|
@@ -219761,6 +219867,16 @@ var init_deploy2 = __esm({
|
|
|
219761
219867
|
describe: "Rollout strategy for Containers changes. If set to immediate, it will override `rollout_percentage_steps` if configured and roll out to 100% of instances in one step. ",
|
|
219762
219868
|
choices: ["immediate", "gradual"]
|
|
219763
219869
|
},
|
|
219870
|
+
tag: {
|
|
219871
|
+
describe: "A tag for this Worker Version",
|
|
219872
|
+
type: "string",
|
|
219873
|
+
requiresArg: true
|
|
219874
|
+
},
|
|
219875
|
+
message: {
|
|
219876
|
+
describe: "A descriptive message for this Worker Version and Deployment",
|
|
219877
|
+
type: "string",
|
|
219878
|
+
requiresArg: true
|
|
219879
|
+
},
|
|
219764
219880
|
strict: {
|
|
219765
219881
|
describe: "Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risks.",
|
|
219766
219882
|
type: "boolean",
|
|
@@ -219967,7 +220083,9 @@ var init_deploy2 = __esm({
|
|
|
219967
220083
|
dispatchNamespace: args.dispatchNamespace,
|
|
219968
220084
|
experimentalAutoCreate: args.experimentalAutoCreate,
|
|
219969
220085
|
containersRollout: args.containersRollout,
|
|
219970
|
-
strict: args.strict
|
|
220086
|
+
strict: args.strict,
|
|
220087
|
+
tag: args.tag,
|
|
220088
|
+
message: args.message
|
|
219971
220089
|
});
|
|
219972
220090
|
writeOutput({
|
|
219973
220091
|
type: "deploy",
|
|
@@ -225274,7 +225392,8 @@ var init_validate3 = __esm({
|
|
|
225274
225392
|
"functions",
|
|
225275
225393
|
"**/.DS_Store",
|
|
225276
225394
|
"**/node_modules",
|
|
225277
|
-
"**/.git"
|
|
225395
|
+
"**/.git",
|
|
225396
|
+
".wrangler"
|
|
225278
225397
|
].map((pattern) => new import_minimatch2.Minimatch(pattern));
|
|
225279
225398
|
const directory = path32.resolve(args.directory);
|
|
225280
225399
|
const fileCountLimit = args.fileCountLimit ?? MAX_ASSET_COUNT_DEFAULT;
|
|
@@ -289816,6 +289935,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
289816
289935
|
tail_consumers: config.tail_consumers,
|
|
289817
289936
|
streaming_tail_consumers: config.streaming_tail_consumers,
|
|
289818
289937
|
limits: config.limits,
|
|
289938
|
+
annotations: props.tag || props.message ? {
|
|
289939
|
+
"workers/message": props.message,
|
|
289940
|
+
"workers/tag": props.tag
|
|
289941
|
+
} : void 0,
|
|
289819
289942
|
assets: props.assetsOptions && assetsJwt ? {
|
|
289820
289943
|
jwt: assetsJwt,
|
|
289821
289944
|
routerConfig: props.assetsOptions.routerConfig,
|
|
@@ -289924,7 +290047,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
289924
290047
|
accountId,
|
|
289925
290048
|
scriptName,
|
|
289926
290049
|
versionMap,
|
|
289927
|
-
|
|
290050
|
+
props.message
|
|
289928
290051
|
);
|
|
289929
290052
|
const nextTags = applyServiceAndEnvironmentTags(config, tags);
|
|
289930
290053
|
try {
|
|
@@ -291887,31 +292010,48 @@ var init_get_port = __esm({
|
|
|
291887
292010
|
});
|
|
291888
292011
|
|
|
291889
292012
|
// src/utils/memoizeGetPort.ts
|
|
291890
|
-
function
|
|
292013
|
+
function isNetworkBindPermissionError(e9) {
|
|
292014
|
+
return e9 !== null && typeof e9 === "object" && "code" in e9 && (e9.code === "EPERM" || e9.code === "EACCES") && "syscall" in e9 && (e9.syscall === "listen" || e9.syscall === "bind");
|
|
292015
|
+
}
|
|
292016
|
+
function memoizeGetPort(defaultPort, defaultHost) {
|
|
291891
292017
|
let portValue;
|
|
291892
|
-
let cachedHost =
|
|
291893
|
-
return async (forHost =
|
|
292018
|
+
let cachedHost = defaultHost;
|
|
292019
|
+
return async (forHost = defaultHost) => {
|
|
291894
292020
|
if (forHost !== cachedHost) {
|
|
291895
292021
|
portValue = void 0;
|
|
291896
292022
|
cachedHost = forHost;
|
|
291897
292023
|
}
|
|
291898
|
-
|
|
291899
|
-
|
|
291900
|
-
|
|
291901
|
-
|
|
291902
|
-
|
|
291903
|
-
|
|
291904
|
-
|
|
291905
|
-
|
|
292024
|
+
try {
|
|
292025
|
+
portValue = portValue ?? await getPorts({
|
|
292026
|
+
port: portNumbers(
|
|
292027
|
+
defaultPort,
|
|
292028
|
+
defaultPort + NUM_CONSECUTIVE_PORTS_TO_PROBE
|
|
292029
|
+
),
|
|
292030
|
+
host: forHost
|
|
292031
|
+
});
|
|
292032
|
+
return portValue;
|
|
292033
|
+
} catch (e9) {
|
|
292034
|
+
if (isNetworkBindPermissionError(e9)) {
|
|
292035
|
+
throw new UserError(
|
|
292036
|
+
`Failed to bind to ${forHost}:${defaultPort}: permission denied.
|
|
292037
|
+
This usually means a sandbox or security policy is preventing network access.
|
|
292038
|
+
If you are running inside a restricted environment (container, VM, AI coding agent, etc.),
|
|
292039
|
+
configure it to allow binding to loopback addresses.`
|
|
292040
|
+
);
|
|
292041
|
+
}
|
|
292042
|
+
throw e9;
|
|
292043
|
+
}
|
|
291906
292044
|
};
|
|
291907
292045
|
}
|
|
291908
292046
|
var import_ci_info4, NUM_CONSECUTIVE_PORTS_TO_PROBE;
|
|
291909
292047
|
var init_memoizeGetPort = __esm({
|
|
291910
292048
|
"src/utils/memoizeGetPort.ts"() {
|
|
291911
292049
|
init_import_meta_url();
|
|
292050
|
+
init_dist();
|
|
291912
292051
|
import_ci_info4 = __toESM(require_ci_info());
|
|
291913
292052
|
init_get_port();
|
|
291914
292053
|
NUM_CONSECUTIVE_PORTS_TO_PROBE = import_ci_info4.default.isCI ? 0 : 10;
|
|
292054
|
+
__name(isNetworkBindPermissionError, "isNetworkBindPermissionError");
|
|
291915
292055
|
__name(memoizeGetPort, "memoizeGetPort");
|
|
291916
292056
|
}
|
|
291917
292057
|
});
|
|
@@ -292796,6 +292936,7 @@ var init_ProxyController = __esm({
|
|
|
292796
292936
|
httpsCert: cert?.cert,
|
|
292797
292937
|
httpsKey: cert?.key,
|
|
292798
292938
|
stripDisablePrettyError: false,
|
|
292939
|
+
unsafeLocalExplorer: false,
|
|
292799
292940
|
workers: [
|
|
292800
292941
|
{
|
|
292801
292942
|
name: "ProxyWorker",
|