wrangler 4.151.2 → 4.151.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.151.
|
|
3
|
+
"version": "4.151.3",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assembly",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"unenv": "2.0.0-rc.24",
|
|
74
74
|
"workerd": "1.20261019.1",
|
|
75
75
|
"@cloudflare/kv-asset-handler": "0.5.0",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
76
|
+
"@cloudflare/unenv-preset": "2.16.2",
|
|
77
|
+
"miniflare": "5.20261019.1-beta"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@types/supports-color": "^8.1.1",
|
|
102
102
|
"@types/ws": "^8.5.7",
|
|
103
103
|
"@types/yargs": "^17.0.22",
|
|
104
|
-
"@vitest/ui": "
|
|
104
|
+
"@vitest/ui": "5.0.4",
|
|
105
105
|
"@webcontainer/env": "^1.1.0",
|
|
106
106
|
"am-i-vibing": "^0.5.0",
|
|
107
107
|
"capnweb": "0.12.0",
|
|
@@ -154,29 +154,29 @@
|
|
|
154
154
|
"tsup": "8.3.0",
|
|
155
155
|
"typescript": "5.8.3",
|
|
156
156
|
"undici": "7.29.1",
|
|
157
|
-
"vitest": "
|
|
157
|
+
"vitest": "5.0.4",
|
|
158
158
|
"vitest-websocket-mock": "^0.4.0",
|
|
159
159
|
"ws": "8.21.0",
|
|
160
160
|
"xxhash-wasm": "^1.0.1",
|
|
161
161
|
"yaml": "^2.8.1",
|
|
162
162
|
"yargs": "^17.7.2",
|
|
163
163
|
"zod": "4.6.5",
|
|
164
|
-
"@cloudflare/autoconfig": "0.7.
|
|
164
|
+
"@cloudflare/autoconfig": "0.7.11",
|
|
165
165
|
"@cloudflare/build-output-utils": "0.9.3",
|
|
166
|
-
"@cloudflare/cli-shared-helpers": "0.2.
|
|
166
|
+
"@cloudflare/cli-shared-helpers": "0.2.7",
|
|
167
167
|
"@cloudflare/config": "0.27.0",
|
|
168
|
-
"@cloudflare/containers-shared": "0.23.
|
|
169
|
-
"@cloudflare/deploy-helpers": "0.22.
|
|
170
|
-
"@cloudflare/pages-shared": "^0.13.199",
|
|
171
|
-
"@cloudflare/runtime-types": "0.1.13",
|
|
172
|
-
"@cloudflare/shared-ast-primitives": "1.1.0",
|
|
173
|
-
"@cloudflare/workers-auth": "0.14.0",
|
|
168
|
+
"@cloudflare/containers-shared": "0.23.1",
|
|
169
|
+
"@cloudflare/deploy-helpers": "0.22.1",
|
|
174
170
|
"@cloudflare/pages-functions": "0.1.1",
|
|
175
|
-
"@cloudflare/
|
|
176
|
-
"@cloudflare/
|
|
171
|
+
"@cloudflare/pages-shared": "^0.13.200",
|
|
172
|
+
"@cloudflare/remote-bindings": "0.0.51",
|
|
173
|
+
"@cloudflare/runtime-types": "0.1.14",
|
|
174
|
+
"@cloudflare/shared-ast-primitives": "1.1.0",
|
|
175
|
+
"@cloudflare/workers-auth": "0.14.1",
|
|
177
176
|
"@cloudflare/workers-shared": "0.20.1",
|
|
178
|
-
"@cloudflare/workers-
|
|
179
|
-
"@cloudflare/workflows-shared": "0.15.
|
|
177
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
178
|
+
"@cloudflare/workflows-shared": "0.15.2",
|
|
179
|
+
"@cloudflare/workers-utils": "0.47.3"
|
|
180
180
|
},
|
|
181
181
|
"peerDependencies": {
|
|
182
182
|
"@cloudflare/workers-types": "^5.20261019.1"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference path="middleware-patch-console-prefix.d.ts"/>
|
|
2
2
|
|
|
3
3
|
import { prefix } from "config:middleware/patch-console-prefix";
|
|
4
|
-
import type { Middleware } from "./common";
|
|
5
4
|
|
|
6
5
|
// Directly patch console methods to add worker prefix.
|
|
7
6
|
// We capture the original method once and replace with a wrapper.
|
|
@@ -13,9 +12,3 @@ import type { Middleware } from "./common";
|
|
|
13
12
|
},
|
|
14
13
|
});
|
|
15
14
|
});
|
|
16
|
-
|
|
17
|
-
const passthrough: Middleware = (request, env, _ctx, middlewareCtx) => {
|
|
18
|
-
return middlewareCtx.next(request, env);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default passthrough;
|
|
@@ -71,6 +71,11 @@ var ProxyWorker = class {
|
|
|
71
71
|
if (isRequestFromProxyController(request, this.env)) {
|
|
72
72
|
return this.processProxyControllerRequest(request);
|
|
73
73
|
}
|
|
74
|
+
if (this.env.UNSUPPORTED_RUNTIME_MESSAGE) {
|
|
75
|
+
return new Response(this.env.UNSUPPORTED_RUNTIME_MESSAGE, {
|
|
76
|
+
status: 503
|
|
77
|
+
});
|
|
78
|
+
}
|
|
74
79
|
const deferred = createDeferred();
|
|
75
80
|
this.requestQueue.set(request, deferred);
|
|
76
81
|
this.processQueue();
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1002,6 +1002,12 @@ type TestHarness = {
|
|
|
1002
1002
|
* await server.fetch("http://example.com/api/data");
|
|
1003
1003
|
* // Dispatches a request to the API Worker with URL "http://example.com/api/data"
|
|
1004
1004
|
* ```
|
|
1005
|
+
*
|
|
1006
|
+
* Under Bun, this method, `server.getWorker()`'s `fetch()`, `email()` and
|
|
1007
|
+
* `scheduled()`, and the URL returned by `listen()` cannot reach the Worker,
|
|
1008
|
+
* because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes
|
|
1009
|
+
* requests through. The methods throw a `UserError` and the URL answers with a
|
|
1010
|
+
* 503. `server.getWorker().getEnv()` and `getExport()` keep working under Bun.
|
|
1005
1011
|
*/
|
|
1006
1012
|
fetch: DispatchFetch;
|
|
1007
1013
|
/**
|
package/wrangler-dist/cli.js
CHANGED
|
@@ -67674,7 +67674,7 @@ var name, version2;
|
|
|
67674
67674
|
var init_package = __esm({
|
|
67675
67675
|
"package.json"() {
|
|
67676
67676
|
name = "wrangler";
|
|
67677
|
-
version2 = "4.151.
|
|
67677
|
+
version2 = "4.151.3";
|
|
67678
67678
|
}
|
|
67679
67679
|
});
|
|
67680
67680
|
|
|
@@ -179910,14 +179910,29 @@ function getRemoteConfigDiff(remoteConfig, localResolvedConfig) {
|
|
|
179910
179910
|
normalizedLocalConfig
|
|
179911
179911
|
);
|
|
179912
179912
|
const diff = diffJsonObjects(
|
|
179913
|
-
|
|
179914
|
-
|
|
179913
|
+
omitUndefinedProperties(
|
|
179914
|
+
normalizedRemoteConfig
|
|
179915
|
+
),
|
|
179916
|
+
omitUndefinedProperties(
|
|
179917
|
+
normalizedLocalConfig
|
|
179918
|
+
)
|
|
179915
179919
|
);
|
|
179916
179920
|
return {
|
|
179917
179921
|
diff,
|
|
179918
179922
|
nonDestructive: isNonDestructive(diff)
|
|
179919
179923
|
};
|
|
179920
179924
|
}
|
|
179925
|
+
function omitUndefinedProperties(value) {
|
|
179926
|
+
if (Array.isArray(value)) {
|
|
179927
|
+
return value.map(omitUndefinedProperties);
|
|
179928
|
+
}
|
|
179929
|
+
if (value === null || typeof value !== "object") {
|
|
179930
|
+
return value;
|
|
179931
|
+
}
|
|
179932
|
+
return Object.fromEntries(
|
|
179933
|
+
Object.entries(value).filter(([, fieldValue]) => fieldValue !== void 0).map(([key, fieldValue]) => [key, omitUndefinedProperties(fieldValue)])
|
|
179934
|
+
);
|
|
179935
|
+
}
|
|
179921
179936
|
function normalizeLocalResolvedConfigAsRemote(localResolvedConfig) {
|
|
179922
179937
|
const subdomainValues = getSubdomainValuesAPIMock(
|
|
179923
179938
|
localResolvedConfig.workers_dev,
|
|
@@ -180372,6 +180387,7 @@ var init_config_diffs = __esm({
|
|
|
180372
180387
|
assets: false
|
|
180373
180388
|
};
|
|
180374
180389
|
__name(getRemoteConfigDiff, "getRemoteConfigDiff");
|
|
180390
|
+
__name(omitUndefinedProperties, "omitUndefinedProperties");
|
|
180375
180391
|
__name(normalizeLocalResolvedConfigAsRemote, "normalizeLocalResolvedConfigAsRemote");
|
|
180376
180392
|
__name(normalizeCustomDomainRoute, "normalizeCustomDomainRoute");
|
|
180377
180393
|
__name(normalizeRemoteCustomDomainRoute, "normalizeRemoteCustomDomainRoute");
|
|
@@ -180416,7 +180432,7 @@ var init_deploy_confirm = __esm({
|
|
|
180416
180432
|
});
|
|
180417
180433
|
|
|
180418
180434
|
// ../deploy-helpers/src/deploy/helpers/download-worker-config.ts
|
|
180419
|
-
async function fetchWorkerConfig(accountId, workerName, environment) {
|
|
180435
|
+
async function fetchWorkerConfig(complianceConfig, accountId, workerName, environment) {
|
|
180420
180436
|
const [
|
|
180421
180437
|
bindings,
|
|
180422
180438
|
routes,
|
|
@@ -180426,27 +180442,27 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
|
|
|
180426
180442
|
cronTriggers
|
|
180427
180443
|
] = await Promise.all([
|
|
180428
180444
|
fetchResult(
|
|
180429
|
-
|
|
180445
|
+
complianceConfig,
|
|
180430
180446
|
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/bindings`
|
|
180431
180447
|
),
|
|
180432
180448
|
fetchResult(
|
|
180433
|
-
|
|
180449
|
+
complianceConfig,
|
|
180434
180450
|
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/routes?show_zonename=true`
|
|
180435
180451
|
),
|
|
180436
180452
|
fetchResult(
|
|
180437
|
-
|
|
180453
|
+
complianceConfig,
|
|
180438
180454
|
`/accounts/${accountId}/workers/domains/records?page=0&per_page=5&service=${workerName}&environment=${environment}`
|
|
180439
180455
|
),
|
|
180440
180456
|
fetchResult(
|
|
180441
|
-
|
|
180457
|
+
complianceConfig,
|
|
180442
180458
|
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/subdomain`
|
|
180443
180459
|
),
|
|
180444
180460
|
fetchResult(
|
|
180445
|
-
|
|
180461
|
+
complianceConfig,
|
|
180446
180462
|
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}`
|
|
180447
180463
|
),
|
|
180448
180464
|
fetchResult(
|
|
180449
|
-
|
|
180465
|
+
complianceConfig,
|
|
180450
180466
|
`/accounts/${accountId}/workers/scripts/${workerName}/schedules`
|
|
180451
180467
|
)
|
|
180452
180468
|
]).catch((e11) => {
|
|
@@ -180464,7 +180480,7 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
|
|
|
180464
180480
|
cronTriggers
|
|
180465
180481
|
};
|
|
180466
180482
|
}
|
|
180467
|
-
async function downloadWorkerConfig(workerName, environment, entrypoint, accountId) {
|
|
180483
|
+
async function downloadWorkerConfig(complianceConfig, workerName, environment, entrypoint, accountId) {
|
|
180468
180484
|
const {
|
|
180469
180485
|
bindings,
|
|
180470
180486
|
routes,
|
|
@@ -180472,7 +180488,12 @@ async function downloadWorkerConfig(workerName, environment, entrypoint, account
|
|
|
180472
180488
|
subdomainStatus,
|
|
180473
180489
|
serviceEnvMetadata,
|
|
180474
180490
|
cronTriggers
|
|
180475
|
-
} = await fetchWorkerConfig(
|
|
180491
|
+
} = await fetchWorkerConfig(
|
|
180492
|
+
complianceConfig,
|
|
180493
|
+
accountId,
|
|
180494
|
+
workerName,
|
|
180495
|
+
environment
|
|
180496
|
+
);
|
|
180476
180497
|
return constructWranglerConfig({
|
|
180477
180498
|
name: workerName,
|
|
180478
180499
|
entrypoint,
|
|
@@ -180839,6 +180860,7 @@ async function preUploadApiChecks(props, config2, queueCreateCommand2) {
|
|
|
180839
180860
|
}
|
|
180840
180861
|
if (script.last_deployed_from === "dash") {
|
|
180841
180862
|
const remoteWorkerConfig = await downloadWorkerConfig(
|
|
180863
|
+
config2,
|
|
180842
180864
|
name2,
|
|
180843
180865
|
serviceMetaData.default_environment.environment,
|
|
180844
180866
|
props.entry.file,
|
|
@@ -185887,6 +185909,7 @@ function findRemoteSessionAuthError(error64) {
|
|
|
185887
185909
|
}
|
|
185888
185910
|
async function startRemoteProxySession(bindings, options) {
|
|
185889
185911
|
for (const [name2, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`Flagship binding "${name2}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
|
|
185912
|
+
if (process.versions.bun) throw new UserError("Remote bindings can't work under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js, or turn remote bindings off.", { telemetryMessage: "remote proxy session under bun" });
|
|
185890
185913
|
options.logger.log(source_default.dim("\u2394 Establishing remote connection..."));
|
|
185891
185914
|
initLogger(getInternalLogger(options.logger));
|
|
185892
185915
|
const rawBindings = toRawBindings(bindings);
|
|
@@ -186038,7 +186061,7 @@ var init_dist14 = __esm({
|
|
|
186038
186061
|
init_wrapper();
|
|
186039
186062
|
init_create_worker_upload_form();
|
|
186040
186063
|
import_undici14 = __toESM(require_undici(), 1);
|
|
186041
|
-
version3 = "0.0.
|
|
186064
|
+
version3 = "0.0.51";
|
|
186042
186065
|
NoDefaultValueProvided2 = class extends UserError {
|
|
186043
186066
|
static {
|
|
186044
186067
|
__name(this, "NoDefaultValueProvided");
|
|
@@ -189714,7 +189737,13 @@ var init_dedent = __esm({
|
|
|
189714
189737
|
__name(dedent3, "dedent");
|
|
189715
189738
|
}
|
|
189716
189739
|
});
|
|
189740
|
+
function shouldApplyMiddlewareLoaderFacade(entry) {
|
|
189741
|
+
return entry.format !== "modules" || entry.exports.length === 0 || entry.exports.includes("default");
|
|
189742
|
+
}
|
|
189717
189743
|
async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
|
|
189744
|
+
if (!shouldApplyMiddlewareLoaderFacade(entry)) {
|
|
189745
|
+
return { entry };
|
|
189746
|
+
}
|
|
189718
189747
|
tmpDirPath = fs14__namespace.realpathSync(tmpDirPath);
|
|
189719
189748
|
const middlewareIdentifiers = middleware.map((m7, index) => [
|
|
189720
189749
|
`__MIDDLEWARE_${index}__`,
|
|
@@ -189798,6 +189827,7 @@ var init_apply_middleware = __esm({
|
|
|
189798
189827
|
init_import_meta_url();
|
|
189799
189828
|
init_paths();
|
|
189800
189829
|
init_dedent();
|
|
189830
|
+
__name(shouldApplyMiddlewareLoaderFacade, "shouldApplyMiddlewareLoaderFacade");
|
|
189801
189831
|
__name(applyMiddlewareLoaderFacade, "applyMiddlewareLoaderFacade");
|
|
189802
189832
|
__name(prepareFilePath, "prepareFilePath");
|
|
189803
189833
|
}
|
|
@@ -190284,6 +190314,7 @@ async function bundleWorker(entry, destination, {
|
|
|
190284
190314
|
const tmpDir = getWranglerTmpDir(projectRoot, "bundle");
|
|
190285
190315
|
const entryFile = entry.file;
|
|
190286
190316
|
const middlewareToLoad = [];
|
|
190317
|
+
const middlewareConfig = {};
|
|
190287
190318
|
if (targetConsumer === "dev" && !process.env.WRANGLER_DISABLE_REQUEST_BODY_DRAINING) {
|
|
190288
190319
|
middlewareToLoad.push({
|
|
190289
190320
|
name: "ensure-req-body-drained",
|
|
@@ -190329,14 +190360,16 @@ async function bundleWorker(entry, destination, {
|
|
|
190329
190360
|
inject.push(checkedFetchFileToInject);
|
|
190330
190361
|
}
|
|
190331
190362
|
if (getFlag("MULTIWORKER")) {
|
|
190332
|
-
|
|
190333
|
-
|
|
190334
|
-
|
|
190335
|
-
|
|
190336
|
-
|
|
190337
|
-
|
|
190338
|
-
|
|
190339
|
-
|
|
190363
|
+
const name2 = "patch-console-prefix";
|
|
190364
|
+
inject.push(
|
|
190365
|
+
path29__namespace.resolve(
|
|
190366
|
+
getBasePath(),
|
|
190367
|
+
"templates/middleware/middleware-patch-console-prefix.ts"
|
|
190368
|
+
)
|
|
190369
|
+
);
|
|
190370
|
+
middlewareConfig[name2] = {
|
|
190371
|
+
prefix: source_default.blue(`[${entry.name}]`)
|
|
190372
|
+
};
|
|
190340
190373
|
}
|
|
190341
190374
|
for (const middleware of middlewareToLoad) {
|
|
190342
190375
|
if (!middleware.supports.includes(entry.format)) {
|
|
@@ -190434,11 +190467,12 @@ async function bundleWorker(entry, destination, {
|
|
|
190434
190467
|
cloudflareInternalPlugin,
|
|
190435
190468
|
buildResultPlugin,
|
|
190436
190469
|
...plugins || [],
|
|
190437
|
-
configProviderPlugin(
|
|
190438
|
-
Object.fromEntries(
|
|
190470
|
+
configProviderPlugin({
|
|
190471
|
+
...Object.fromEntries(
|
|
190439
190472
|
middlewareToLoad.filter((m7) => m7.config !== void 0).map((m7) => [m7.name, m7.config])
|
|
190440
|
-
)
|
|
190441
|
-
|
|
190473
|
+
),
|
|
190474
|
+
...middlewareConfig
|
|
190475
|
+
})
|
|
190442
190476
|
],
|
|
190443
190477
|
...jsxFactory && { jsxFactory },
|
|
190444
190478
|
...jsxFragment && { jsxFragment },
|
|
@@ -190595,6 +190629,60 @@ var init_bundle = __esm({
|
|
|
190595
190629
|
__name(shouldCheckFetch, "shouldCheckFetch");
|
|
190596
190630
|
}
|
|
190597
190631
|
});
|
|
190632
|
+
async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
190633
|
+
const parsedEntryPath = path29__namespace.default.parse(entryFile);
|
|
190634
|
+
if (parsedEntryPath.ext == ".py") {
|
|
190635
|
+
return { format: "modules", exports: [] };
|
|
190636
|
+
}
|
|
190637
|
+
const result = await esbuild__namespace.build({
|
|
190638
|
+
...COMMON_ESBUILD_OPTIONS,
|
|
190639
|
+
entryPoints: [entryFile],
|
|
190640
|
+
absWorkingDir: entryWorkingDirectory,
|
|
190641
|
+
metafile: true,
|
|
190642
|
+
bundle: false,
|
|
190643
|
+
write: false,
|
|
190644
|
+
...tsconfig && { tsconfig },
|
|
190645
|
+
define: {
|
|
190646
|
+
addEventListener: SERVICE_WORKER_EVENT_LISTENER,
|
|
190647
|
+
"globalThis.addEventListener": SERVICE_WORKER_EVENT_LISTENER,
|
|
190648
|
+
"self.addEventListener": SERVICE_WORKER_EVENT_LISTENER
|
|
190649
|
+
},
|
|
190650
|
+
logLevel: "silent"
|
|
190651
|
+
});
|
|
190652
|
+
const metafile = result.metafile;
|
|
190653
|
+
const { exports: exports$1 } = getEntryPointFromMetafile(entryFile, metafile);
|
|
190654
|
+
const usesServiceWorkerEventListener = result.outputFiles.some(
|
|
190655
|
+
({ text }) => text.includes(SERVICE_WORKER_EVENT_LISTENER)
|
|
190656
|
+
);
|
|
190657
|
+
let guessedWorkerFormat;
|
|
190658
|
+
if (exports$1.length === 0) {
|
|
190659
|
+
guessedWorkerFormat = "service-worker";
|
|
190660
|
+
} else if (exports$1.includes("default")) {
|
|
190661
|
+
guessedWorkerFormat = "modules";
|
|
190662
|
+
} else if (usesServiceWorkerEventListener) {
|
|
190663
|
+
logger2.warn(
|
|
190664
|
+
`The entrypoint ${path29__namespace.default.relative(
|
|
190665
|
+
process.cwd(),
|
|
190666
|
+
entryFile
|
|
190667
|
+
)} 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...`
|
|
190668
|
+
);
|
|
190669
|
+
guessedWorkerFormat = "service-worker";
|
|
190670
|
+
} else {
|
|
190671
|
+
guessedWorkerFormat = "modules";
|
|
190672
|
+
}
|
|
190673
|
+
return { format: guessedWorkerFormat, exports: exports$1 };
|
|
190674
|
+
}
|
|
190675
|
+
var SERVICE_WORKER_EVENT_LISTENER;
|
|
190676
|
+
var init_guess_worker_format = __esm({
|
|
190677
|
+
"src/deployment-bundle/guess-worker-format.ts"() {
|
|
190678
|
+
init_import_meta_url();
|
|
190679
|
+
init_logger2();
|
|
190680
|
+
init_bundle();
|
|
190681
|
+
init_entry_point_from_metafile();
|
|
190682
|
+
SERVICE_WORKER_EVENT_LISTENER = "__WRANGLER_SERVICE_WORKER_EVENT_LISTENER__";
|
|
190683
|
+
__name(guessWorkerFormat, "guessWorkerFormat");
|
|
190684
|
+
}
|
|
190685
|
+
});
|
|
190598
190686
|
|
|
190599
190687
|
// src/deployment-bundle/no-bundle-worker.ts
|
|
190600
190688
|
async function noBundleWorker(entry, rules, outDir, pythonModulesExcludes = [], findAdditionalModulesEnabled = true) {
|
|
@@ -192185,12 +192273,48 @@ function runBuild({
|
|
|
192185
192273
|
projectRoot,
|
|
192186
192274
|
onStart,
|
|
192187
192275
|
onRebuildError,
|
|
192276
|
+
onExportShapeChange,
|
|
192188
192277
|
defineNavigatorUserAgent,
|
|
192189
192278
|
checkFetch,
|
|
192190
192279
|
pythonModulesExcludes
|
|
192191
192280
|
}, setBundle, onErr) {
|
|
192192
192281
|
let stopWatching = void 0;
|
|
192193
192282
|
const entryDirectory = path29__namespace.default.dirname(entry.file);
|
|
192283
|
+
let currentExports = entry.exports;
|
|
192284
|
+
async function refreshExports() {
|
|
192285
|
+
if (!watch2 || entry.format !== "modules") {
|
|
192286
|
+
return void 0;
|
|
192287
|
+
}
|
|
192288
|
+
try {
|
|
192289
|
+
currentExports = (await guessWorkerFormat(entry.file, entry.projectRoot, tsconfig)).exports;
|
|
192290
|
+
return currentExports;
|
|
192291
|
+
} catch (error64) {
|
|
192292
|
+
if (!isBuildFailure(error64)) {
|
|
192293
|
+
throw error64;
|
|
192294
|
+
}
|
|
192295
|
+
return void 0;
|
|
192296
|
+
}
|
|
192297
|
+
}
|
|
192298
|
+
__name(refreshExports, "refreshExports");
|
|
192299
|
+
const exportShapePlugin = {
|
|
192300
|
+
name: "watch-entry-export-shape",
|
|
192301
|
+
setup(pluginBuild) {
|
|
192302
|
+
let exportShapeChanged = false;
|
|
192303
|
+
pluginBuild.onStart(async () => {
|
|
192304
|
+
exportShapeChanged = false;
|
|
192305
|
+
const exports$1 = await refreshExports();
|
|
192306
|
+
exportShapeChanged = exports$1 !== void 0 && shouldApplyMiddlewareLoaderFacade(entry) !== shouldApplyMiddlewareLoaderFacade({
|
|
192307
|
+
format: entry.format,
|
|
192308
|
+
exports: exports$1
|
|
192309
|
+
});
|
|
192310
|
+
});
|
|
192311
|
+
pluginBuild.onEnd(() => {
|
|
192312
|
+
if (exportShapeChanged) {
|
|
192313
|
+
onExportShapeChange?.(currentExports);
|
|
192314
|
+
}
|
|
192315
|
+
});
|
|
192316
|
+
}
|
|
192317
|
+
};
|
|
192194
192318
|
const moduleCollector = noBundle ? noopModuleCollector : createModuleCollector({
|
|
192195
192319
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
|
192196
192320
|
entryDirectory,
|
|
@@ -192230,6 +192354,7 @@ function runBuild({
|
|
|
192230
192354
|
}
|
|
192231
192355
|
return {
|
|
192232
192356
|
...previousBundle,
|
|
192357
|
+
entry: { ...previousBundle.entry, exports: currentExports },
|
|
192233
192358
|
modules: dedupeModulesByName([
|
|
192234
192359
|
...moduleCollector?.modules ?? [],
|
|
192235
192360
|
...newAdditionalModules
|
|
@@ -192265,6 +192390,7 @@ function runBuild({
|
|
|
192265
192390
|
targetConsumer,
|
|
192266
192391
|
testScheduled,
|
|
192267
192392
|
plugins: [
|
|
192393
|
+
exportShapePlugin,
|
|
192268
192394
|
logBuildOutput(
|
|
192269
192395
|
nodejsCompatMode,
|
|
192270
192396
|
onStart,
|
|
@@ -192297,6 +192423,7 @@ function runBuild({
|
|
|
192297
192423
|
// matching, so a regex on path segments works cross-platform.
|
|
192298
192424
|
ignored: /[/\\](\.git|node_modules|\.wrangler)([/\\]|$)/
|
|
192299
192425
|
}).on("change", async (_event) => {
|
|
192426
|
+
await refreshExports();
|
|
192300
192427
|
await updateBundle();
|
|
192301
192428
|
});
|
|
192302
192429
|
stopWatching = /* @__PURE__ */ __name(() => watcher.close(), "stopWatching");
|
|
@@ -192329,11 +192456,14 @@ var init_use_esbuild = __esm({
|
|
|
192329
192456
|
"src/dev/use-esbuild.ts"() {
|
|
192330
192457
|
init_import_meta_url();
|
|
192331
192458
|
init_esm6();
|
|
192459
|
+
init_apply_middleware();
|
|
192460
|
+
init_build_failures();
|
|
192332
192461
|
init_bundle();
|
|
192333
192462
|
init_bundle_type();
|
|
192334
192463
|
init_dedupe_modules();
|
|
192335
192464
|
init_log_build_output();
|
|
192336
192465
|
init_find_additional_modules();
|
|
192466
|
+
init_guess_worker_format();
|
|
192337
192467
|
init_module_collection();
|
|
192338
192468
|
init_logger2();
|
|
192339
192469
|
__name(runBuild, "runBuild");
|
|
@@ -192421,6 +192551,7 @@ var init_BundlerController = __esm({
|
|
|
192421
192551
|
init_build_failures();
|
|
192422
192552
|
init_bundle();
|
|
192423
192553
|
init_bundle_type();
|
|
192554
|
+
init_guess_worker_format();
|
|
192424
192555
|
init_module_collection();
|
|
192425
192556
|
init_no_bundle_worker();
|
|
192426
192557
|
init_run_custom_build();
|
|
@@ -192512,6 +192643,7 @@ var init_BundlerController = __esm({
|
|
|
192512
192643
|
async #runCustomBuild(config2, filePath, buildAborter, runBuildCommand = true) {
|
|
192513
192644
|
this.emitBundleStartEvent(config2);
|
|
192514
192645
|
try {
|
|
192646
|
+
let exports$1 = config2.build.exports;
|
|
192515
192647
|
if (runBuildCommand) {
|
|
192516
192648
|
const relativeFile = path29__namespace.default.relative(config2.projectRoot, config2.entrypoint) || ".";
|
|
192517
192649
|
logger2.log(`The file ${filePath} changed, restarting build...`);
|
|
@@ -192528,6 +192660,16 @@ var init_BundlerController = __esm({
|
|
|
192528
192660
|
if (buildAborter.signal.aborted) {
|
|
192529
192661
|
return;
|
|
192530
192662
|
}
|
|
192663
|
+
if (config2.build.format === "modules") {
|
|
192664
|
+
exports$1 = (await guessWorkerFormat(
|
|
192665
|
+
config2.entrypoint,
|
|
192666
|
+
config2.projectRoot,
|
|
192667
|
+
config2.build.tsconfig
|
|
192668
|
+
)).exports;
|
|
192669
|
+
if (buildAborter.signal.aborted) {
|
|
192670
|
+
return;
|
|
192671
|
+
}
|
|
192672
|
+
}
|
|
192531
192673
|
}
|
|
192532
192674
|
assert38__default.default(this.#tmpDir);
|
|
192533
192675
|
if (!config2.build?.bundle) {
|
|
@@ -192543,7 +192685,7 @@ var init_BundlerController = __esm({
|
|
|
192543
192685
|
configPath: config2.config,
|
|
192544
192686
|
format: config2.build.format,
|
|
192545
192687
|
moduleRoot: config2.build.moduleRoot,
|
|
192546
|
-
exports:
|
|
192688
|
+
exports: exports$1
|
|
192547
192689
|
};
|
|
192548
192690
|
const entryDirectory = path29__namespace.default.dirname(config2.entrypoint);
|
|
192549
192691
|
const moduleCollector = createModuleCollector({
|
|
@@ -192704,6 +192846,7 @@ var init_BundlerController = __esm({
|
|
|
192704
192846
|
this.#bundleBuildAborter.abort();
|
|
192705
192847
|
this.#bundleBuildAborter = new AbortController();
|
|
192706
192848
|
const buildAborter = this.#bundleBuildAborter;
|
|
192849
|
+
let restartingForExportShape = false;
|
|
192707
192850
|
if (config2.build?.custom?.command) {
|
|
192708
192851
|
return;
|
|
192709
192852
|
}
|
|
@@ -192768,6 +192911,25 @@ var init_BundlerController = __esm({
|
|
|
192768
192911
|
});
|
|
192769
192912
|
}
|
|
192770
192913
|
}, "onRebuildError"),
|
|
192914
|
+
onExportShapeChange: /* @__PURE__ */ __name((exports$1) => {
|
|
192915
|
+
if (restartingForExportShape || buildAborter.signal.aborted || this.tearingDown) {
|
|
192916
|
+
return;
|
|
192917
|
+
}
|
|
192918
|
+
restartingForExportShape = true;
|
|
192919
|
+
buildAborter.abort();
|
|
192920
|
+
void this.#startBundle({
|
|
192921
|
+
...config2,
|
|
192922
|
+
build: { ...config2.build, exports: exports$1 }
|
|
192923
|
+
}).catch((err) => {
|
|
192924
|
+
this.emitErrorEvent({
|
|
192925
|
+
type: "error",
|
|
192926
|
+
reason: "Failed to restart bundler after exports changed",
|
|
192927
|
+
cause: castErrorCause(err),
|
|
192928
|
+
source: "BundlerController",
|
|
192929
|
+
data: { config: config2 }
|
|
192930
|
+
});
|
|
192931
|
+
});
|
|
192932
|
+
}, "onExportShapeChange"),
|
|
192771
192933
|
checkFetch: shouldCheckFetch(
|
|
192772
192934
|
config2.compatibilityDate,
|
|
192773
192935
|
config2.compatibilityFlags
|
|
@@ -204503,60 +204665,6 @@ var init_config7 = __esm({
|
|
|
204503
204665
|
}, "getNormalizedContainerOptions");
|
|
204504
204666
|
}
|
|
204505
204667
|
});
|
|
204506
|
-
async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
204507
|
-
const parsedEntryPath = path29__namespace.default.parse(entryFile);
|
|
204508
|
-
if (parsedEntryPath.ext == ".py") {
|
|
204509
|
-
return { format: "modules", exports: [] };
|
|
204510
|
-
}
|
|
204511
|
-
const result = await esbuild__namespace.build({
|
|
204512
|
-
...COMMON_ESBUILD_OPTIONS,
|
|
204513
|
-
entryPoints: [entryFile],
|
|
204514
|
-
absWorkingDir: entryWorkingDirectory,
|
|
204515
|
-
metafile: true,
|
|
204516
|
-
bundle: false,
|
|
204517
|
-
write: false,
|
|
204518
|
-
...tsconfig && { tsconfig },
|
|
204519
|
-
define: {
|
|
204520
|
-
addEventListener: SERVICE_WORKER_EVENT_LISTENER,
|
|
204521
|
-
"globalThis.addEventListener": SERVICE_WORKER_EVENT_LISTENER,
|
|
204522
|
-
"self.addEventListener": SERVICE_WORKER_EVENT_LISTENER
|
|
204523
|
-
},
|
|
204524
|
-
logLevel: "silent"
|
|
204525
|
-
});
|
|
204526
|
-
const metafile = result.metafile;
|
|
204527
|
-
const { exports: exports$1 } = getEntryPointFromMetafile(entryFile, metafile);
|
|
204528
|
-
const usesServiceWorkerEventListener = result.outputFiles.some(
|
|
204529
|
-
({ text }) => text.includes(SERVICE_WORKER_EVENT_LISTENER)
|
|
204530
|
-
);
|
|
204531
|
-
let guessedWorkerFormat;
|
|
204532
|
-
if (exports$1.length === 0) {
|
|
204533
|
-
guessedWorkerFormat = "service-worker";
|
|
204534
|
-
} else if (exports$1.includes("default")) {
|
|
204535
|
-
guessedWorkerFormat = "modules";
|
|
204536
|
-
} else if (usesServiceWorkerEventListener) {
|
|
204537
|
-
logger2.warn(
|
|
204538
|
-
`The entrypoint ${path29__namespace.default.relative(
|
|
204539
|
-
process.cwd(),
|
|
204540
|
-
entryFile
|
|
204541
|
-
)} 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...`
|
|
204542
|
-
);
|
|
204543
|
-
guessedWorkerFormat = "service-worker";
|
|
204544
|
-
} else {
|
|
204545
|
-
guessedWorkerFormat = "modules";
|
|
204546
|
-
}
|
|
204547
|
-
return { format: guessedWorkerFormat, exports: exports$1 };
|
|
204548
|
-
}
|
|
204549
|
-
var SERVICE_WORKER_EVENT_LISTENER;
|
|
204550
|
-
var init_guess_worker_format = __esm({
|
|
204551
|
-
"src/deployment-bundle/guess-worker-format.ts"() {
|
|
204552
|
-
init_import_meta_url();
|
|
204553
|
-
init_logger2();
|
|
204554
|
-
init_bundle();
|
|
204555
|
-
init_entry_point_from_metafile();
|
|
204556
|
-
SERVICE_WORKER_EVENT_LISTENER = "__WRANGLER_SERVICE_WORKER_EVENT_LISTENER__";
|
|
204557
|
-
__name(guessWorkerFormat, "guessWorkerFormat");
|
|
204558
|
-
}
|
|
204559
|
-
});
|
|
204560
204668
|
function resolveEntryWithScript(script) {
|
|
204561
204669
|
const file3 = path29__namespace.default.resolve(script);
|
|
204562
204670
|
const relativePath = path29__namespace.default.relative(process.cwd(), file3) || ".";
|
|
@@ -213512,6 +213620,19 @@ var init_https_options = __esm({
|
|
|
213512
213620
|
__name(validateHttpsOptions, "validateHttpsOptions");
|
|
213513
213621
|
}
|
|
213514
213622
|
});
|
|
213623
|
+
|
|
213624
|
+
// src/utils/is-bun.ts
|
|
213625
|
+
function isBun() {
|
|
213626
|
+
return !!process.versions.bun;
|
|
213627
|
+
}
|
|
213628
|
+
var BUN_UNSUPPORTED_MESSAGE;
|
|
213629
|
+
var init_is_bun = __esm({
|
|
213630
|
+
"src/utils/is-bun.ts"() {
|
|
213631
|
+
init_import_meta_url();
|
|
213632
|
+
__name(isBun, "isBun");
|
|
213633
|
+
BUN_UNSUPPORTED_MESSAGE = "Wrangler can't forward requests to your Worker under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js.";
|
|
213634
|
+
}
|
|
213635
|
+
});
|
|
213515
213636
|
function deepEquality(a8, b11) {
|
|
213516
213637
|
return JSON.stringify(a8) === JSON.stringify(b11);
|
|
213517
213638
|
}
|
|
@@ -213535,6 +213656,7 @@ var init_ProxyController = __esm({
|
|
|
213535
213656
|
init_https_options();
|
|
213536
213657
|
init_logger2();
|
|
213537
213658
|
init_sourcemap2();
|
|
213659
|
+
init_is_bun();
|
|
213538
213660
|
init_BaseController();
|
|
213539
213661
|
init_events7();
|
|
213540
213662
|
init_utils3();
|
|
@@ -213591,7 +213713,13 @@ var init_ProxyController = __esm({
|
|
|
213591
213713
|
}, "PROXY_CONTROLLER")
|
|
213592
213714
|
},
|
|
213593
213715
|
bindings: {
|
|
213594
|
-
PROXY_CONTROLLER_AUTH_SECRET: this.secret
|
|
213716
|
+
PROXY_CONTROLLER_AUTH_SECRET: this.secret,
|
|
213717
|
+
// Bun's `fetch()` ignores the undici `dispatcher` that carries
|
|
213718
|
+
// control messages here, so the ProxyWorker would queue every
|
|
213719
|
+
// request forever waiting for a `play` message.
|
|
213720
|
+
...isBun() && {
|
|
213721
|
+
UNSUPPORTED_RUNTIME_MESSAGE: BUN_UNSUPPORTED_MESSAGE
|
|
213722
|
+
}
|
|
213595
213723
|
},
|
|
213596
213724
|
// no need to use file-system, so don't
|
|
213597
213725
|
cacheAPI: false,
|
|
@@ -302653,8 +302781,9 @@ var init_create_batches = __esm({
|
|
|
302653
302781
|
});
|
|
302654
302782
|
|
|
302655
302783
|
// src/utils/download-worker-config.ts
|
|
302656
|
-
async function downloadWorkerConfig2(workerName, environment, entrypoint, accountId) {
|
|
302784
|
+
async function downloadWorkerConfig2(complianceConfig, workerName, environment, entrypoint, accountId) {
|
|
302657
302785
|
return downloadWorkerConfig(
|
|
302786
|
+
complianceConfig,
|
|
302658
302787
|
workerName,
|
|
302659
302788
|
environment,
|
|
302660
302789
|
entrypoint,
|
|
@@ -303138,6 +303267,7 @@ async function downloadWorker(accountId, workerName) {
|
|
|
303138
303267
|
`/accounts/${accountId}/workers/services/${workerName}/environments/${defaultEnvironment}/content/v2`
|
|
303139
303268
|
);
|
|
303140
303269
|
const config2 = await downloadWorkerConfig2(
|
|
303270
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
|
303141
303271
|
workerName,
|
|
303142
303272
|
defaultEnvironment,
|
|
303143
303273
|
entrypoint,
|
|
@@ -369264,7 +369394,7 @@ var init_src7 = __esm({
|
|
|
369264
369394
|
|
|
369265
369395
|
// src/utils/logPossibleBugMessage.ts
|
|
369266
369396
|
async function logPossibleBugMessage() {
|
|
369267
|
-
if (
|
|
369397
|
+
if (isBun()) {
|
|
369268
369398
|
logger2.warn(
|
|
369269
369399
|
`Wrangler does not support the Bun runtime. Please try this command again using Node.js via \`npm\` or \`pnpm\`. Alternatively, make sure you're not passing the \`--bun\` flag when running \`bun run wrangler ...\``
|
|
369270
369400
|
);
|
|
@@ -369287,6 +369417,7 @@ var init_logPossibleBugMessage = __esm({
|
|
|
369287
369417
|
init_logger2();
|
|
369288
369418
|
init_update_check2();
|
|
369289
369419
|
init_constants6();
|
|
369420
|
+
init_is_bun();
|
|
369290
369421
|
__name(logPossibleBugMessage, "logPossibleBugMessage");
|
|
369291
369422
|
}
|
|
369292
369423
|
});
|
|
@@ -376182,6 +376313,7 @@ var init_introspection = __esm({
|
|
|
376182
376313
|
static {
|
|
376183
376314
|
__name(this, "WorkflowInstanceIntrospectorHandle");
|
|
376184
376315
|
}
|
|
376316
|
+
#disposed = false;
|
|
376185
376317
|
#instanceModifier;
|
|
376186
376318
|
#instanceModifierPromise;
|
|
376187
376319
|
async modify(fn2) {
|
|
@@ -376220,7 +376352,16 @@ var init_introspection = __esm({
|
|
|
376220
376352
|
}
|
|
376221
376353
|
/** Keep this bound; explicit resource management may call the disposer unbound. */
|
|
376222
376354
|
dispose = /* @__PURE__ */ __name(async () => {
|
|
376223
|
-
|
|
376355
|
+
if (this.#disposed) {
|
|
376356
|
+
return;
|
|
376357
|
+
}
|
|
376358
|
+
this.#disposed = true;
|
|
376359
|
+
try {
|
|
376360
|
+
const modifier = this.#instanceModifier ?? await this.#instanceModifierPromise?.catch(() => void 0);
|
|
376361
|
+
modifier?.[Symbol.dispose]?.();
|
|
376362
|
+
} finally {
|
|
376363
|
+
await this.workflow.unsafeAbort(this.instanceId, "Instance dispose");
|
|
376364
|
+
}
|
|
376224
376365
|
}, "dispose");
|
|
376225
376366
|
async [Symbol.asyncDispose]() {
|
|
376226
376367
|
await this.dispose();
|
|
@@ -376650,6 +376791,12 @@ function createTestHarness(options) {
|
|
|
376650
376791
|
}
|
|
376651
376792
|
__name(getInputUrl, "getInputUrl");
|
|
376652
376793
|
async function dispatchFetch(miniflare$1, input2, init4, worker, event = "fetch") {
|
|
376794
|
+
if (isBun()) {
|
|
376795
|
+
throw new UserError(
|
|
376796
|
+
`${BUN_UNSUPPORTED_MESSAGE} \`server.getWorker().getEnv()\` and \`getExport()\` still work under Bun.`,
|
|
376797
|
+
{ telemetryMessage: "test harness dispatch under bun" }
|
|
376798
|
+
);
|
|
376799
|
+
}
|
|
376653
376800
|
let resolvedInput = input2;
|
|
376654
376801
|
if (typeof input2 === "string" && !URL.canParse(input2)) {
|
|
376655
376802
|
const session = await resolveSession();
|
|
@@ -377037,6 +377184,7 @@ var init_test_harness = __esm({
|
|
|
377037
377184
|
init_class_names_sqlite();
|
|
377038
377185
|
init_logger2();
|
|
377039
377186
|
init_user3();
|
|
377187
|
+
init_is_bun();
|
|
377040
377188
|
init_DevEnv();
|
|
377041
377189
|
init_MultiworkerRuntimeController();
|
|
377042
377190
|
init_NoOpProxyController();
|