wrangler 4.24.1 → 4.24.3
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/package.json +3 -3
- package/wrangler-dist/cli.js +326 -202
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.js
CHANGED
@@ -22064,29 +22064,46 @@ async function constructBuildCommand(options, configPath, logger4) {
|
|
22064
22064
|
}
|
22065
22065
|
function dockerBuild(dockerPath, options) {
|
22066
22066
|
let errorHandled = false;
|
22067
|
-
|
22068
|
-
|
22069
|
-
|
22070
|
-
|
22071
|
-
|
22072
|
-
|
22073
|
-
|
22067
|
+
let resolve24;
|
22068
|
+
let reject;
|
22069
|
+
const ready = new Promise((res, rej) => {
|
22070
|
+
resolve24 = res;
|
22071
|
+
reject = rej;
|
22072
|
+
});
|
22073
|
+
const child = (0, import_child_process.spawn)(dockerPath, options.buildCmd, {
|
22074
|
+
stdio: ["pipe", "inherit", "inherit"],
|
22075
|
+
// We need to set detached to true so that the child process
|
22076
|
+
// will control all of its child processed and we can kill
|
22077
|
+
// all of them in case we need to abort the build process
|
22078
|
+
detached: true
|
22079
|
+
});
|
22080
|
+
if (child.stdin !== null) {
|
22081
|
+
child.stdin.write(options.dockerfile);
|
22082
|
+
child.stdin.end();
|
22083
|
+
}
|
22084
|
+
child.on("exit", (code) => {
|
22085
|
+
if (code === 0) {
|
22086
|
+
resolve24();
|
22087
|
+
} else if (!errorHandled) {
|
22088
|
+
errorHandled = true;
|
22089
|
+
reject(new Error(`Build exited with code: ${code}`));
|
22074
22090
|
}
|
22075
|
-
child.on("exit", (code) => {
|
22076
|
-
if (code === 0) {
|
22077
|
-
resolve24();
|
22078
|
-
} else if (!errorHandled) {
|
22079
|
-
errorHandled = true;
|
22080
|
-
reject(new Error(`Build exited with code: ${code}`));
|
22081
|
-
}
|
22082
|
-
});
|
22083
|
-
child.on("error", (err) => {
|
22084
|
-
if (!errorHandled) {
|
22085
|
-
errorHandled = true;
|
22086
|
-
reject(err);
|
22087
|
-
}
|
22088
|
-
});
|
22089
22091
|
});
|
22092
|
+
child.on("error", (err) => {
|
22093
|
+
if (!errorHandled) {
|
22094
|
+
errorHandled = true;
|
22095
|
+
reject(err);
|
22096
|
+
}
|
22097
|
+
});
|
22098
|
+
return {
|
22099
|
+
abort: /* @__PURE__ */ __name(() => {
|
22100
|
+
child.unref();
|
22101
|
+
if (child.pid !== void 0) {
|
22102
|
+
process.kill(-child.pid);
|
22103
|
+
}
|
22104
|
+
}, "abort"),
|
22105
|
+
ready
|
22106
|
+
};
|
22090
22107
|
}
|
22091
22108
|
async function buildImage(dockerPath, options, configPath) {
|
22092
22109
|
const { buildCmd, dockerfile } = await constructBuildCommand(
|
@@ -22099,7 +22116,7 @@ async function buildImage(dockerPath, options, configPath) {
|
|
22099
22116
|
},
|
22100
22117
|
configPath
|
22101
22118
|
);
|
22102
|
-
|
22119
|
+
return dockerBuild(dockerPath, { buildCmd, dockerfile });
|
22103
22120
|
}
|
22104
22121
|
var import_child_process, import_fs5, import_path5;
|
22105
22122
|
var init_build = __esm({
|
@@ -22256,27 +22273,47 @@ var init_utils = __esm({
|
|
22256
22273
|
import_fs6 = require("fs");
|
22257
22274
|
import_path6 = __toESM(require("path"));
|
22258
22275
|
init_inspect();
|
22259
|
-
runDockerCmd = /* @__PURE__ */ __name(
|
22276
|
+
runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
|
22277
|
+
let aborted = false;
|
22278
|
+
let resolve24;
|
22279
|
+
let reject;
|
22280
|
+
const ready = new Promise((res, rej) => {
|
22281
|
+
resolve24 = res;
|
22282
|
+
reject = rej;
|
22283
|
+
});
|
22260
22284
|
const child = (0, import_child_process3.spawn)(dockerPath, args, {
|
22261
|
-
stdio: stdio ?? "inherit"
|
22285
|
+
stdio: stdio ?? "inherit",
|
22286
|
+
// We need to set detached to true so that the child process
|
22287
|
+
// will control all of its child processed and we can kill
|
22288
|
+
// all of them in case we need to abort the build process
|
22289
|
+
detached: true
|
22262
22290
|
});
|
22263
22291
|
let errorHandled = false;
|
22264
|
-
|
22265
|
-
|
22266
|
-
|
22267
|
-
|
22268
|
-
|
22269
|
-
|
22270
|
-
|
22271
|
-
|
22272
|
-
|
22273
|
-
|
22274
|
-
|
22275
|
-
|
22276
|
-
|
22277
|
-
}
|
22278
|
-
});
|
22292
|
+
child.on("close", (code) => {
|
22293
|
+
if (code === 0 || aborted) {
|
22294
|
+
resolve24({ aborted });
|
22295
|
+
} else if (!errorHandled) {
|
22296
|
+
errorHandled = true;
|
22297
|
+
reject(new Error(`Docker command exited with code: ${code}`));
|
22298
|
+
}
|
22299
|
+
});
|
22300
|
+
child.on("error", (err) => {
|
22301
|
+
if (!errorHandled) {
|
22302
|
+
errorHandled = true;
|
22303
|
+
reject(new Error(`Docker command failed: ${err.message}`));
|
22304
|
+
}
|
22279
22305
|
});
|
22306
|
+
return {
|
22307
|
+
abort: /* @__PURE__ */ __name(() => {
|
22308
|
+
aborted = true;
|
22309
|
+
child.unref();
|
22310
|
+
if (child.pid !== void 0) {
|
22311
|
+
process.kill(-child.pid);
|
22312
|
+
}
|
22313
|
+
}, "abort"),
|
22314
|
+
ready,
|
22315
|
+
then: /* @__PURE__ */ __name(async (resolve25, reject2) => ready.then(resolve25).catch(reject2), "then")
|
22316
|
+
};
|
22280
22317
|
}, "runDockerCmd");
|
22281
22318
|
runDockerCmdWithOutput = /* @__PURE__ */ __name(async (dockerPath, args) => {
|
22282
22319
|
return new Promise((resolve24, reject) => {
|
@@ -22383,16 +22420,27 @@ var init_types = __esm({
|
|
22383
22420
|
// ../containers-shared/src/images.ts
|
22384
22421
|
async function pullImage(dockerPath, options) {
|
22385
22422
|
await dockerLoginManagedRegistry(dockerPath);
|
22386
|
-
|
22423
|
+
const pull = runDockerCmd(dockerPath, [
|
22387
22424
|
"pull",
|
22388
22425
|
options.image,
|
22389
22426
|
// All containers running on our platform need to be built for amd64 architecture, but by default docker pull seems to look for an image matching the host system, so we need to specify this here
|
22390
22427
|
"--platform",
|
22391
22428
|
"linux/amd64"
|
22392
22429
|
]);
|
22393
|
-
|
22430
|
+
const ready = pull.ready.then(async ({ aborted }) => {
|
22431
|
+
if (!aborted) {
|
22432
|
+
await runDockerCmd(dockerPath, ["tag", options.image, options.imageTag]);
|
22433
|
+
}
|
22434
|
+
});
|
22435
|
+
return {
|
22436
|
+
abort: /* @__PURE__ */ __name(() => {
|
22437
|
+
pull.abort();
|
22438
|
+
}, "abort"),
|
22439
|
+
ready
|
22440
|
+
};
|
22394
22441
|
}
|
22395
|
-
async function prepareContainerImagesForDev(dockerPath, containerOptions, configPath) {
|
22442
|
+
async function prepareContainerImagesForDev(dockerPath, containerOptions, configPath, onContainerImagePreparationStart, onContainerImagePreparationEnd) {
|
22443
|
+
let aborted = false;
|
22396
22444
|
if (process.platform === "win32") {
|
22397
22445
|
throw new Error(
|
22398
22446
|
"Local development with containers is currently not supported on Windows. You should use WSL instead. You can also set `enable_containers` to false if you do not need to develop the container part of your application."
|
@@ -22401,7 +22449,18 @@ async function prepareContainerImagesForDev(dockerPath, containerOptions, config
|
|
22401
22449
|
await verifyDockerInstalled(dockerPath);
|
22402
22450
|
for (const options of containerOptions) {
|
22403
22451
|
if (isDockerfile(options.image, configPath)) {
|
22404
|
-
await buildImage(dockerPath, options, configPath);
|
22452
|
+
const build5 = await buildImage(dockerPath, options, configPath);
|
22453
|
+
onContainerImagePreparationStart({
|
22454
|
+
containerOptions: options,
|
22455
|
+
abort: /* @__PURE__ */ __name(() => {
|
22456
|
+
aborted = true;
|
22457
|
+
build5.abort();
|
22458
|
+
}, "abort")
|
22459
|
+
});
|
22460
|
+
await build5.ready;
|
22461
|
+
onContainerImagePreparationEnd({
|
22462
|
+
containerOptions: options
|
22463
|
+
});
|
22405
22464
|
} else {
|
22406
22465
|
if (!isCloudflareRegistryLink(options.image)) {
|
22407
22466
|
throw new Error(
|
@@ -22409,12 +22468,25 @@ async function prepareContainerImagesForDev(dockerPath, containerOptions, config
|
|
22409
22468
|
To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
|
22410
22469
|
);
|
22411
22470
|
}
|
22412
|
-
await pullImage(dockerPath, options);
|
22471
|
+
const pull = await pullImage(dockerPath, options);
|
22472
|
+
onContainerImagePreparationStart({
|
22473
|
+
containerOptions: options,
|
22474
|
+
abort: /* @__PURE__ */ __name(() => {
|
22475
|
+
aborted = true;
|
22476
|
+
pull.abort();
|
22477
|
+
}, "abort")
|
22478
|
+
});
|
22479
|
+
await pull.ready;
|
22480
|
+
onContainerImagePreparationEnd({
|
22481
|
+
containerOptions: options
|
22482
|
+
});
|
22483
|
+
}
|
22484
|
+
if (!aborted) {
|
22485
|
+
await checkExposedPorts(dockerPath, options);
|
22413
22486
|
}
|
22414
|
-
await checkExposedPorts(dockerPath, options);
|
22415
22487
|
}
|
22416
22488
|
}
|
22417
|
-
|
22489
|
+
function resolveImageName(accountId, image) {
|
22418
22490
|
let url4;
|
22419
22491
|
try {
|
22420
22492
|
url4 = new URL(`http://${image}`);
|
@@ -29515,7 +29587,7 @@ var name, version;
|
|
29515
29587
|
var init_package = __esm({
|
29516
29588
|
"package.json"() {
|
29517
29589
|
name = "wrangler";
|
29518
|
-
version = "4.24.
|
29590
|
+
version = "4.24.3";
|
29519
29591
|
}
|
29520
29592
|
});
|
29521
29593
|
|
@@ -60406,38 +60478,7 @@ var init_navigator_user_agent = __esm({
|
|
60406
60478
|
}
|
60407
60479
|
});
|
60408
60480
|
|
60409
|
-
// src/
|
60410
|
-
function isUrl(maybeUrl) {
|
60411
|
-
if (!maybeUrl) {
|
60412
|
-
return false;
|
60413
|
-
}
|
60414
|
-
try {
|
60415
|
-
new URL(maybeUrl);
|
60416
|
-
return true;
|
60417
|
-
} catch (e7) {
|
60418
|
-
return false;
|
60419
|
-
}
|
60420
|
-
}
|
60421
|
-
function getPagesProjectRoot() {
|
60422
|
-
const cwd2 = process.cwd();
|
60423
|
-
if (projectRootCache !== void 0 && projectRootCacheCwd === cwd2) {
|
60424
|
-
return projectRootCache;
|
60425
|
-
}
|
60426
|
-
const packagePath = findUpSync("package.json");
|
60427
|
-
projectRootCache = packagePath ? import_node_path23.default.dirname(packagePath) : process.cwd();
|
60428
|
-
projectRootCacheCwd = cwd2;
|
60429
|
-
return projectRootCache;
|
60430
|
-
}
|
60431
|
-
function getPagesTmpDir() {
|
60432
|
-
const projectRoot = getPagesProjectRoot();
|
60433
|
-
if (tmpDirCache !== void 0 && tmpDirCacheProjectRoot === projectRoot) {
|
60434
|
-
return tmpDirCache;
|
60435
|
-
}
|
60436
|
-
const tmpDir = getWranglerTmpDir(getPagesProjectRoot(), "pages");
|
60437
|
-
tmpDirCache = tmpDir.path;
|
60438
|
-
tmpDirCacheProjectRoot = projectRoot;
|
60439
|
-
return tmpDirCache;
|
60440
|
-
}
|
60481
|
+
// src/utils/debounce.ts
|
60441
60482
|
function debounce(fn2, delayMs = 100) {
|
60442
60483
|
let crrTimeoutId;
|
60443
60484
|
return () => {
|
@@ -60449,22 +60490,9 @@ function debounce(fn2, delayMs = 100) {
|
|
60449
60490
|
}, delayMs);
|
60450
60491
|
};
|
60451
60492
|
}
|
60452
|
-
var
|
60453
|
-
|
60454
|
-
"src/pages/utils.ts"() {
|
60493
|
+
var init_debounce = __esm({
|
60494
|
+
"src/utils/debounce.ts"() {
|
60455
60495
|
init_import_meta_url();
|
60456
|
-
import_node_path23 = __toESM(require("path"));
|
60457
|
-
init_find_up();
|
60458
|
-
init_paths();
|
60459
|
-
RUNNING_BUILDERS = [];
|
60460
|
-
CLEANUP_CALLBACKS = [];
|
60461
|
-
CLEANUP = /* @__PURE__ */ __name(() => {
|
60462
|
-
CLEANUP_CALLBACKS.forEach((callback) => callback());
|
60463
|
-
RUNNING_BUILDERS.forEach((builder) => builder.stop?.());
|
60464
|
-
}, "CLEANUP");
|
60465
|
-
__name(isUrl, "isUrl");
|
60466
|
-
__name(getPagesProjectRoot, "getPagesProjectRoot");
|
60467
|
-
__name(getPagesTmpDir, "getPagesTmpDir");
|
60468
60496
|
__name(debounce, "debounce");
|
60469
60497
|
}
|
60470
60498
|
});
|
@@ -60487,8 +60515,8 @@ var init_BundlerController = __esm({
|
|
60487
60515
|
init_use_esbuild();
|
60488
60516
|
init_logger();
|
60489
60517
|
init_navigator_user_agent();
|
60490
|
-
init_utils3();
|
60491
60518
|
init_paths();
|
60519
|
+
init_debounce();
|
60492
60520
|
init_BaseController();
|
60493
60521
|
init_events();
|
60494
60522
|
init_utils2();
|
@@ -62729,7 +62757,7 @@ async function buildAndMaybePush(args, pathToDocker, push, configPath, container
|
|
62729
62757
|
await dockerBuild(pathToDocker, {
|
62730
62758
|
buildCmd,
|
62731
62759
|
dockerfile
|
62732
|
-
});
|
62760
|
+
}).ready;
|
62733
62761
|
const inspectOutput = await dockerImageInspect(pathToDocker, {
|
62734
62762
|
imageTag,
|
62735
62763
|
formatString: "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}"
|
@@ -63791,9 +63819,12 @@ function createApplicationToModifyApplication(req) {
|
|
63791
63819
|
scheduling_policy: req.scheduling_policy
|
63792
63820
|
};
|
63793
63821
|
}
|
63794
|
-
function applicationToCreateApplication(application) {
|
63822
|
+
function applicationToCreateApplication(accountId, application) {
|
63795
63823
|
const app = {
|
63796
|
-
configuration:
|
63824
|
+
configuration: {
|
63825
|
+
...application.configuration,
|
63826
|
+
image: resolveImageName(accountId, application.configuration.image)
|
63827
|
+
},
|
63797
63828
|
constraints: application.constraints,
|
63798
63829
|
max_instances: application.max_instances,
|
63799
63830
|
name: application.name,
|
@@ -63835,7 +63866,7 @@ function containerAppToInstanceType(containerApp) {
|
|
63835
63866
|
return "dev" /* DEV */;
|
63836
63867
|
}
|
63837
63868
|
}
|
63838
|
-
function containerAppToCreateApplication(containerApp, observability, existingApp, skipDefaults = false) {
|
63869
|
+
function containerAppToCreateApplication(accountId, containerApp, observability, existingApp, skipDefaults = false) {
|
63839
63870
|
const observabilityConfiguration = observabilityToConfiguration(
|
63840
63871
|
observability,
|
63841
63872
|
existingApp?.configuration.observability
|
@@ -63854,7 +63885,11 @@ function containerAppToCreateApplication(containerApp, observability, existingAp
|
|
63854
63885
|
const app = {
|
63855
63886
|
...containerApp,
|
63856
63887
|
name: containerApp.name,
|
63857
|
-
configuration
|
63888
|
+
configuration: {
|
63889
|
+
...configuration,
|
63890
|
+
// De-sugar image name
|
63891
|
+
image: resolveImageName(accountId, configuration.image)
|
63892
|
+
},
|
63858
63893
|
instances: containerApp.instances ?? 0,
|
63859
63894
|
scheduling_policy: containerApp.scheduling_policy ?? "default" /* DEFAULT */,
|
63860
63895
|
constraints: {
|
@@ -64049,7 +64084,9 @@ async function apply(args, config) {
|
|
64049
64084
|
appConfigNoDefaults.configuration ??= {};
|
64050
64085
|
appConfigNoDefaults.configuration.image = application.configuration.image;
|
64051
64086
|
}
|
64087
|
+
const accountId = config.account_id || await getAccountId(config);
|
64052
64088
|
const appConfig = containerAppToCreateApplication(
|
64089
|
+
accountId,
|
64053
64090
|
appConfigNoDefaults,
|
64054
64091
|
config.observability,
|
64055
64092
|
application,
|
@@ -64057,7 +64094,7 @@ async function apply(args, config) {
|
|
64057
64094
|
);
|
64058
64095
|
if (application !== void 0 && application !== null) {
|
64059
64096
|
const prevApp = sortObjectRecursive(
|
64060
|
-
stripUndefined(applicationToCreateApplication(application))
|
64097
|
+
stripUndefined(applicationToCreateApplication(accountId, application))
|
64061
64098
|
);
|
64062
64099
|
if (appConfigNoDefaults.scheduling_policy === void 0) {
|
64063
64100
|
appConfig.scheduling_policy = prevApp.scheduling_policy;
|
@@ -64179,16 +64216,7 @@ async function apply(args, config) {
|
|
64179
64216
|
s5.split("\n").map((line) => line.trim()).forEach((el) => {
|
64180
64217
|
printLine(el, " ");
|
64181
64218
|
});
|
64182
|
-
const
|
64183
|
-
const configToPush = {
|
64184
|
-
...appConfig,
|
64185
|
-
configuration: {
|
64186
|
-
...appConfig.configuration,
|
64187
|
-
// De-sugar image name. We do it here so that the user
|
64188
|
-
// sees the simplified image name in diffs.
|
64189
|
-
image: await resolveImageName(accountId, appConfig.configuration.image)
|
64190
|
-
}
|
64191
|
-
};
|
64219
|
+
const configToPush = { ...appConfig };
|
64192
64220
|
actions.push({
|
64193
64221
|
action: "create",
|
64194
64222
|
application: configToPush
|
@@ -64697,7 +64725,7 @@ function getDatabaseInfoFromConfig(config, name2) {
|
|
64697
64725
|
return null;
|
64698
64726
|
}
|
64699
64727
|
var getDatabaseByNameOrBinding, getDatabaseInfoFromIdOrName;
|
64700
|
-
var
|
64728
|
+
var init_utils3 = __esm({
|
64701
64729
|
"src/d1/utils.ts"() {
|
64702
64730
|
init_import_meta_url();
|
64703
64731
|
init_cfetch();
|
@@ -65207,7 +65235,7 @@ function getMetricsConfig({
|
|
65207
65235
|
return { enabled: true, deviceId };
|
65208
65236
|
}
|
65209
65237
|
function writeMetricsConfig(config) {
|
65210
|
-
(0, import_node_fs12.mkdirSync)(
|
65238
|
+
(0, import_node_fs12.mkdirSync)(import_node_path23.default.dirname(getMetricsConfigPath()), { recursive: true });
|
65211
65239
|
(0, import_node_fs12.writeFileSync)(
|
65212
65240
|
getMetricsConfigPath(),
|
65213
65241
|
JSON.stringify(
|
@@ -65237,7 +65265,7 @@ function updateMetricsPermission(enabled) {
|
|
65237
65265
|
writeMetricsConfig(config);
|
65238
65266
|
}
|
65239
65267
|
function getMetricsConfigPath() {
|
65240
|
-
return
|
65268
|
+
return import_node_path23.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
65241
65269
|
}
|
65242
65270
|
function getDeviceId(config) {
|
65243
65271
|
const deviceId = config.deviceId ?? (0, import_node_crypto5.randomUUID)();
|
@@ -65246,13 +65274,13 @@ function getDeviceId(config) {
|
|
65246
65274
|
}
|
65247
65275
|
return deviceId;
|
65248
65276
|
}
|
65249
|
-
var import_node_crypto5, import_node_fs12,
|
65277
|
+
var import_node_crypto5, import_node_fs12, import_node_path23, CURRENT_METRICS_DATE;
|
65250
65278
|
var init_metrics_config = __esm({
|
65251
65279
|
"src/metrics/metrics-config.ts"() {
|
65252
65280
|
init_import_meta_url();
|
65253
65281
|
import_node_crypto5 = require("crypto");
|
65254
65282
|
import_node_fs12 = require("fs");
|
65255
|
-
|
65283
|
+
import_node_path23 = __toESM(require("path"));
|
65256
65284
|
init_misc_variables();
|
65257
65285
|
init_global_wrangler_config_path();
|
65258
65286
|
init_logger();
|
@@ -65773,7 +65801,7 @@ var init_bindings = __esm({
|
|
65773
65801
|
init_cfetch();
|
65774
65802
|
init_create();
|
65775
65803
|
init_list();
|
65776
|
-
|
65804
|
+
init_utils3();
|
65777
65805
|
init_dialogs();
|
65778
65806
|
init_errors();
|
65779
65807
|
init_helpers4();
|
@@ -66229,18 +66257,18 @@ var require_command_exists2 = __commonJS({
|
|
66229
66257
|
// src/deployment-bundle/capnp.ts
|
66230
66258
|
function handleUnsafeCapnp(capnp) {
|
66231
66259
|
if (capnp.compiled_schema) {
|
66232
|
-
return (0, import_node_fs13.readFileSync)((0,
|
66260
|
+
return (0, import_node_fs13.readFileSync)((0, import_node_path24.resolve)(capnp.compiled_schema));
|
66233
66261
|
}
|
66234
66262
|
const { base_path, source_schemas } = capnp;
|
66235
66263
|
const capnpSchemas = (source_schemas ?? []).map(
|
66236
|
-
(x6) => (0,
|
66264
|
+
(x6) => (0, import_node_path24.resolve)(base_path, x6)
|
66237
66265
|
);
|
66238
66266
|
if (!(0, import_command_exists.sync)("capnp")) {
|
66239
66267
|
throw new UserError(
|
66240
66268
|
"The capnp compiler is required to upload capnp schemas, but is not present."
|
66241
66269
|
);
|
66242
66270
|
}
|
66243
|
-
const srcPrefix = (0,
|
66271
|
+
const srcPrefix = (0, import_node_path24.resolve)(base_path ?? ".");
|
66244
66272
|
const capnpProcess = (0, import_node_child_process3.spawnSync)("capnp", [
|
66245
66273
|
"compile",
|
66246
66274
|
"-o-",
|
@@ -66255,13 +66283,13 @@ function handleUnsafeCapnp(capnp) {
|
|
66255
66283
|
}
|
66256
66284
|
return capnpProcess.stdout;
|
66257
66285
|
}
|
66258
|
-
var import_node_child_process3, import_node_fs13,
|
66286
|
+
var import_node_child_process3, import_node_fs13, import_node_path24, import_command_exists;
|
66259
66287
|
var init_capnp = __esm({
|
66260
66288
|
"src/deployment-bundle/capnp.ts"() {
|
66261
66289
|
init_import_meta_url();
|
66262
66290
|
import_node_child_process3 = require("child_process");
|
66263
66291
|
import_node_fs13 = require("fs");
|
66264
|
-
|
66292
|
+
import_node_path24 = require("path");
|
66265
66293
|
import_command_exists = __toESM(require_command_exists2());
|
66266
66294
|
init_errors();
|
66267
66295
|
__name(handleUnsafeCapnp, "handleUnsafeCapnp");
|
@@ -66322,6 +66350,7 @@ function createWorkerUploadForm(worker) {
|
|
66322
66350
|
jwt: assets.jwt,
|
66323
66351
|
config: assetConfig
|
66324
66352
|
},
|
66353
|
+
...annotations && { annotations },
|
66325
66354
|
...compatibility_date && { compatibility_date },
|
66326
66355
|
...compatibility_flags && { compatibility_flags }
|
66327
66356
|
})
|
@@ -66619,14 +66648,14 @@ function createWorkerUploadForm(worker) {
|
|
66619
66648
|
if (hasManifest && main2.type === "esm") {
|
66620
66649
|
(0, import_node_assert13.default)(modules !== void 0);
|
66621
66650
|
const subDirs = new Set(
|
66622
|
-
modules.map((module3) =>
|
66651
|
+
modules.map((module3) => import_node_path25.default.posix.dirname(module3.name))
|
66623
66652
|
);
|
66624
66653
|
for (const subDir of subDirs) {
|
66625
66654
|
if (subDir === ".") {
|
66626
66655
|
continue;
|
66627
66656
|
}
|
66628
|
-
const relativePath =
|
66629
|
-
const filePath =
|
66657
|
+
const relativePath = import_node_path25.default.posix.relative(subDir, manifestModuleName);
|
66658
|
+
const filePath = import_node_path25.default.posix.join(subDir, manifestModuleName);
|
66630
66659
|
modules.push({
|
66631
66660
|
name: filePath,
|
66632
66661
|
filePath,
|
@@ -66743,13 +66772,13 @@ function createWorkerUploadForm(worker) {
|
|
66743
66772
|
}
|
66744
66773
|
return formData;
|
66745
66774
|
}
|
66746
|
-
var import_node_assert13, import_node_fs14,
|
66775
|
+
var import_node_assert13, import_node_fs14, import_node_path25, import_undici6, moduleTypeMimeType;
|
66747
66776
|
var init_create_worker_upload_form = __esm({
|
66748
66777
|
"src/deployment-bundle/create-worker-upload-form.ts"() {
|
66749
66778
|
init_import_meta_url();
|
66750
66779
|
import_node_assert13 = __toESM(require("assert"));
|
66751
66780
|
import_node_fs14 = require("fs");
|
66752
|
-
|
66781
|
+
import_node_path25 = __toESM(require("path"));
|
66753
66782
|
import_undici6 = __toESM(require_undici());
|
66754
66783
|
init_errors();
|
66755
66784
|
init_bindings();
|
@@ -66978,9 +67007,9 @@ async function* getFilesInFolder(dirPath) {
|
|
66978
67007
|
continue;
|
66979
67008
|
}
|
66980
67009
|
if (file.isDirectory()) {
|
66981
|
-
yield* await getFilesInFolder(
|
67010
|
+
yield* await getFilesInFolder(path29.join(dirPath, file.name));
|
66982
67011
|
} else {
|
66983
|
-
yield
|
67012
|
+
yield path29.join(dirPath, file.name);
|
66984
67013
|
}
|
66985
67014
|
}
|
66986
67015
|
}
|
@@ -66988,11 +67017,11 @@ function hashFileContent(hasher, content) {
|
|
66988
67017
|
return hasher.h64ToString(content).substring(0, 10);
|
66989
67018
|
}
|
66990
67019
|
function hashAsset(hasher, filePath, content) {
|
66991
|
-
const extName =
|
66992
|
-
const baseName =
|
66993
|
-
const directory =
|
67020
|
+
const extName = path29.extname(filePath) || "";
|
67021
|
+
const baseName = path29.basename(filePath, extName);
|
67022
|
+
const directory = path29.dirname(filePath);
|
66994
67023
|
const hash = hashFileContent(hasher, content);
|
66995
|
-
return urlSafe(
|
67024
|
+
return urlSafe(path29.join(directory, `${baseName}.${hash}${extName}`));
|
66996
67025
|
}
|
66997
67026
|
async function createKVNamespaceIfNotAlreadyExisting(complianceConfig, title, accountId) {
|
66998
67027
|
const namespaces = await listKVNamespaces(complianceConfig, accountId);
|
@@ -67033,7 +67062,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
67033
67062
|
);
|
67034
67063
|
const namespaceKeyInfoMap = new Map(namespaceKeysResponse.map((x6) => [x6.name, x6]));
|
67035
67064
|
const namespaceKeys = new Set(namespaceKeysResponse.map((x6) => x6.name));
|
67036
|
-
const assetDirectory =
|
67065
|
+
const assetDirectory = path29.join(
|
67037
67066
|
siteAssets.baseDirectory,
|
67038
67067
|
siteAssets.assetDirectory
|
67039
67068
|
);
|
@@ -67062,7 +67091,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
67062
67091
|
__name(logDiff, "logDiff");
|
67063
67092
|
logger.info("Building list of assets to upload...");
|
67064
67093
|
for await (const absAssetFile of getFilesInFolder(assetDirectory)) {
|
67065
|
-
const assetFile =
|
67094
|
+
const assetFile = path29.relative(assetDirectory, absAssetFile);
|
67066
67095
|
if (!include(assetFile) || exclude2(assetFile)) {
|
67067
67096
|
continue;
|
67068
67097
|
}
|
@@ -67088,7 +67117,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
67088
67117
|
skipCount++;
|
67089
67118
|
}
|
67090
67119
|
namespaceKeys.delete(assetKey);
|
67091
|
-
const manifestKey = urlSafe(
|
67120
|
+
const manifestKey = urlSafe(path29.relative(assetDirectory, absAssetFile));
|
67092
67121
|
manifest[manifestKey] = assetKey;
|
67093
67122
|
}
|
67094
67123
|
if (uploadBucket.length > 0) {
|
@@ -67223,7 +67252,7 @@ function urlSafe(filePath) {
|
|
67223
67252
|
return filePath.replace(/\\/g, "/");
|
67224
67253
|
}
|
67225
67254
|
function getSiteAssetPaths(config, assetDirectory, includePatterns = config.site?.include ?? [], excludePatterns = config.site?.exclude ?? []) {
|
67226
|
-
const baseDirectory = assetDirectory ? process.cwd() :
|
67255
|
+
const baseDirectory = assetDirectory ? process.cwd() : path29.resolve(path29.dirname(config.configPath ?? "wrangler.toml"));
|
67227
67256
|
assetDirectory ??= config.site?.bucket;
|
67228
67257
|
if (assetDirectory) {
|
67229
67258
|
return {
|
@@ -67236,13 +67265,13 @@ function getSiteAssetPaths(config, assetDirectory, includePatterns = config.site
|
|
67236
67265
|
return void 0;
|
67237
67266
|
}
|
67238
67267
|
}
|
67239
|
-
var import_node_assert15, import_promises9,
|
67268
|
+
var import_node_assert15, import_promises9, path29, ALWAYS_IGNORE, HIDDEN_FILES_TO_INCLUDE, MAX_DIFF_LINES, MAX_BUCKET_SIZE2, MAX_BUCKET_KEYS, MAX_BATCH_OPERATIONS;
|
67240
67269
|
var init_sites = __esm({
|
67241
67270
|
"src/sites.ts"() {
|
67242
67271
|
init_import_meta_url();
|
67243
67272
|
import_node_assert15 = __toESM(require("assert"));
|
67244
67273
|
import_promises9 = require("fs/promises");
|
67245
|
-
|
67274
|
+
path29 = __toESM(require("path"));
|
67246
67275
|
init_workers_shared();
|
67247
67276
|
init_source();
|
67248
67277
|
init_xxhash_wasm();
|
@@ -75007,7 +75036,7 @@ async function aiFinetuneList(complianceConfig, accountId) {
|
|
75007
75036
|
return results;
|
75008
75037
|
}
|
75009
75038
|
var listCatalogEntries, listFinetuneEntries;
|
75010
|
-
var
|
75039
|
+
var init_utils4 = __esm({
|
75011
75040
|
"src/ai/utils.ts"() {
|
75012
75041
|
init_import_meta_url();
|
75013
75042
|
init_cfetch();
|
@@ -75037,7 +75066,7 @@ var init_createFinetune = __esm({
|
|
75037
75066
|
init_create_command();
|
75038
75067
|
init_logger();
|
75039
75068
|
init_user2();
|
75040
|
-
|
75069
|
+
init_utils4();
|
75041
75070
|
requiredAssets = ["adapter_config.json", "adapter_model.safetensors"];
|
75042
75071
|
aiFineTuneCreateCommand = createCommand({
|
75043
75072
|
metadata: {
|
@@ -75148,7 +75177,7 @@ var init_listCatalog = __esm({
|
|
75148
75177
|
init_create_command();
|
75149
75178
|
init_logger();
|
75150
75179
|
init_user2();
|
75151
|
-
|
75180
|
+
init_utils4();
|
75152
75181
|
aiModelsCommand = createCommand({
|
75153
75182
|
metadata: {
|
75154
75183
|
description: "List catalog models",
|
@@ -75200,7 +75229,7 @@ var init_listFinetune = __esm({
|
|
75200
75229
|
init_create_command();
|
75201
75230
|
init_logger();
|
75202
75231
|
init_user2();
|
75203
|
-
|
75232
|
+
init_utils4();
|
75204
75233
|
aiFineTuneListCommand = createCommand({
|
75205
75234
|
metadata: {
|
75206
75235
|
description: "List your finetune files",
|
@@ -77977,7 +78006,7 @@ var init_delete2 = __esm({
|
|
77977
78006
|
init_dialogs();
|
77978
78007
|
init_logger();
|
77979
78008
|
init_user2();
|
77980
|
-
|
78009
|
+
init_utils3();
|
77981
78010
|
d1DeleteCommand = createCommand({
|
77982
78011
|
metadata: {
|
77983
78012
|
description: "Delete D1 database",
|
@@ -78285,7 +78314,7 @@ async function executeLocally({
|
|
78285
78314
|
}
|
78286
78315
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
78287
78316
|
const persistencePath = getLocalPersistencePath(persistTo, config);
|
78288
|
-
const d1Persist =
|
78317
|
+
const d1Persist = import_node_path26.default.join(persistencePath, "v3", "d1");
|
78289
78318
|
logger.log(
|
78290
78319
|
`\u{1F300} Executing on local database ${name2} (${id}) from ${readableRelative(
|
78291
78320
|
d1Persist
|
@@ -78566,13 +78595,13 @@ async function checkForSQLiteBinary(filename) {
|
|
78566
78595
|
);
|
78567
78596
|
}
|
78568
78597
|
}
|
78569
|
-
var import_fs15, import_node_assert16,
|
78598
|
+
var import_fs15, import_node_assert16, import_node_path26, import_md5_file, import_miniflare12, import_undici8, d1ExecuteCommand;
|
78570
78599
|
var init_execute = __esm({
|
78571
78600
|
"src/d1/execute.ts"() {
|
78572
78601
|
init_import_meta_url();
|
78573
78602
|
import_fs15 = require("fs");
|
78574
78603
|
import_node_assert16 = __toESM(require("assert"));
|
78575
|
-
|
78604
|
+
import_node_path26 = __toESM(require("path"));
|
78576
78605
|
init_interactive();
|
78577
78606
|
init_source();
|
78578
78607
|
import_md5_file = __toESM(require_md5_file());
|
@@ -78589,7 +78618,7 @@ var init_execute = __esm({
|
|
78589
78618
|
init_paths();
|
78590
78619
|
init_user2();
|
78591
78620
|
init_splitter();
|
78592
|
-
|
78621
|
+
init_utils3();
|
78593
78622
|
d1ExecuteCommand = createCommand({
|
78594
78623
|
metadata: {
|
78595
78624
|
description: "Execute a command or SQL file",
|
@@ -78742,7 +78771,7 @@ async function exportLocal(config, name2, output, tables, noSchema, noData) {
|
|
78742
78771
|
}
|
78743
78772
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
78744
78773
|
const persistencePath = getLocalPersistencePath(void 0, config);
|
78745
|
-
const d1Persist =
|
78774
|
+
const d1Persist = import_node_path27.default.join(persistencePath, "v3", "d1");
|
78746
78775
|
logger.log(
|
78747
78776
|
`\u{1F300} Exporting local database ${name2} (${id}) from ${readableRelative(
|
78748
78777
|
d1Persist
|
@@ -78856,12 +78885,12 @@ async function pollExport(s5, complianceConfig, accountId, db, dumpOptions, curr
|
|
78856
78885
|
);
|
78857
78886
|
}
|
78858
78887
|
}
|
78859
|
-
var import_promises12,
|
78888
|
+
var import_promises12, import_node_path27, import_miniflare13, import_undici9, d1ExportCommand;
|
78860
78889
|
var init_export = __esm({
|
78861
78890
|
"src/d1/export.ts"() {
|
78862
78891
|
init_import_meta_url();
|
78863
78892
|
import_promises12 = __toESM(require("fs/promises"));
|
78864
|
-
|
78893
|
+
import_node_path27 = __toESM(require("path"));
|
78865
78894
|
init_interactive();
|
78866
78895
|
init_source();
|
78867
78896
|
import_miniflare13 = require("miniflare");
|
@@ -78875,7 +78904,7 @@ var init_export = __esm({
|
|
78875
78904
|
init_parse();
|
78876
78905
|
init_paths();
|
78877
78906
|
init_user2();
|
78878
|
-
|
78907
|
+
init_utils3();
|
78879
78908
|
d1ExportCommand = createCommand({
|
78880
78909
|
metadata: {
|
78881
78910
|
description: "Export the contents or schema of your database as a .sql file",
|
@@ -78960,7 +78989,7 @@ var init_info = __esm({
|
|
78960
78989
|
init_create_command();
|
78961
78990
|
init_logger();
|
78962
78991
|
init_user2();
|
78963
|
-
|
78992
|
+
init_utils3();
|
78964
78993
|
d1InfoCommand = createCommand({
|
78965
78994
|
metadata: {
|
78966
78995
|
description: "Get information about a D1 database, including the current database size and state",
|
@@ -79146,7 +79175,7 @@ var init_insights = __esm({
|
|
79146
79175
|
init_create_command();
|
79147
79176
|
init_logger();
|
79148
79177
|
init_user2();
|
79149
|
-
|
79178
|
+
init_utils3();
|
79150
79179
|
cliOptionToGraphQLOption = {
|
79151
79180
|
time: "queryDurationMs",
|
79152
79181
|
reads: "rowsRead",
|
@@ -79477,7 +79506,7 @@ var init_apply2 = __esm({
|
|
79477
79506
|
init_logger();
|
79478
79507
|
init_constants4();
|
79479
79508
|
init_execute();
|
79480
|
-
|
79509
|
+
init_utils3();
|
79481
79510
|
init_helpers6();
|
79482
79511
|
d1MigrationsApplyCommand = createCommand({
|
79483
79512
|
metadata: {
|
@@ -79664,7 +79693,7 @@ var init_create3 = __esm({
|
|
79664
79693
|
init_errors();
|
79665
79694
|
init_logger();
|
79666
79695
|
init_constants4();
|
79667
|
-
|
79696
|
+
init_utils3();
|
79668
79697
|
init_helpers6();
|
79669
79698
|
d1MigrationsCreateCommand = createCommand({
|
79670
79699
|
metadata: {
|
@@ -79734,7 +79763,7 @@ var init_list3 = __esm({
|
|
79734
79763
|
init_logger();
|
79735
79764
|
init_user2();
|
79736
79765
|
init_constants4();
|
79737
|
-
|
79766
|
+
init_utils3();
|
79738
79767
|
init_helpers6();
|
79739
79768
|
d1MigrationsListCommand = createCommand({
|
79740
79769
|
metadata: {
|
@@ -79851,12 +79880,12 @@ function getLocalISOString(date) {
|
|
79851
79880
|
).padStart(2, "0")}:${String(offsetAbs % 60).padStart(2, "0")}`;
|
79852
79881
|
}
|
79853
79882
|
var getBookmarkIdFromTimestamp, throwIfDatabaseIsAlpha, ISO_DATE_REG_EXP, convertTimestampToISO;
|
79854
|
-
var
|
79883
|
+
var init_utils5 = __esm({
|
79855
79884
|
"src/d1/timeTravel/utils.ts"() {
|
79856
79885
|
init_import_meta_url();
|
79857
79886
|
init_cfetch();
|
79858
79887
|
init_errors();
|
79859
|
-
|
79888
|
+
init_utils3();
|
79860
79889
|
getBookmarkIdFromTimestamp = /* @__PURE__ */ __name(async (complianceConfig, accountId, databaseId, timestamp) => {
|
79861
79890
|
const searchParams = new URLSearchParams();
|
79862
79891
|
if (timestamp) {
|
@@ -79926,8 +79955,8 @@ var init_info2 = __esm({
|
|
79926
79955
|
init_create_command();
|
79927
79956
|
init_logger();
|
79928
79957
|
init_user2();
|
79929
|
-
|
79930
|
-
|
79958
|
+
init_utils3();
|
79959
|
+
init_utils5();
|
79931
79960
|
d1TimeTravelInfoCommand = createCommand({
|
79932
79961
|
metadata: {
|
79933
79962
|
description: "Retrieve information about a database at a specific point-in-time using Time Travel",
|
@@ -79991,8 +80020,8 @@ var init_restore = __esm({
|
|
79991
80020
|
init_errors();
|
79992
80021
|
init_logger();
|
79993
80022
|
init_user2();
|
79994
|
-
|
79995
|
-
|
80023
|
+
init_utils3();
|
80024
|
+
init_utils5();
|
79996
80025
|
d1TimeTravelRestoreCommand = createCommand({
|
79997
80026
|
metadata: {
|
79998
80027
|
description: "Restore a database back to a specific point-in-time",
|
@@ -80303,10 +80332,10 @@ var init_delete3 = __esm({
|
|
80303
80332
|
|
80304
80333
|
// src/deployment-bundle/guess-worker-format.ts
|
80305
80334
|
async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
80306
|
-
const parsedEntryPath =
|
80335
|
+
const parsedEntryPath = import_node_path28.default.parse(entryFile);
|
80307
80336
|
if (parsedEntryPath.ext == ".py") {
|
80308
80337
|
logger.warn(
|
80309
|
-
`The entrypoint ${
|
80338
|
+
`The entrypoint ${import_node_path28.default.relative(
|
80310
80339
|
process.cwd(),
|
80311
80340
|
entryFile
|
80312
80341
|
)} defines a Python worker, support for Python workers is currently experimental. Python workers with a requirements.txt file can only be run locally and cannot be deployed.`
|
@@ -80331,7 +80360,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
80331
80360
|
guessedWorkerFormat = "modules";
|
80332
80361
|
} else {
|
80333
80362
|
logger.warn(
|
80334
|
-
`The entrypoint ${
|
80363
|
+
`The entrypoint ${import_node_path28.default.relative(
|
80335
80364
|
process.cwd(),
|
80336
80365
|
entryFile
|
80337
80366
|
)} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
|
@@ -80343,11 +80372,11 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
80343
80372
|
}
|
80344
80373
|
return { format: guessedWorkerFormat, exports: exports2 };
|
80345
80374
|
}
|
80346
|
-
var
|
80375
|
+
var import_node_path28, esbuild2;
|
80347
80376
|
var init_guess_worker_format = __esm({
|
80348
80377
|
"src/deployment-bundle/guess-worker-format.ts"() {
|
80349
80378
|
init_import_meta_url();
|
80350
|
-
|
80379
|
+
import_node_path28 = __toESM(require("path"));
|
80351
80380
|
esbuild2 = __toESM(require("esbuild"));
|
80352
80381
|
init_logger();
|
80353
80382
|
init_bundle();
|
@@ -80479,7 +80508,7 @@ ${migrateUrl}`
|
|
80479
80508
|
projectRoot,
|
80480
80509
|
configPath: config.configPath,
|
80481
80510
|
format: format9,
|
80482
|
-
moduleRoot: args.moduleRoot ?? config.base_dir ??
|
80511
|
+
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path29.default.dirname(paths.absolutePath),
|
80483
80512
|
name: config.name ?? "worker",
|
80484
80513
|
exports: exports2
|
80485
80514
|
};
|
@@ -80519,11 +80548,11 @@ function getNpxEquivalent() {
|
|
80519
80548
|
return "npx";
|
80520
80549
|
}
|
80521
80550
|
}
|
80522
|
-
var
|
80551
|
+
var import_node_path29;
|
80523
80552
|
var init_entry = __esm({
|
80524
80553
|
"src/deployment-bundle/entry.ts"() {
|
80525
80554
|
init_import_meta_url();
|
80526
|
-
|
80555
|
+
import_node_path29 = __toESM(require("path"));
|
80527
80556
|
init_esm2();
|
80528
80557
|
init_config2();
|
80529
80558
|
init_errors();
|
@@ -80625,20 +80654,20 @@ function getOutputFilePath() {
|
|
80625
80654
|
const outputFileDirectoryFromEnv = getOutputFileDirectoryFromEnv();
|
80626
80655
|
if (outputFileDirectoryFromEnv) {
|
80627
80656
|
const date = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replace(".", "_").replace("T", "_").replace("Z", "");
|
80628
|
-
return (0,
|
80657
|
+
return (0, import_node_path30.resolve)(
|
80629
80658
|
outputFileDirectoryFromEnv,
|
80630
80659
|
`wrangler-output-${date}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}.json`
|
80631
80660
|
);
|
80632
80661
|
}
|
80633
80662
|
return null;
|
80634
80663
|
}
|
80635
|
-
var import_node_crypto6, import_node_fs18,
|
80664
|
+
var import_node_crypto6, import_node_fs18, import_node_path30, outputFilePath;
|
80636
80665
|
var init_output = __esm({
|
80637
80666
|
"src/output.ts"() {
|
80638
80667
|
init_import_meta_url();
|
80639
80668
|
import_node_crypto6 = require("crypto");
|
80640
80669
|
import_node_fs18 = require("fs");
|
80641
|
-
|
80670
|
+
import_node_path30 = require("path");
|
80642
80671
|
init_misc_variables();
|
80643
80672
|
init_filesystem();
|
80644
80673
|
__name(writeOutput, "writeOutput");
|
@@ -80685,12 +80714,12 @@ var init_getRules = __esm({
|
|
80685
80714
|
});
|
80686
80715
|
|
80687
80716
|
// src/deploy/index.ts
|
80688
|
-
var import_node_assert17,
|
80717
|
+
var import_node_assert17, import_node_path31, deployCommand;
|
80689
80718
|
var init_deploy3 = __esm({
|
80690
80719
|
"src/deploy/index.ts"() {
|
80691
80720
|
init_import_meta_url();
|
80692
80721
|
import_node_assert17 = __toESM(require("assert"));
|
80693
|
-
|
80722
|
+
import_node_path31 = __toESM(require("path"));
|
80694
80723
|
init_assets();
|
80695
80724
|
init_config2();
|
80696
80725
|
init_create_command();
|
@@ -80918,7 +80947,7 @@ var init_deploy3 = __esm({
|
|
80918
80947
|
{ telemetryMessage: true }
|
80919
80948
|
);
|
80920
80949
|
}
|
80921
|
-
const projectRoot = config.userConfigPath &&
|
80950
|
+
const projectRoot = config.userConfigPath && import_node_path31.default.dirname(config.userConfigPath);
|
80922
80951
|
const entry = await getEntry(args, config, "deploy");
|
80923
80952
|
validateAssetsArgsAndConfig(args, config);
|
80924
80953
|
const assetsOptions = getAssetsOptions(args, config);
|
@@ -83075,19 +83104,19 @@ async function downloadWorker(accountId, workerName) {
|
|
83075
83104
|
config
|
83076
83105
|
};
|
83077
83106
|
}
|
83078
|
-
var import_promises13,
|
83107
|
+
var import_promises13, import_node_path32, import_toml4, init;
|
83079
83108
|
var init_init = __esm({
|
83080
83109
|
"src/init.ts"() {
|
83081
83110
|
init_import_meta_url();
|
83082
83111
|
import_promises13 = require("fs/promises");
|
83083
|
-
|
83112
|
+
import_node_path32 = __toESM(require("path"));
|
83084
83113
|
import_toml4 = __toESM(require_toml());
|
83085
83114
|
init_execa();
|
83086
83115
|
init_utils2();
|
83087
83116
|
init_cfetch();
|
83088
83117
|
init_internal();
|
83089
83118
|
init_create_command();
|
83090
|
-
|
83119
|
+
init_utils3();
|
83091
83120
|
init_misc_variables();
|
83092
83121
|
init_errors();
|
83093
83122
|
init_logger();
|
@@ -83161,13 +83190,13 @@ var init_init = __esm({
|
|
83161
83190
|
}
|
83162
83191
|
throw err;
|
83163
83192
|
}
|
83164
|
-
const creationDir =
|
83193
|
+
const creationDir = import_node_path32.default.join(process.cwd(), args.fromDash);
|
83165
83194
|
await (0, import_promises13.mkdir)(creationDir, { recursive: true });
|
83166
83195
|
const { modules, config } = await downloadWorker(
|
83167
83196
|
accountId,
|
83168
83197
|
args.fromDash
|
83169
83198
|
);
|
83170
|
-
await (0, import_promises13.mkdir)(
|
83199
|
+
await (0, import_promises13.mkdir)(import_node_path32.default.join(creationDir, "./src"), {
|
83171
83200
|
recursive: true
|
83172
83201
|
});
|
83173
83202
|
config.main = `src/${config.main}`;
|
@@ -83175,15 +83204,15 @@ var init_init = __esm({
|
|
83175
83204
|
for (const files of createBatches(modules, 10)) {
|
83176
83205
|
await Promise.all(
|
83177
83206
|
files.map(async (file) => {
|
83178
|
-
const filepath =
|
83179
|
-
const directory = (0,
|
83207
|
+
const filepath = import_node_path32.default.join(creationDir, `./src/${file.name}`);
|
83208
|
+
const directory = (0, import_node_path32.dirname)(filepath);
|
83180
83209
|
await (0, import_promises13.mkdir)(directory, { recursive: true });
|
83181
83210
|
await (0, import_promises13.writeFile)(filepath, file.stream());
|
83182
83211
|
})
|
83183
83212
|
);
|
83184
83213
|
}
|
83185
83214
|
await (0, import_promises13.writeFile)(
|
83186
|
-
|
83215
|
+
import_node_path32.default.join(creationDir, "wrangler.toml"),
|
83187
83216
|
import_toml4.default.stringify(config)
|
83188
83217
|
);
|
83189
83218
|
} else {
|
@@ -84349,13 +84378,64 @@ var init_cli3 = __esm({
|
|
84349
84378
|
}
|
84350
84379
|
});
|
84351
84380
|
|
84381
|
+
// src/pages/utils.ts
|
84382
|
+
function isUrl(maybeUrl) {
|
84383
|
+
if (!maybeUrl) {
|
84384
|
+
return false;
|
84385
|
+
}
|
84386
|
+
try {
|
84387
|
+
new URL(maybeUrl);
|
84388
|
+
return true;
|
84389
|
+
} catch (e7) {
|
84390
|
+
return false;
|
84391
|
+
}
|
84392
|
+
}
|
84393
|
+
function getPagesProjectRoot() {
|
84394
|
+
const cwd2 = process.cwd();
|
84395
|
+
if (projectRootCache !== void 0 && projectRootCacheCwd === cwd2) {
|
84396
|
+
return projectRootCache;
|
84397
|
+
}
|
84398
|
+
const packagePath = findUpSync("package.json");
|
84399
|
+
projectRootCache = packagePath ? import_node_path33.default.dirname(packagePath) : process.cwd();
|
84400
|
+
projectRootCacheCwd = cwd2;
|
84401
|
+
return projectRootCache;
|
84402
|
+
}
|
84403
|
+
function getPagesTmpDir() {
|
84404
|
+
const projectRoot = getPagesProjectRoot();
|
84405
|
+
if (tmpDirCache !== void 0 && tmpDirCacheProjectRoot === projectRoot) {
|
84406
|
+
return tmpDirCache;
|
84407
|
+
}
|
84408
|
+
const tmpDir = getWranglerTmpDir(getPagesProjectRoot(), "pages");
|
84409
|
+
tmpDirCache = tmpDir.path;
|
84410
|
+
tmpDirCacheProjectRoot = projectRoot;
|
84411
|
+
return tmpDirCache;
|
84412
|
+
}
|
84413
|
+
var import_node_path33, RUNNING_BUILDERS, CLEANUP_CALLBACKS, CLEANUP, projectRootCacheCwd, projectRootCache, tmpDirCacheProjectRoot, tmpDirCache;
|
84414
|
+
var init_utils6 = __esm({
|
84415
|
+
"src/pages/utils.ts"() {
|
84416
|
+
init_import_meta_url();
|
84417
|
+
import_node_path33 = __toESM(require("path"));
|
84418
|
+
init_find_up();
|
84419
|
+
init_paths();
|
84420
|
+
RUNNING_BUILDERS = [];
|
84421
|
+
CLEANUP_CALLBACKS = [];
|
84422
|
+
CLEANUP = /* @__PURE__ */ __name(() => {
|
84423
|
+
CLEANUP_CALLBACKS.forEach((callback) => callback());
|
84424
|
+
RUNNING_BUILDERS.forEach((builder) => builder.stop?.());
|
84425
|
+
}, "CLEANUP");
|
84426
|
+
__name(isUrl, "isUrl");
|
84427
|
+
__name(getPagesProjectRoot, "getPagesProjectRoot");
|
84428
|
+
__name(getPagesTmpDir, "getPagesTmpDir");
|
84429
|
+
}
|
84430
|
+
});
|
84431
|
+
|
84352
84432
|
// src/pages/index.ts
|
84353
84433
|
var pagesNamespace, pagesFunctionsNamespace, pagesProjectNamespace, pagesDeploymentNamespace, pagesDownloadNamespace;
|
84354
84434
|
var init_pages = __esm({
|
84355
84435
|
"src/pages/index.ts"() {
|
84356
84436
|
init_import_meta_url();
|
84357
84437
|
init_create_command();
|
84358
|
-
|
84438
|
+
init_utils6();
|
84359
84439
|
pagesNamespace = createNamespace({
|
84360
84440
|
metadata: {
|
84361
84441
|
description: "\u26A1\uFE0F Configure Cloudflare Pages",
|
@@ -84810,7 +84890,7 @@ var init_buildWorker = __esm({
|
|
84810
84890
|
init_errors();
|
84811
84891
|
init_logger();
|
84812
84892
|
init_paths();
|
84813
|
-
|
84893
|
+
init_utils6();
|
84814
84894
|
__name(buildWorkerFromFunctions, "buildWorkerFromFunctions");
|
84815
84895
|
__name(buildRawWorker, "buildRawWorker");
|
84816
84896
|
__name(produceWorkerBundleForWorkerJSDirectory, "produceWorkerBundleForWorkerJSDirectory");
|
@@ -84936,7 +85016,7 @@ var init_buildPlugin = __esm({
|
|
84936
85016
|
init_bundle();
|
84937
85017
|
init_module_collection();
|
84938
85018
|
init_paths();
|
84939
|
-
|
85019
|
+
init_utils6();
|
84940
85020
|
init_buildWorker();
|
84941
85021
|
__name(buildPluginFromFunctions, "buildPluginFromFunctions");
|
84942
85022
|
}
|
@@ -85519,7 +85599,7 @@ var init_buildFunctions = __esm({
|
|
85519
85599
|
init_filepath_routing();
|
85520
85600
|
init_routes2();
|
85521
85601
|
init_routes_transformation();
|
85522
|
-
|
85602
|
+
init_utils6();
|
85523
85603
|
__name(buildFunctions, "buildFunctions");
|
85524
85604
|
}
|
85525
85605
|
});
|
@@ -87622,7 +87702,7 @@ var init_deploy4 = __esm({
|
|
87622
87702
|
init_buildWorker();
|
87623
87703
|
init_routes_validation();
|
87624
87704
|
init_upload();
|
87625
|
-
|
87705
|
+
init_utils6();
|
87626
87706
|
init_validate2();
|
87627
87707
|
init_create_worker_bundle_contents();
|
87628
87708
|
__name(deploy2, "deploy");
|
@@ -88048,7 +88128,7 @@ var init_deploy5 = __esm({
|
|
88048
88128
|
init_errors3();
|
88049
88129
|
init_projects();
|
88050
88130
|
init_prompt_select_project();
|
88051
|
-
|
88131
|
+
init_utils6();
|
88052
88132
|
pagesDeploymentCreateCommand = createAlias({
|
88053
88133
|
aliasOf: "wrangler pages deploy"
|
88054
88134
|
});
|
@@ -89957,7 +90037,7 @@ var init_deployment_tails = __esm({
|
|
89957
90037
|
init_user2();
|
89958
90038
|
init_constants3();
|
89959
90039
|
init_prompt_select_project();
|
89960
|
-
|
90040
|
+
init_utils6();
|
89961
90041
|
statusChoices = ["ok", "error", "canceled"];
|
89962
90042
|
isStatusChoiceList = /* @__PURE__ */ __name((data) => data?.every((d6) => statusChoices.includes(d6)) ?? false, "isStatusChoiceList");
|
89963
90043
|
pagesDeploymentTailCommand = createCommand({
|
@@ -90578,13 +90658,14 @@ var init_dev = __esm({
|
|
90578
90658
|
init_metrics();
|
90579
90659
|
init_navigator_user_agent();
|
90580
90660
|
init_paths();
|
90661
|
+
init_debounce();
|
90581
90662
|
init_shell_quote();
|
90582
90663
|
init_buildFunctions();
|
90583
90664
|
init_constants3();
|
90584
90665
|
init_errors3();
|
90585
90666
|
init_buildWorker();
|
90586
90667
|
init_routes_validation();
|
90587
|
-
|
90668
|
+
init_utils6();
|
90588
90669
|
DURABLE_OBJECTS_BINDING_REGEXP = new RegExp(
|
90589
90670
|
/^(?<binding>[^=]+)=(?<className>[^@\s]+)(@(?<scriptName>.*)$)?$/
|
90590
90671
|
);
|
@@ -147407,17 +147488,20 @@ var init_view2 = __esm({
|
|
147407
147488
|
Message: version5.annotations?.["workers/message"] || BLANK_INPUT5
|
147408
147489
|
})
|
147409
147490
|
);
|
147410
|
-
|
147411
|
-
|
147412
|
-
Handlers
|
147413
|
-
}
|
147491
|
+
const scriptInfo = {};
|
147492
|
+
if (version5.resources.script.handlers) {
|
147493
|
+
scriptInfo.Handlers = version5.resources.script.handlers.join(", ");
|
147494
|
+
}
|
147414
147495
|
if (version5.resources.script_runtime.compatibility_date) {
|
147415
147496
|
scriptInfo["Compatibility Date"] = version5.resources.script_runtime.compatibility_date;
|
147416
147497
|
}
|
147417
147498
|
if (version5.resources.script_runtime.compatibility_flags) {
|
147418
147499
|
scriptInfo["Compatibility Flags"] = version5.resources.script_runtime.compatibility_flags.join(", ");
|
147419
147500
|
}
|
147420
|
-
|
147501
|
+
if (Object.keys(scriptInfo).length > 0) {
|
147502
|
+
logRaw("------------------------------------------------------------");
|
147503
|
+
logRaw(formatLabelledValues(scriptInfo));
|
147504
|
+
}
|
147421
147505
|
const secrets = version5.resources.bindings.filter(
|
147422
147506
|
(binding) => binding.type === "secret_text"
|
147423
147507
|
);
|
@@ -174901,6 +174985,9 @@ var init_LocalRuntimeController = __esm({
|
|
174901
174985
|
// If this doesn't match what is in config, trigger a rebuild.
|
174902
174986
|
// Used for the rebuild hotkey
|
174903
174987
|
#currentContainerBuildId;
|
174988
|
+
// Used to store the information and abort handle for the
|
174989
|
+
// current container that is being built
|
174990
|
+
containerBeingBuilt;
|
174904
174991
|
onBundleStart(_4) {
|
174905
174992
|
}
|
174906
174993
|
async #onBundleComplete(data, id) {
|
@@ -174927,8 +175014,20 @@ var init_LocalRuntimeController = __esm({
|
|
174927
175014
|
await prepareContainerImagesForDev(
|
174928
175015
|
this.#dockerPath,
|
174929
175016
|
containerOptions,
|
174930
|
-
data.config.config
|
175017
|
+
data.config.config,
|
175018
|
+
(buildStartEvent) => {
|
175019
|
+
this.containerBeingBuilt = {
|
175020
|
+
...buildStartEvent,
|
175021
|
+
abortRequested: false
|
175022
|
+
};
|
175023
|
+
},
|
175024
|
+
() => {
|
175025
|
+
this.containerBeingBuilt = void 0;
|
175026
|
+
}
|
174931
175027
|
);
|
175028
|
+
if (this.containerBeingBuilt) {
|
175029
|
+
this.containerBeingBuilt.abortRequested = false;
|
175030
|
+
}
|
174932
175031
|
this.#currentContainerBuildId = data.config.dev.containerBuildId;
|
174933
175032
|
logger.log(source_default.dim("\u2394 Container image(s) ready"));
|
174934
175033
|
}
|
@@ -174992,6 +175091,9 @@ var init_LocalRuntimeController = __esm({
|
|
174992
175091
|
}
|
174993
175092
|
});
|
174994
175093
|
} catch (error2) {
|
175094
|
+
if (this.containerBeingBuilt?.abortRequested && error2 instanceof Error && error2.message === "Build exited with code: 1") {
|
175095
|
+
return;
|
175096
|
+
}
|
174995
175097
|
this.emitErrorEvent({
|
174996
175098
|
type: "error",
|
174997
175099
|
reason: "Error reloading local server",
|
@@ -175636,7 +175738,15 @@ function registerDevHotKeys(devEnv, args) {
|
|
175636
175738
|
disabled: /* @__PURE__ */ __name(() => {
|
175637
175739
|
return !devEnv.config.latestConfig?.dev?.enableContainers || !devEnv.config.latestConfig?.containers?.length;
|
175638
175740
|
}, "disabled"),
|
175639
|
-
handler:
|
175741
|
+
handler: debounce(async () => {
|
175742
|
+
devEnv.runtimes.forEach((runtime) => {
|
175743
|
+
if (runtime instanceof LocalRuntimeController) {
|
175744
|
+
if (runtime.containerBeingBuilt) {
|
175745
|
+
runtime.containerBeingBuilt.abort();
|
175746
|
+
runtime.containerBeingBuilt.abortRequested = true;
|
175747
|
+
}
|
175748
|
+
}
|
175749
|
+
});
|
175640
175750
|
const newContainerBuildId = (0, import_crypto7.randomUUID)().slice(0, 8);
|
175641
175751
|
devEnv.runtimes.map(async (runtime) => {
|
175642
175752
|
if (runtime instanceof LocalRuntimeController) {
|
@@ -175649,7 +175759,7 @@ function registerDevHotKeys(devEnv, args) {
|
|
175649
175759
|
containerBuildId: newContainerBuildId
|
175650
175760
|
}
|
175651
175761
|
});
|
175652
|
-
},
|
175762
|
+
}, 250)
|
175653
175763
|
},
|
175654
175764
|
{
|
175655
175765
|
keys: ["l"],
|
@@ -175667,13 +175777,26 @@ function registerDevHotKeys(devEnv, args) {
|
|
175667
175777
|
keys: ["c"],
|
175668
175778
|
label: "clear console",
|
175669
175779
|
handler: /* @__PURE__ */ __name(async () => {
|
175670
|
-
|
175780
|
+
const someContainerIsBeingBuilt = devEnv.runtimes.some(
|
175781
|
+
(runtime) => runtime instanceof LocalRuntimeController && runtime.containerBeingBuilt
|
175782
|
+
);
|
175783
|
+
if (!someContainerIsBeingBuilt) {
|
175784
|
+
logger.console("clear");
|
175785
|
+
}
|
175671
175786
|
}, "handler")
|
175672
175787
|
},
|
175673
175788
|
{
|
175674
175789
|
keys: ["x", "q", "ctrl+c"],
|
175675
175790
|
label: "to exit",
|
175676
175791
|
handler: /* @__PURE__ */ __name(async () => {
|
175792
|
+
devEnv.runtimes.forEach((runtime) => {
|
175793
|
+
if (runtime instanceof LocalRuntimeController) {
|
175794
|
+
if (runtime.containerBeingBuilt) {
|
175795
|
+
runtime.containerBeingBuilt.abort();
|
175796
|
+
runtime.containerBeingBuilt.abortRequested = true;
|
175797
|
+
}
|
175798
|
+
}
|
175799
|
+
});
|
175677
175800
|
await devEnv.teardown();
|
175678
175801
|
}, "handler")
|
175679
175802
|
}
|
@@ -175689,6 +175812,7 @@ var init_hotkeys = __esm({
|
|
175689
175812
|
init_cli_hotkeys();
|
175690
175813
|
init_logger();
|
175691
175814
|
init_open_in_browser();
|
175815
|
+
init_debounce();
|
175692
175816
|
init_inspect2();
|
175693
175817
|
__name(registerDevHotKeys, "registerDevHotKeys");
|
175694
175818
|
}
|