wrangler 3.73.0 → 3.74.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/package.json +5 -5
- package/wrangler-dist/cli.d.ts +10 -4
- package/wrangler-dist/cli.js +296 -202
- package/templates/no-op-assets-worker.ts +0 -33
- package/wrangler-dist/cli.js.map +0 -7
package/wrangler-dist/cli.js
CHANGED
@@ -80045,7 +80045,7 @@ var require_view = __commonJS({
|
|
80045
80045
|
var debug = require_src2()("express:view");
|
80046
80046
|
var path74 = require("path");
|
80047
80047
|
var fs26 = require("fs");
|
80048
|
-
var
|
80048
|
+
var dirname16 = path74.dirname;
|
80049
80049
|
var basename5 = path74.basename;
|
80050
80050
|
var extname5 = path74.extname;
|
80051
80051
|
var join18 = path74.join;
|
@@ -80085,7 +80085,7 @@ var require_view = __commonJS({
|
|
80085
80085
|
for (var i = 0; i < roots.length && !path75; i++) {
|
80086
80086
|
var root = roots[i];
|
80087
80087
|
var loc = resolve22(root, name);
|
80088
|
-
var dir =
|
80088
|
+
var dir = dirname16(loc);
|
80089
80089
|
var file = basename5(loc);
|
80090
80090
|
path75 = this.resolve(dir, file);
|
80091
80091
|
}
|
@@ -97445,9 +97445,9 @@ var require_command_exists = __commonJS({
|
|
97445
97445
|
cleanInput = /* @__PURE__ */ __name(function(s) {
|
97446
97446
|
var isPathName = /[\\]/.test(s);
|
97447
97447
|
if (isPathName) {
|
97448
|
-
var
|
97448
|
+
var dirname16 = '"' + path74.dirname(s) + '"';
|
97449
97449
|
var basename5 = '"' + path74.basename(s) + '"';
|
97450
|
-
return
|
97450
|
+
return dirname16 + ":" + basename5;
|
97451
97451
|
}
|
97452
97452
|
return '"' + s + '"';
|
97453
97453
|
}, "cleanInput");
|
@@ -152693,7 +152693,7 @@ init_import_meta_url();
|
|
152693
152693
|
init_import_meta_url();
|
152694
152694
|
|
152695
152695
|
// package.json
|
152696
|
-
var version = "3.
|
152696
|
+
var version = "3.74.0";
|
152697
152697
|
var package_default = {
|
152698
152698
|
name: "wrangler",
|
152699
152699
|
version,
|
@@ -159430,10 +159430,8 @@ async function getEntry(args, config, command2) {
|
|
159430
159430
|
// site.entry-point could be a directory
|
159431
159431
|
import_node_path16.default.resolve(config.site?.["entry-point"], "index.js")
|
159432
159432
|
);
|
159433
|
-
} else if (args.legacyAssets || config.legacy_assets) {
|
159433
|
+
} else if (args.legacyAssets || config.legacy_assets || args.experimentalAssets || config.experimental_assets) {
|
159434
159434
|
file = import_node_path16.default.resolve(getBasePath(), "templates/no-op-worker.js");
|
159435
|
-
} else if (args.experimentalAssets || config.experimental_assets) {
|
159436
|
-
file = import_node_path16.default.resolve(getBasePath(), "templates/no-op-assets-worker.ts");
|
159437
159435
|
} else {
|
159438
159436
|
throw new UserError(
|
159439
159437
|
`Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command2} path/to/script\`) or the \`main\` config field.`
|
@@ -159476,7 +159474,6 @@ ${migrateUrl}`
|
|
159476
159474
|
directory,
|
159477
159475
|
format: format10,
|
159478
159476
|
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path16.default.dirname(file),
|
159479
|
-
staticAssetsOnly: !!(args.experimentalAssets || config.experimental_assets) && !(args.script && config.main),
|
159480
159477
|
name: config.name ?? "worker"
|
159481
159478
|
};
|
159482
159479
|
}
|
@@ -162639,8 +162636,7 @@ function buildMiniflareBindingOptions(config) {
|
|
162639
162636
|
}
|
162640
162637
|
}
|
162641
162638
|
const serviceBindings = {
|
162642
|
-
...config.serviceBindings
|
162643
|
-
...config.experimentalAssets ? { ASSET_WORKER: "asset-worker" } : {}
|
162639
|
+
...config.serviceBindings
|
162644
162640
|
};
|
162645
162641
|
const notFoundServices = /* @__PURE__ */ new Set();
|
162646
162642
|
for (const service of config.services ?? []) {
|
@@ -162842,6 +162838,19 @@ function buildPersistOptions(localPersistencePath) {
|
|
162842
162838
|
}
|
162843
162839
|
}
|
162844
162840
|
__name(buildPersistOptions, "buildPersistOptions");
|
162841
|
+
function buildAssetOptions(config) {
|
162842
|
+
if (config.experimentalAssets) {
|
162843
|
+
return {
|
162844
|
+
assets: {
|
162845
|
+
workerName: config.name,
|
162846
|
+
path: config.experimentalAssets.directory,
|
162847
|
+
bindingName: config.experimentalAssets.binding,
|
162848
|
+
routingConfig: config.experimentalAssets.routingConfig
|
162849
|
+
}
|
162850
|
+
};
|
162851
|
+
}
|
162852
|
+
}
|
162853
|
+
__name(buildAssetOptions, "buildAssetOptions");
|
162845
162854
|
function buildSitesOptions({
|
162846
162855
|
legacyAssetPaths
|
162847
162856
|
}) {
|
@@ -162955,6 +162964,7 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
162955
162964
|
const { bindingOptions, internalObjects, externalWorkers } = buildMiniflareBindingOptions(config);
|
162956
162965
|
const sitesOptions = buildSitesOptions(config);
|
162957
162966
|
const persistOptions = buildPersistOptions(config.localPersistencePath);
|
162967
|
+
const assetOptions = buildAssetOptions(config);
|
162958
162968
|
const options29 = {
|
162959
162969
|
host: config.initialIp,
|
162960
162970
|
port: config.initialPort,
|
@@ -162974,6 +162984,7 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
162974
162984
|
...sourceOptions,
|
162975
162985
|
...bindingOptions,
|
162976
162986
|
...sitesOptions,
|
162987
|
+
...assetOptions,
|
162977
162988
|
// Allow each entrypoint to be accessed directly over `127.0.0.1:0`
|
162978
162989
|
unsafeDirectSockets: entrypointNames.map((name) => ({
|
162979
162990
|
host: "127.0.0.1",
|
@@ -162982,53 +162993,12 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
162982
162993
|
proxy: true
|
162983
162994
|
}))
|
162984
162995
|
},
|
162985
|
-
...getAssetServerWorker(config),
|
162986
162996
|
...externalWorkers
|
162987
162997
|
]
|
162988
162998
|
};
|
162989
162999
|
return { options: options29, internalObjects, entrypointNames };
|
162990
163000
|
}
|
162991
163001
|
__name(buildMiniflareOptions, "buildMiniflareOptions");
|
162992
|
-
function getAssetServerWorker(config) {
|
162993
|
-
if (!config.experimentalAssets) {
|
162994
|
-
return [];
|
162995
|
-
}
|
162996
|
-
const assetServerModulePath = require.resolve("@cloudflare/workers-shared/dist/asset-worker.mjs");
|
162997
|
-
const assetServerConfigPath = require.resolve("@cloudflare/workers-shared/dist/asset-worker.toml");
|
162998
|
-
let assetServerConfig;
|
162999
|
-
try {
|
163000
|
-
assetServerConfig = readConfig(assetServerConfigPath, {});
|
163001
|
-
} catch (err) {
|
163002
|
-
throw new UserError(
|
163003
|
-
`Failed to read the Asset Worker configuration file.
|
163004
|
-
${err}`
|
163005
|
-
);
|
163006
|
-
}
|
163007
|
-
return [
|
163008
|
-
{
|
163009
|
-
name: assetServerConfig?.name,
|
163010
|
-
compatibilityDate: assetServerConfig?.compatibility_date,
|
163011
|
-
compatibilityFlags: assetServerConfig?.compatibility_flags,
|
163012
|
-
modulesRoot: (0, import_node_path22.dirname)(assetServerModulePath),
|
163013
|
-
modules: [
|
163014
|
-
{
|
163015
|
-
type: "ESModule",
|
163016
|
-
path: assetServerModulePath
|
163017
|
-
}
|
163018
|
-
],
|
163019
|
-
unsafeDirectSockets: [
|
163020
|
-
{
|
163021
|
-
host: "127.0.0.1",
|
163022
|
-
port: 0
|
163023
|
-
}
|
163024
|
-
],
|
163025
|
-
assetsPath: config.experimentalAssets.directory,
|
163026
|
-
assetsKVBindingName: "ASSETS_KV_NAMESPACE",
|
163027
|
-
assetsManifestBindingName: "ASSETS_MANIFEST"
|
163028
|
-
}
|
163029
|
-
];
|
163030
|
-
}
|
163031
|
-
__name(getAssetServerWorker, "getAssetServerWorker");
|
163032
163002
|
var ReloadedEvent = class extends Event {
|
163033
163003
|
url;
|
163034
163004
|
internalDurableObjects;
|
@@ -163620,12 +163590,12 @@ function createWorkerUploadForm(worker) {
|
|
163620
163590
|
tail_consumers,
|
163621
163591
|
limits,
|
163622
163592
|
annotations,
|
163623
|
-
|
163593
|
+
experimental_assets
|
163624
163594
|
} = worker;
|
163625
|
-
if (
|
163595
|
+
if (experimental_assets && !experimental_assets.routingConfig.hasUserWorker) {
|
163626
163596
|
formData.set(
|
163627
163597
|
"metadata",
|
163628
|
-
JSON.stringify({ assets:
|
163598
|
+
JSON.stringify({ assets: experimental_assets.jwt })
|
163629
163599
|
);
|
163630
163600
|
return formData;
|
163631
163601
|
}
|
@@ -163918,7 +163888,7 @@ function createWorkerUploadForm(worker) {
|
|
163918
163888
|
...tail_consumers && { tail_consumers },
|
163919
163889
|
...limits && { limits },
|
163920
163890
|
...annotations && { annotations },
|
163921
|
-
...
|
163891
|
+
...experimental_assets && { assets: experimental_assets.jwt }
|
163922
163892
|
};
|
163923
163893
|
if (bindings.unsafe?.metadata !== void 0) {
|
163924
163894
|
for (const key of Object.keys(bindings.unsafe.metadata)) {
|
@@ -165236,6 +165206,7 @@ function getExperimentalAssetsBasePath(config, experimentalAssetsCommandLineArg)
|
|
165236
165206
|
__name(getExperimentalAssetsBasePath, "getExperimentalAssetsBasePath");
|
165237
165207
|
function processExperimentalAssetsArg(args, config) {
|
165238
165208
|
const experimentalAssets = args.experimentalAssets ? { directory: args.experimentalAssets } : config.experimental_assets;
|
165209
|
+
let experimentalAssetsOptions;
|
165239
165210
|
if (experimentalAssets) {
|
165240
165211
|
const experimentalAssetsBasePath = getExperimentalAssetsBasePath(
|
165241
165212
|
config,
|
@@ -165253,8 +165224,15 @@ ${resolvedExperimentalAssetsPath}`
|
|
165253
165224
|
);
|
165254
165225
|
}
|
165255
165226
|
experimentalAssets.directory = resolvedExperimentalAssetsPath;
|
165227
|
+
const routingConfig = {
|
165228
|
+
hasUserWorker: Boolean(args.script || config.main)
|
165229
|
+
};
|
165230
|
+
experimentalAssetsOptions = {
|
165231
|
+
...experimentalAssets,
|
165232
|
+
routingConfig
|
165233
|
+
};
|
165256
165234
|
}
|
165257
|
-
return
|
165235
|
+
return experimentalAssetsOptions;
|
165258
165236
|
}
|
165259
165237
|
__name(processExperimentalAssetsArg, "processExperimentalAssetsArg");
|
165260
165238
|
var encodeFilePath = /* @__PURE__ */ __name((filePath) => {
|
@@ -166799,6 +166777,96 @@ ${dashLink}`);
|
|
166799
166777
|
}
|
166800
166778
|
__name(triggersDeploy, "triggersDeploy");
|
166801
166779
|
|
166780
|
+
// src/versions/api.ts
|
166781
|
+
init_import_meta_url();
|
166782
|
+
async function fetchVersion(accountId, workerName, versionId, versionCache) {
|
166783
|
+
const cachedVersion = versionCache?.get(versionId);
|
166784
|
+
if (cachedVersion) {
|
166785
|
+
return cachedVersion;
|
166786
|
+
}
|
166787
|
+
const version3 = await fetchResult(
|
166788
|
+
`/accounts/${accountId}/workers/scripts/${workerName}/versions/${versionId}`
|
166789
|
+
);
|
166790
|
+
versionCache?.set(version3.id, version3);
|
166791
|
+
return version3;
|
166792
|
+
}
|
166793
|
+
__name(fetchVersion, "fetchVersion");
|
166794
|
+
async function fetchVersions(accountId, workerName, versionCache, ...versionIds) {
|
166795
|
+
return Promise.all(
|
166796
|
+
versionIds.map(
|
166797
|
+
(versionId) => fetchVersion(accountId, workerName, versionId, versionCache)
|
166798
|
+
)
|
166799
|
+
);
|
166800
|
+
}
|
166801
|
+
__name(fetchVersions, "fetchVersions");
|
166802
|
+
async function fetchLatestDeployments(accountId, workerName) {
|
166803
|
+
const { deployments: deployments2 } = await fetchResult(`/accounts/${accountId}/workers/scripts/${workerName}/deployments`);
|
166804
|
+
return deployments2;
|
166805
|
+
}
|
166806
|
+
__name(fetchLatestDeployments, "fetchLatestDeployments");
|
166807
|
+
async function fetchLatestDeployment(accountId, workerName) {
|
166808
|
+
const deployments2 = await fetchLatestDeployments(accountId, workerName);
|
166809
|
+
return deployments2.at(0);
|
166810
|
+
}
|
166811
|
+
__name(fetchLatestDeployment, "fetchLatestDeployment");
|
166812
|
+
async function fetchDeploymentVersions(accountId, workerName, deployment, versionCache) {
|
166813
|
+
if (!deployment) {
|
166814
|
+
return [[], /* @__PURE__ */ new Map()];
|
166815
|
+
}
|
166816
|
+
const versionTraffic = new Map(
|
166817
|
+
deployment.versions.map((v2) => [v2.version_id, v2.percentage])
|
166818
|
+
);
|
166819
|
+
const versions = await fetchVersions(
|
166820
|
+
accountId,
|
166821
|
+
workerName,
|
166822
|
+
versionCache,
|
166823
|
+
...versionTraffic.keys()
|
166824
|
+
);
|
166825
|
+
return [versions, versionTraffic];
|
166826
|
+
}
|
166827
|
+
__name(fetchDeploymentVersions, "fetchDeploymentVersions");
|
166828
|
+
async function fetchDeployableVersions(accountId, workerName, versionCache) {
|
166829
|
+
const { items: versions } = await fetchResult(
|
166830
|
+
`/accounts/${accountId}/workers/scripts/${workerName}/versions?deployable=true`
|
166831
|
+
);
|
166832
|
+
for (const version3 of versions) {
|
166833
|
+
versionCache.set(version3.id, version3);
|
166834
|
+
}
|
166835
|
+
return versions;
|
166836
|
+
}
|
166837
|
+
__name(fetchDeployableVersions, "fetchDeployableVersions");
|
166838
|
+
async function createDeployment(accountId, workerName, versionTraffic, message, force) {
|
166839
|
+
return await fetchResult(
|
166840
|
+
`/accounts/${accountId}/workers/scripts/${workerName}/deployments${force ? "?force=true" : ""}`,
|
166841
|
+
{
|
166842
|
+
method: "POST",
|
166843
|
+
headers: { "Content-Type": "application/json" },
|
166844
|
+
body: JSON.stringify({
|
166845
|
+
strategy: "percentage",
|
166846
|
+
versions: Array.from(versionTraffic).map(
|
166847
|
+
([version_id, percentage]) => ({ version_id, percentage })
|
166848
|
+
),
|
166849
|
+
annotations: {
|
166850
|
+
"workers/message": message
|
166851
|
+
}
|
166852
|
+
})
|
166853
|
+
}
|
166854
|
+
);
|
166855
|
+
}
|
166856
|
+
__name(createDeployment, "createDeployment");
|
166857
|
+
async function patchNonVersionedScriptSettings(accountId, workerName, settings) {
|
166858
|
+
const res = await fetchResult(
|
166859
|
+
`/accounts/${accountId}/workers/scripts/${workerName}/script-settings`,
|
166860
|
+
{
|
166861
|
+
method: "PATCH",
|
166862
|
+
headers: { "Content-Type": "application/json" },
|
166863
|
+
body: JSON.stringify(settings)
|
166864
|
+
}
|
166865
|
+
);
|
166866
|
+
return res;
|
166867
|
+
}
|
166868
|
+
__name(patchNonVersionedScriptSettings, "patchNonVersionedScriptSettings");
|
166869
|
+
|
166802
166870
|
// src/versions/deploy.ts
|
166803
166871
|
init_import_meta_url();
|
166804
166872
|
var import_assert2 = __toESM(require("assert"));
|
@@ -168554,96 +168622,6 @@ function collapseWhiteSpaceLines(input) {
|
|
168554
168622
|
}
|
168555
168623
|
__name(collapseWhiteSpaceLines, "collapseWhiteSpaceLines");
|
168556
168624
|
|
168557
|
-
// src/versions/api.ts
|
168558
|
-
init_import_meta_url();
|
168559
|
-
async function fetchVersion(accountId, workerName, versionId, versionCache) {
|
168560
|
-
const cachedVersion = versionCache?.get(versionId);
|
168561
|
-
if (cachedVersion) {
|
168562
|
-
return cachedVersion;
|
168563
|
-
}
|
168564
|
-
const version3 = await fetchResult(
|
168565
|
-
`/accounts/${accountId}/workers/scripts/${workerName}/versions/${versionId}`
|
168566
|
-
);
|
168567
|
-
versionCache?.set(version3.id, version3);
|
168568
|
-
return version3;
|
168569
|
-
}
|
168570
|
-
__name(fetchVersion, "fetchVersion");
|
168571
|
-
async function fetchVersions(accountId, workerName, versionCache, ...versionIds) {
|
168572
|
-
return Promise.all(
|
168573
|
-
versionIds.map(
|
168574
|
-
(versionId) => fetchVersion(accountId, workerName, versionId, versionCache)
|
168575
|
-
)
|
168576
|
-
);
|
168577
|
-
}
|
168578
|
-
__name(fetchVersions, "fetchVersions");
|
168579
|
-
async function fetchLatestDeployments(accountId, workerName) {
|
168580
|
-
const { deployments: deployments2 } = await fetchResult(`/accounts/${accountId}/workers/scripts/${workerName}/deployments`);
|
168581
|
-
return deployments2;
|
168582
|
-
}
|
168583
|
-
__name(fetchLatestDeployments, "fetchLatestDeployments");
|
168584
|
-
async function fetchLatestDeployment(accountId, workerName) {
|
168585
|
-
const deployments2 = await fetchLatestDeployments(accountId, workerName);
|
168586
|
-
return deployments2.at(0);
|
168587
|
-
}
|
168588
|
-
__name(fetchLatestDeployment, "fetchLatestDeployment");
|
168589
|
-
async function fetchDeploymentVersions(accountId, workerName, deployment, versionCache) {
|
168590
|
-
if (!deployment) {
|
168591
|
-
return [[], /* @__PURE__ */ new Map()];
|
168592
|
-
}
|
168593
|
-
const versionTraffic = new Map(
|
168594
|
-
deployment.versions.map((v2) => [v2.version_id, v2.percentage])
|
168595
|
-
);
|
168596
|
-
const versions = await fetchVersions(
|
168597
|
-
accountId,
|
168598
|
-
workerName,
|
168599
|
-
versionCache,
|
168600
|
-
...versionTraffic.keys()
|
168601
|
-
);
|
168602
|
-
return [versions, versionTraffic];
|
168603
|
-
}
|
168604
|
-
__name(fetchDeploymentVersions, "fetchDeploymentVersions");
|
168605
|
-
async function fetchDeployableVersions(accountId, workerName, versionCache) {
|
168606
|
-
const { items: versions } = await fetchResult(
|
168607
|
-
`/accounts/${accountId}/workers/scripts/${workerName}/versions?deployable=true`
|
168608
|
-
);
|
168609
|
-
for (const version3 of versions) {
|
168610
|
-
versionCache.set(version3.id, version3);
|
168611
|
-
}
|
168612
|
-
return versions;
|
168613
|
-
}
|
168614
|
-
__name(fetchDeployableVersions, "fetchDeployableVersions");
|
168615
|
-
async function createDeployment(accountId, workerName, versionTraffic, message, force) {
|
168616
|
-
return await fetchResult(
|
168617
|
-
`/accounts/${accountId}/workers/scripts/${workerName}/deployments${force ? "?force=true" : ""}`,
|
168618
|
-
{
|
168619
|
-
method: "POST",
|
168620
|
-
headers: { "Content-Type": "application/json" },
|
168621
|
-
body: JSON.stringify({
|
168622
|
-
strategy: "percentage",
|
168623
|
-
versions: Array.from(versionTraffic).map(
|
168624
|
-
([version_id, percentage]) => ({ version_id, percentage })
|
168625
|
-
),
|
168626
|
-
annotations: {
|
168627
|
-
"workers/message": message
|
168628
|
-
}
|
168629
|
-
})
|
168630
|
-
}
|
168631
|
-
);
|
168632
|
-
}
|
168633
|
-
__name(createDeployment, "createDeployment");
|
168634
|
-
async function patchNonVersionedScriptSettings(accountId, workerName, settings) {
|
168635
|
-
const res = await fetchResult(
|
168636
|
-
`/accounts/${accountId}/workers/scripts/${workerName}/script-settings`,
|
168637
|
-
{
|
168638
|
-
method: "PATCH",
|
168639
|
-
headers: { "Content-Type": "application/json" },
|
168640
|
-
body: JSON.stringify(settings)
|
168641
|
-
}
|
168642
|
-
);
|
168643
|
-
return res;
|
168644
|
-
}
|
168645
|
-
__name(patchNonVersionedScriptSettings, "patchNonVersionedScriptSettings");
|
168646
|
-
|
168647
168625
|
// src/versions/deploy.ts
|
168648
168626
|
var EPSILON = 1e-3;
|
168649
168627
|
var BLANK_INPUT = "-";
|
@@ -169478,11 +169456,14 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169478
169456
|
legacyEnv: props.legacyEnv,
|
169479
169457
|
env: props.env
|
169480
169458
|
}) : void 0;
|
169481
|
-
const
|
169482
|
-
|
169483
|
-
|
169484
|
-
|
169485
|
-
|
169459
|
+
const experimentalAssetsOptions = props.experimentalAssetsOptions && !props.dryRun ? {
|
169460
|
+
routingConfig: props.experimentalAssetsOptions?.routingConfig,
|
169461
|
+
jwt: await syncExperimentalAssets(
|
169462
|
+
accountId,
|
169463
|
+
scriptName,
|
169464
|
+
props.experimentalAssetsOptions.directory
|
169465
|
+
)
|
169466
|
+
} : void 0;
|
169486
169467
|
const legacyAssets = await syncLegacyAssets(
|
169487
169468
|
accountId,
|
169488
169469
|
// When we're using the newer service environments, we wouldn't
|
@@ -169564,7 +169545,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169564
169545
|
placement,
|
169565
169546
|
tail_consumers: config.tail_consumers,
|
169566
169547
|
limits: config.limits,
|
169567
|
-
|
169548
|
+
experimental_assets: experimentalAssetsOptions
|
169568
169549
|
};
|
169569
169550
|
sourceMapSize = worker.sourceMaps?.reduce(
|
169570
169551
|
(acc, m2) => acc + m2.content.length,
|
@@ -169589,6 +169570,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169589
169570
|
if (props.dryRun) {
|
169590
169571
|
printBindings({ ...withoutStaticAssets, vars: maskedVars });
|
169591
169572
|
} else {
|
169573
|
+
(0, import_node_assert16.default)(accountId, "Missing accountId");
|
169592
169574
|
await ensureQueuesExistByConfig(config);
|
169593
169575
|
let bindingsPrinted = false;
|
169594
169576
|
try {
|
@@ -169618,6 +169600,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169618
169600
|
headers: await getMetricsUsageHeaders(config.send_metrics)
|
169619
169601
|
}
|
169620
169602
|
);
|
169603
|
+
await patchNonVersionedScriptSettings(accountId, scriptName, {
|
169604
|
+
tail_consumers: worker.tail_consumers,
|
169605
|
+
logpush: worker.logpush
|
169606
|
+
});
|
169621
169607
|
const { available_on_subdomain } = await fetchResult(`/accounts/${accountId}/workers/scripts/${scriptName}/subdomain`);
|
169622
169608
|
result = {
|
169623
169609
|
available_on_subdomain,
|
@@ -169714,7 +169700,6 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169714
169700
|
logger.log(`--dry-run: exiting now.`);
|
169715
169701
|
return { versionId, workerTag };
|
169716
169702
|
}
|
169717
|
-
(0, import_node_assert16.default)(accountId, "Missing accountId");
|
169718
169703
|
const uploadMs = Date.now() - start;
|
169719
169704
|
logger.log("Uploaded", workerName, formatTime2(uploadMs));
|
169720
169705
|
if (props.dispatchNamespace !== void 0) {
|
@@ -171117,7 +171102,7 @@ async function createRemoteWorkerInit(props) {
|
|
171117
171102
|
// no tail consumers in dev - TODO revisit?
|
171118
171103
|
limits: void 0,
|
171119
171104
|
// no limits in preview - not supported yet but can be added
|
171120
|
-
|
171105
|
+
experimental_assets: void 0
|
171121
171106
|
// no remote mode for assets
|
171122
171107
|
};
|
171123
171108
|
return init3;
|
@@ -185080,7 +185065,7 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
185080
185065
|
"The --assets argument is experimental and may change or break at any time"
|
185081
185066
|
);
|
185082
185067
|
}
|
185083
|
-
const
|
185068
|
+
const experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
185084
185069
|
if (args.latest) {
|
185085
185070
|
logger.warn(
|
185086
185071
|
"Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml.\n"
|
@@ -185118,7 +185103,7 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
185118
185103
|
jsxFragment: args.jsxFragment,
|
185119
185104
|
tsconfig: args.tsconfig,
|
185120
185105
|
routes: args.routes,
|
185121
|
-
|
185106
|
+
experimentalAssetsOptions,
|
185122
185107
|
legacyAssetPaths,
|
185123
185108
|
legacyEnv: isLegacyEnv(config),
|
185124
185109
|
minify: args.minify,
|
@@ -188435,7 +188420,7 @@ function createWorkerBundleFormData(workerBundle, config) {
|
|
188435
188420
|
placement,
|
188436
188421
|
tail_consumers: void 0,
|
188437
188422
|
limits: config?.limits,
|
188438
|
-
|
188423
|
+
experimental_assets: void 0
|
188439
188424
|
};
|
188440
188425
|
return createWorkerUploadForm(worker);
|
188441
188426
|
}
|
@@ -195328,7 +195313,7 @@ async function createDraftWorker({
|
|
195328
195313
|
placement: void 0,
|
195329
195314
|
tail_consumers: void 0,
|
195330
195315
|
limits: void 0,
|
195331
|
-
|
195316
|
+
experimental_assets: void 0
|
195332
195317
|
})
|
195333
195318
|
}
|
195334
195319
|
);
|
@@ -207007,7 +206992,7 @@ async function copyWorkerVersionWithNewSecrets({
|
|
207007
206992
|
"workers/message": versionMessage,
|
207008
206993
|
"workers/tag": versionTag
|
207009
206994
|
},
|
207010
|
-
|
206995
|
+
experimental_assets: void 0
|
207011
206996
|
};
|
207012
206997
|
const body = createWorkerUploadForm(worker);
|
207013
206998
|
const result = await fetchResult(
|
@@ -207298,11 +207283,14 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207298
207283
|
legacyEnv: props.legacyEnv,
|
207299
207284
|
env: props.env
|
207300
207285
|
}) : void 0;
|
207301
|
-
const
|
207302
|
-
|
207303
|
-
|
207304
|
-
|
207305
|
-
|
207286
|
+
const experimentalAssetsOptions = props.experimentalAssetsOptions && !props.dryRun ? {
|
207287
|
+
routingConfig: props.experimentalAssetsOptions?.routingConfig,
|
207288
|
+
jwt: await syncExperimentalAssets(
|
207289
|
+
accountId,
|
207290
|
+
scriptName,
|
207291
|
+
props.experimentalAssetsOptions.directory
|
207292
|
+
)
|
207293
|
+
} : void 0;
|
207306
207294
|
const bindings = {
|
207307
207295
|
kv_namespaces: config.kv_namespaces || [],
|
207308
207296
|
send_email: config.send_email,
|
@@ -207362,7 +207350,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207362
207350
|
"workers/message": props.message,
|
207363
207351
|
"workers/tag": props.tag
|
207364
207352
|
},
|
207365
|
-
|
207353
|
+
experimental_assets: experimentalAssetsOptions
|
207366
207354
|
};
|
207367
207355
|
await printBundleSize(
|
207368
207356
|
{ name: import_node_path61.default.basename(resolvedEntryPointPath), content },
|
@@ -207830,7 +207818,7 @@ async function versionsUploadHandler(args) {
|
|
207830
207818
|
"Legacy Assets does not support uploading versions through `wrangler versions upload`. You must use `wrangler deploy` instead."
|
207831
207819
|
);
|
207832
207820
|
}
|
207833
|
-
const
|
207821
|
+
const experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
207834
207822
|
if (args.latest) {
|
207835
207823
|
logger.warn(
|
207836
207824
|
"Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml.\n"
|
@@ -207858,7 +207846,7 @@ async function versionsUploadHandler(args) {
|
|
207858
207846
|
jsxFactory: args.jsxFactory,
|
207859
207847
|
jsxFragment: args.jsxFragment,
|
207860
207848
|
tsconfig: args.tsconfig,
|
207861
|
-
|
207849
|
+
experimentalAssetsOptions,
|
207862
207850
|
minify: args.minify,
|
207863
207851
|
uploadSourceMaps: args.uploadSourceMaps,
|
207864
207852
|
nodeCompat: args.nodeCompat,
|
@@ -209303,7 +209291,8 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
209303
209291
|
throw new UserError("Cannot use both --assets and --legacy-assets.");
|
209304
209292
|
}
|
209305
209293
|
args.legacyAssets = args.legacyAssets ?? args.assets;
|
209306
|
-
let
|
209294
|
+
let configFileWatcher;
|
209295
|
+
let assetsWatcher;
|
209307
209296
|
try {
|
209308
209297
|
const devInstance = await run(
|
209309
209298
|
{
|
@@ -209318,12 +209307,16 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
209318
209307
|
await import_node_events3.default.once(devInstance, "teardown");
|
209319
209308
|
} else {
|
209320
209309
|
(0, import_node_assert22.default)(!(devInstance instanceof DevEnv));
|
209321
|
-
|
209310
|
+
configFileWatcher = devInstance.configFileWatcher;
|
209311
|
+
assetsWatcher = devInstance.assetsWatcher;
|
209322
209312
|
const { waitUntilExit } = devInstance.devReactElement;
|
209323
209313
|
await waitUntilExit();
|
209324
209314
|
}
|
209325
209315
|
} finally {
|
209326
|
-
await
|
209316
|
+
await Promise.allSettled([
|
209317
|
+
configFileWatcher?.close(),
|
209318
|
+
assetsWatcher?.close()
|
209319
|
+
]);
|
209327
209320
|
}
|
209328
209321
|
}
|
209329
209322
|
__name(devHandler, "devHandler");
|
@@ -209380,7 +209373,8 @@ async function getPagesAssetsFetcher(options29) {
|
|
209380
209373
|
}
|
209381
209374
|
__name(getPagesAssetsFetcher, "getPagesAssetsFetcher");
|
209382
209375
|
async function startDev(args) {
|
209383
|
-
let
|
209376
|
+
let configFileWatcher;
|
209377
|
+
let assetsWatcher;
|
209384
209378
|
let rerender;
|
209385
209379
|
try {
|
209386
209380
|
const configPath = args.config || args.script && findWranglerToml(import_node_path63.default.dirname(args.script));
|
@@ -209415,11 +209409,11 @@ Move any existing data to .wrangler/state and use --persist, or
|
|
209415
209409
|
use --persist-to=./wrangler-local-state to keep using the old path.`
|
209416
209410
|
);
|
209417
209411
|
}
|
209418
|
-
|
209419
|
-
if (
|
209412
|
+
let experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
209413
|
+
if (experimentalAssetsOptions) {
|
209420
209414
|
args.forceLocal = true;
|
209421
209415
|
}
|
209422
|
-
if ((args.legacyAssets || config.legacy_assets) &&
|
209416
|
+
if ((args.legacyAssets || config.legacy_assets) && experimentalAssetsOptions) {
|
209423
209417
|
throw new UserError(
|
209424
209418
|
"Cannot use Legacy Assets and Experimental Assets in the same Worker."
|
209425
209419
|
);
|
@@ -209581,7 +209575,10 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
209581
209575
|
enableServiceEnvironments: !(args.legacyEnv ?? true)
|
209582
209576
|
},
|
209583
209577
|
experimental: {
|
209584
|
-
|
209578
|
+
// only pass `experimentalAssetsOptions` if it came from args not from config
|
209579
|
+
// otherwise config at startup ends up overriding future config changes in the
|
209580
|
+
// ConfigController
|
209581
|
+
assets: args.experimentalAssets ? experimentalAssetsOptions : void 0
|
209585
209582
|
}
|
209586
209583
|
});
|
209587
209584
|
void sendMetricsEvent(
|
@@ -209600,13 +209597,35 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
209600
209597
|
return devEnv;
|
209601
209598
|
}
|
209602
209599
|
if (config.configPath && !args.experimentalDevEnv) {
|
209603
|
-
|
209600
|
+
configFileWatcher = (0, import_chokidar6.watch)(config.configPath, {
|
209604
209601
|
persistent: true
|
209605
209602
|
}).on("change", async (_event) => {
|
209606
|
-
|
209607
|
-
|
209603
|
+
try {
|
209604
|
+
config = readConfig(configPath, args);
|
209605
|
+
if (!config.configPath) {
|
209606
|
+
return;
|
209607
|
+
}
|
209608
209608
|
logger.log(`${import_node_path63.default.basename(config.configPath)} changed...`);
|
209609
|
+
if (experimentalAssetsOptions && !args.experimentalAssets) {
|
209610
|
+
await assetsWatcher?.close();
|
209611
|
+
experimentalAssetsOptions = processExperimentalAssetsArg(
|
209612
|
+
args,
|
209613
|
+
config
|
209614
|
+
);
|
209615
|
+
if (experimentalAssetsOptions) {
|
209616
|
+
assetsWatcher = (0, import_chokidar6.watch)(experimentalAssetsOptions.directory, {
|
209617
|
+
persistent: true,
|
209618
|
+
ignoreInitial: true
|
209619
|
+
}).on("all", async (eventName, changedPath) => {
|
209620
|
+
const message = getAssetChangeMessage(eventName, changedPath);
|
209621
|
+
logger.log(`\u{1F300} ${message}...`);
|
209622
|
+
rerender(await getDevReactElement(config));
|
209623
|
+
});
|
209624
|
+
}
|
209625
|
+
}
|
209609
209626
|
rerender(await getDevReactElement(config));
|
209627
|
+
} catch (err) {
|
209628
|
+
logger.error(err);
|
209610
209629
|
}
|
209611
209630
|
});
|
209612
209631
|
}
|
@@ -209677,7 +209696,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
209677
209696
|
accountId: args.accountId ?? configParam.account_id ?? getAccountFromCache()?.id,
|
209678
209697
|
legacyAssetPaths,
|
209679
209698
|
legacyAssetsConfig: configParam.legacy_assets,
|
209680
|
-
experimentalAssets,
|
209699
|
+
experimentalAssets: experimentalAssetsOptions,
|
209681
209700
|
initialPort: args.port ?? configParam.dev.port ?? await getLocalPort2(),
|
209682
209701
|
initialIp: args.ip || configParam.dev.ip,
|
209683
209702
|
inspectorPort: args.inspectorPort ?? configParam.dev.inspector_port ?? await getInspectorPort2(),
|
@@ -209710,16 +209729,33 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
209710
209729
|
__name(getDevReactElement, "getDevReactElement");
|
209711
209730
|
const devReactElement = (0, import_ink13.render)(await getDevReactElement(config));
|
209712
209731
|
rerender = devReactElement.rerender;
|
209732
|
+
if (experimentalAssetsOptions && !args.experimentalDevEnv) {
|
209733
|
+
assetsWatcher = (0, import_chokidar6.watch)(experimentalAssetsOptions.directory, {
|
209734
|
+
persistent: true,
|
209735
|
+
ignoreInitial: true
|
209736
|
+
}).on("all", async (eventName, filePath) => {
|
209737
|
+
const message = getAssetChangeMessage(eventName, filePath);
|
209738
|
+
logger.log(`\u{1F300} ${message}...`);
|
209739
|
+
rerender(await getDevReactElement(config));
|
209740
|
+
});
|
209741
|
+
}
|
209713
209742
|
return {
|
209714
209743
|
devReactElement,
|
209715
|
-
|
209744
|
+
configFileWatcher,
|
209745
|
+
assetsWatcher,
|
209716
209746
|
stop: async () => {
|
209717
209747
|
devReactElement.unmount();
|
209718
|
-
await
|
209748
|
+
await Promise.allSettled([
|
209749
|
+
configFileWatcher?.close(),
|
209750
|
+
assetsWatcher?.close()
|
209751
|
+
]);
|
209719
209752
|
}
|
209720
209753
|
};
|
209721
209754
|
} catch (e3) {
|
209722
|
-
await
|
209755
|
+
await Promise.allSettled([
|
209756
|
+
configFileWatcher?.close(),
|
209757
|
+
assetsWatcher?.close()
|
209758
|
+
]);
|
209723
209759
|
throw e3;
|
209724
209760
|
}
|
209725
209761
|
}
|
@@ -210150,6 +210186,25 @@ function getBindings(configParam, env7, local, args) {
|
|
210150
210186
|
return bindings;
|
210151
210187
|
}
|
210152
210188
|
__name(getBindings, "getBindings");
|
210189
|
+
function getAssetChangeMessage(eventName, assetPath) {
|
210190
|
+
let message = `${assetPath} changed`;
|
210191
|
+
switch (eventName) {
|
210192
|
+
case "add":
|
210193
|
+
message = `File ${assetPath} was added`;
|
210194
|
+
break;
|
210195
|
+
case "addDir":
|
210196
|
+
message = `Directory ${assetPath} was added`;
|
210197
|
+
break;
|
210198
|
+
case "unlink":
|
210199
|
+
message = `File ${assetPath} was removed`;
|
210200
|
+
break;
|
210201
|
+
case "unlinkDir":
|
210202
|
+
message = `Directory ${assetPath} was removed`;
|
210203
|
+
break;
|
210204
|
+
}
|
210205
|
+
return message;
|
210206
|
+
}
|
210207
|
+
__name(getAssetChangeMessage, "getAssetChangeMessage");
|
210153
210208
|
|
210154
210209
|
// src/api/dev.ts
|
210155
210210
|
async function unstable_dev(script, options29, apiOptions) {
|
@@ -210764,6 +210819,13 @@ async function resolveConfig(config, input) {
|
|
210764
210819
|
);
|
210765
210820
|
const nodejsCompatMode = unwrapHook(input.build?.nodejsCompatMode, config);
|
210766
210821
|
const { bindings, unsafe } = await resolveBindings(config, input);
|
210822
|
+
const experimentalAssetsOptions = processExperimentalAssetsArg(
|
210823
|
+
{
|
210824
|
+
experimentalAssets: input?.experimental?.assets?.directory,
|
210825
|
+
script: input.entrypoint
|
210826
|
+
},
|
210827
|
+
config
|
210828
|
+
);
|
210767
210829
|
const resolved = {
|
210768
210830
|
name: getScriptName({ name: input.name, env: input.env }, config),
|
210769
210831
|
compatibilityDate: getDevCompatibilityDate(config, input.compatibilityDate),
|
@@ -210805,7 +210867,7 @@ async function resolveConfig(config, input) {
|
|
210805
210867
|
metadata: input.unsafe?.metadata ?? unsafe?.metadata
|
210806
210868
|
},
|
210807
210869
|
experimental: {
|
210808
|
-
assets:
|
210870
|
+
assets: experimentalAssetsOptions
|
210809
210871
|
}
|
210810
210872
|
};
|
210811
210873
|
if (resolved.legacy.legacyAssets && resolved.legacy.site) {
|
@@ -210839,12 +210901,14 @@ var ConfigController = class extends Controller {
|
|
210839
210901
|
latestInput;
|
210840
210902
|
latestConfig;
|
210841
210903
|
#configWatcher;
|
210904
|
+
#assetsWatcher;
|
210842
210905
|
#abortController;
|
210843
210906
|
async #ensureWatchingConfig(configPath) {
|
210844
210907
|
await this.#configWatcher?.close();
|
210845
210908
|
if (configPath) {
|
210846
210909
|
this.#configWatcher = (0, import_chokidar8.watch)(configPath, {
|
210847
|
-
persistent: true
|
210910
|
+
persistent: true,
|
210911
|
+
ignoreInitial: true
|
210848
210912
|
}).on("change", async (_event) => {
|
210849
210913
|
logger.log(`${import_node_path64.default.basename(configPath)} changed...`);
|
210850
210914
|
(0, import_node_assert23.default)(
|
@@ -210855,6 +210919,23 @@ var ConfigController = class extends Controller {
|
|
210855
210919
|
});
|
210856
210920
|
}
|
210857
210921
|
}
|
210922
|
+
async #ensureWatchingAssets(assetsPath) {
|
210923
|
+
await this.#assetsWatcher?.close();
|
210924
|
+
if (assetsPath) {
|
210925
|
+
this.#assetsWatcher = (0, import_chokidar8.watch)(assetsPath, {
|
210926
|
+
persistent: true,
|
210927
|
+
ignoreInitial: true
|
210928
|
+
}).on("all", async (eventName, filePath) => {
|
210929
|
+
const message = getAssetChangeMessage(eventName, filePath);
|
210930
|
+
logger.log(`\u{1F300} ${message}...`);
|
210931
|
+
(0, import_node_assert23.default)(
|
210932
|
+
this.latestInput,
|
210933
|
+
"Cannot be watching config without having first set an input"
|
210934
|
+
);
|
210935
|
+
void this.#updateConfig(this.latestInput);
|
210936
|
+
});
|
210937
|
+
}
|
210938
|
+
}
|
210858
210939
|
set(input) {
|
210859
210940
|
return this.#updateConfig(input);
|
210860
210941
|
}
|
@@ -210874,29 +210955,43 @@ var ConfigController = class extends Controller {
|
|
210874
210955
|
this.#abortController = new AbortController();
|
210875
210956
|
const signal = this.#abortController.signal;
|
210876
210957
|
this.latestInput = input;
|
210877
|
-
|
210878
|
-
|
210879
|
-
|
210880
|
-
|
210881
|
-
|
210882
|
-
|
210883
|
-
|
210884
|
-
|
210885
|
-
|
210886
|
-
|
210887
|
-
|
210888
|
-
|
210958
|
+
try {
|
210959
|
+
const fileConfig = readConfig(input.config, {
|
210960
|
+
env: input.env,
|
210961
|
+
"dispatch-namespace": void 0,
|
210962
|
+
"legacy-env": !input.legacy?.enableServiceEnvironments,
|
210963
|
+
remote: input.dev?.remote,
|
210964
|
+
upstreamProtocol: input.dev?.origin?.secure === void 0 ? void 0 : input.dev?.origin?.secure ? "https" : "http",
|
210965
|
+
localProtocol: input.dev?.server?.secure === void 0 ? void 0 : input.dev?.server?.secure ? "https" : "http"
|
210966
|
+
});
|
210967
|
+
void this.#ensureWatchingConfig(fileConfig.configPath);
|
210968
|
+
const experimentalAssets = processExperimentalAssetsArg(
|
210969
|
+
{ experimentalAssets: input.experimental?.assets?.directory },
|
210970
|
+
fileConfig
|
210971
|
+
);
|
210972
|
+
if (experimentalAssets) {
|
210973
|
+
void this.#ensureWatchingAssets(experimentalAssets.directory);
|
210974
|
+
}
|
210975
|
+
const resolvedConfig = await resolveConfig(fileConfig, input);
|
210976
|
+
if (signal.aborted) {
|
210977
|
+
return;
|
210978
|
+
}
|
210979
|
+
this.latestConfig = resolvedConfig;
|
210980
|
+
this.emitConfigUpdateEvent(resolvedConfig);
|
210981
|
+
return this.latestConfig;
|
210982
|
+
} catch (err) {
|
210983
|
+
logger.error(err);
|
210889
210984
|
}
|
210890
|
-
this.latestConfig = resolvedConfig;
|
210891
|
-
this.emitConfigUpdateEvent(resolvedConfig);
|
210892
|
-
return this.latestConfig;
|
210893
210985
|
}
|
210894
210986
|
// ******************
|
210895
210987
|
// Event Handlers
|
210896
210988
|
// ******************
|
210897
210989
|
async teardown() {
|
210898
210990
|
logger.debug("ConfigController teardown beginning...");
|
210899
|
-
await
|
210991
|
+
await Promise.allSettled([
|
210992
|
+
this.#configWatcher?.close(),
|
210993
|
+
this.#assetsWatcher?.close()
|
210994
|
+
]);
|
210900
210995
|
logger.debug("ConfigController teardown complete");
|
210901
210996
|
}
|
210902
210997
|
// *********************
|
@@ -212921,4 +213016,3 @@ yargs-parser/build/lib/index.js:
|
|
212921
213016
|
* SPDX-License-Identifier: ISC
|
212922
213017
|
*)
|
212923
213018
|
*/
|
212924
|
-
//# sourceMappingURL=cli.js.map
|