wrangler 3.72.1 → 3.72.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.
@@ -93993,8 +93993,8 @@ function $asStringSmall (str) {
93993
93993
  }
93994
93994
  let code = "return schema";
93995
93995
  if (ref[1]) {
93996
- const walk2 = ref[1].split("/");
93997
- if (walk2.length === 1) {
93996
+ const walk = ref[1].split("/");
93997
+ if (walk.length === 1) {
93998
93998
  const targetId = `#${ref[1]}`;
93999
93999
  let dereferenced = idFinder(schema, targetId);
94000
94000
  if (dereferenced === void 0 && !ref[0]) {
@@ -94012,8 +94012,8 @@ function $asStringSmall (str) {
94012
94012
  externalSchema
94013
94013
  };
94014
94014
  } else {
94015
- for (var i = 1; i < walk2.length; i++) {
94016
- code += `[${JSON.stringify(walk2[i])}]`;
94015
+ for (var i = 1; i < walk.length; i++) {
94016
+ code += `[${JSON.stringify(walk[i])}]`;
94017
94017
  }
94018
94018
  }
94019
94019
  }
@@ -94023,8 +94023,8 @@ function $asStringSmall (str) {
94023
94023
  } catch (err) {
94024
94024
  }
94025
94025
  if (result === void 0 && ref[1]) {
94026
- const walk2 = ref[1].split("/");
94027
- findBadKey(schema, walk2.slice(1));
94026
+ const walk = ref[1].split("/");
94027
+ findBadKey(schema, walk.slice(1));
94028
94028
  }
94029
94029
  if (result.$ref) {
94030
94030
  return refFinder(result.$ref, {
@@ -152693,7 +152693,7 @@ init_import_meta_url();
152693
152693
  init_import_meta_url();
152694
152694
 
152695
152695
  // package.json
152696
- var version = "3.72.1";
152696
+ var version = "3.72.3";
152697
152697
  var package_default = {
152698
152698
  name: "wrangler",
152699
152699
  version,
@@ -152781,7 +152781,7 @@ var package_default = {
152781
152781
  selfsigned: "^2.0.1",
152782
152782
  "source-map": "^0.6.1",
152783
152783
  unenv: "npm:unenv-nightly@1.10.0-1717606461.a117952",
152784
- workerd: "1.20240806.0",
152784
+ workerd: "1.20240821.1",
152785
152785
  "xxhash-wasm": "^1.0.1"
152786
152786
  },
152787
152787
  devDependencies: {
@@ -152790,7 +152790,7 @@ var package_default = {
152790
152790
  "@cloudflare/pages-shared": "workspace:^",
152791
152791
  "@cloudflare/types": "^6.18.4",
152792
152792
  "@cloudflare/workers-tsconfig": "workspace:*",
152793
- "@cloudflare/workers-types": "^4.20240806.0",
152793
+ "@cloudflare/workers-types": "^4.20240821.1",
152794
152794
  "@cspotcode/source-map-support": "0.8.1",
152795
152795
  "@iarna/toml": "^3.0.0",
152796
152796
  "@microsoft/api-extractor": "^7.47.0",
@@ -152873,7 +152873,7 @@ var package_default = {
152873
152873
  "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz"
152874
152874
  },
152875
152875
  peerDependencies: {
152876
- "@cloudflare/workers-types": "^4.20240806.0"
152876
+ "@cloudflare/workers-types": "^4.20240821.1"
152877
152877
  },
152878
152878
  peerDependenciesMeta: {
152879
152879
  "@cloudflare/workers-types": {
@@ -158108,86 +158108,42 @@ function handleAliasedNodeJSPackages(build5, alias, external) {
158108
158108
  __name(handleAliasedNodeJSPackages, "handleAliasedNodeJSPackages");
158109
158109
  function handleNodeJSGlobals(build5, inject) {
158110
158110
  const UNENV_GLOBALS_RE = /_virtual_unenv_global_polyfill-([^.]+)\.js$/;
158111
+ const prefix = import_node_path8.default.resolve(
158112
+ getBasePath(),
158113
+ "_virtual_unenv_global_polyfill-"
158114
+ );
158111
158115
  build5.initialOptions.inject = [
158112
158116
  ...build5.initialOptions.inject ?? [],
158113
158117
  //convert unenv's inject keys to absolute specifiers of custom virtual modules that will be provided via a custom onLoad
158114
158118
  ...Object.keys(inject).map(
158115
- (globalName) => import_node_path8.default.resolve(
158116
- getBasePath(),
158117
- `_virtual_unenv_global_polyfill-${encodeToLowerCase(globalName)}.js`
158118
- )
158119
+ (globalName) => `${prefix}${encodeToLowerCase(globalName)}.js`
158119
158120
  )
158120
158121
  ];
158121
158122
  build5.onResolve({ filter: UNENV_GLOBALS_RE }, ({ path: path74 }) => ({ path: path74 }));
158122
158123
  build5.onLoad({ filter: UNENV_GLOBALS_RE }, ({ path: path74 }) => {
158123
158124
  const globalName = decodeFromLowerCase(path74.match(UNENV_GLOBALS_RE)[1]);
158124
- const globalMapping = inject[globalName];
158125
- if (typeof globalMapping === "string") {
158126
- const globalPolyfillSpecifier = globalMapping;
158127
- return {
158128
- contents: `
158129
- import globalVar from "${globalPolyfillSpecifier}";
158130
-
158131
- ${/*
158132
- // ESBuild's inject doesn't actually touch globalThis, so let's do it ourselves
158133
- // by creating an exportable so that we can preserve the globalThis assignment if
158134
- // the ${globalName} was found in the app, or tree-shake it, if it wasn't
158135
- // see https://esbuild.github.io/api/#inject
158136
- */
158137
- ""}
158138
- const exportable =
158139
- ${/*
158140
- // mark this as a PURE call so it can be ignored and tree-shaken by ESBuild,
158141
- // when we don't detect 'process', 'global.process', or 'globalThis.process'
158142
- // in the app code
158143
- // see https://esbuild.github.io/api/#tree-shaking-and-side-effects
158144
- */
158145
- ""}
158146
- /* @__PURE__ */ (() => {
158147
- return globalThis.${globalName} = globalVar;
158148
- })();
158149
-
158150
- export {
158151
- exportable as '${globalName}',
158152
- exportable as 'globalThis.${globalName}',
158153
- }
158154
- `
158155
- };
158156
- }
158157
- const [moduleName, exportName] = inject[globalName];
158125
+ const { importStatement, exportName } = getGlobalInject(inject[globalName]);
158158
158126
  return {
158159
- contents: `
158160
- import { ${exportName} } from "${moduleName}";
158161
-
158162
- ${/*
158163
- // ESBuild's inject doesn't actually touch globalThis, so let's do it ourselves
158164
- // by creating an exportable so that we can preserve the globalThis assignment if
158165
- // the ${globalName} was found in the app, or tree-shake it, if it wasn't
158166
- // see https://esbuild.github.io/api/#inject
158167
- */
158168
- ""}
158169
- const exportable =
158170
- ${/*
158171
- // mark this as a PURE call so it can be ignored and tree-shaken by ESBuild,
158172
- // when we don't detect 'process', 'global.process', or 'globalThis.process'
158173
- // in the app code
158174
- // see https://esbuild.github.io/api/#tree-shaking-and-side-effects
158175
- */
158176
- ""}
158177
- /* @__PURE__ */ (() => {
158178
- return globalThis.${globalName} = ${exportName};
158179
- })();
158180
-
158181
- export {
158182
- exportable as '${globalName}',
158183
- exportable as 'global.${globalName}',
158184
- exportable as 'globalThis.${globalName}'
158185
- }
158186
- `
158127
+ contents: `${importStatement}
158128
+ globalThis.${globalName} = ${exportName};`
158187
158129
  };
158188
158130
  });
158189
158131
  }
158190
158132
  __name(handleNodeJSGlobals, "handleNodeJSGlobals");
158133
+ function getGlobalInject(globalInject) {
158134
+ if (typeof globalInject === "string") {
158135
+ return {
158136
+ importStatement: `import globalVar from "${globalInject}";`,
158137
+ exportName: "globalVar"
158138
+ };
158139
+ }
158140
+ const [moduleSpecifier, exportName] = globalInject;
158141
+ return {
158142
+ importStatement: `import { ${exportName} } from "${moduleSpecifier}";`,
158143
+ exportName
158144
+ };
158145
+ }
158146
+ __name(getGlobalInject, "getGlobalInject");
158191
158147
  function encodeToLowerCase(str) {
158192
158148
  return str.replaceAll(/\$/g, () => "$$").replaceAll(/[A-Z]/g, (letter) => `$${letter.toLowerCase()}`);
158193
158149
  }
@@ -159542,9 +159498,6 @@ function validateNodeCompat({
159542
159498
  node_compat: legacyNodeCompat
159543
159499
  });
159544
159500
  const nodejsCompatV2NotExperimental = compatibilityFlags.includes("nodejs_compat_v2");
159545
- if (nodejsCompatV2) {
159546
- compatibilityFlags[compatibilityFlags.indexOf("experimental:nodejs_compat_v2")] = "nodejs_compat_v2";
159547
- }
159548
159501
  if (nodejsCompat && nodejsCompatV2) {
159549
159502
  throw new UserError(
159550
159503
  "The `nodejs_compat` and `nodejs_compat_v2` compatibility flags cannot be used in together. Please select just one."
@@ -159604,6 +159557,10 @@ function getNodeCompatMode({
159604
159557
  };
159605
159558
  }
159606
159559
  __name(getNodeCompatMode, "getNodeCompatMode");
159560
+ function stripExperimentalPrefixes(compatFlags) {
159561
+ return compatFlags?.map((flag) => flag.replace(/^experimental:/, ""));
159562
+ }
159563
+ __name(stripExperimentalPrefixes, "stripExperimentalPrefixes");
159607
159564
 
159608
159565
  // src/dev-registry.ts
159609
159566
  init_import_meta_url();
@@ -162669,7 +162626,7 @@ function buildMiniflareBindingOptions(config) {
162669
162626
  }
162670
162627
  const serviceBindings = {
162671
162628
  ...config.serviceBindings,
162672
- ...config.experimentalAssets ? { ASSET_SERVER: "asset-server" } : {}
162629
+ ...config.experimentalAssets ? { ASSET_SERVER: "asset-server-worker" } : {}
162673
162630
  };
162674
162631
  const notFoundServices = /* @__PURE__ */ new Set();
162675
162632
  for (const service of config.services ?? []) {
@@ -162997,7 +162954,9 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
162997
162954
  {
162998
162955
  name: getName(config),
162999
162956
  compatibilityDate: config.compatibilityDate,
163000
- compatibilityFlags: config.compatibilityFlags,
162957
+ compatibilityFlags: stripExperimentalPrefixes(
162958
+ config.compatibilityFlags
162959
+ ),
163001
162960
  ...sourceOptions,
163002
162961
  ...bindingOptions,
163003
162962
  ...sitesOptions,
@@ -163934,7 +163893,9 @@ function createWorkerUploadForm(worker) {
163934
163893
  ...main2.type !== "commonjs" ? { main_module: main2.name } : { body_part: main2.name },
163935
163894
  bindings: metadataBindings,
163936
163895
  ...compatibility_date && { compatibility_date },
163937
- ...compatibility_flags && { compatibility_flags },
163896
+ ...compatibility_flags && {
163897
+ compatibility_flags: stripExperimentalPrefixes(compatibility_flags)
163898
+ },
163938
163899
  ...migrations && { migrations },
163939
163900
  capnp_schema: capnpSchemaOutputFile,
163940
163901
  ...keep_bindings && { keep_bindings },
@@ -163976,6 +163937,38 @@ function createWorkerUploadForm(worker) {
163976
163937
  }
163977
163938
  __name(createWorkerUploadForm, "createWorkerUploadForm");
163978
163939
 
163940
+ // src/deployment-bundle/esbuild-plugins/log-build-output.ts
163941
+ init_import_meta_url();
163942
+ function logBuildOutput(nodejsCompatMode, onStart, updateBundle) {
163943
+ let bundled = false;
163944
+ return {
163945
+ name: "log-build-output",
163946
+ setup(build5) {
163947
+ build5.onStart(() => {
163948
+ onStart?.();
163949
+ });
163950
+ build5.onEnd(async ({ errors, warnings }) => {
163951
+ if (errors.length > 0) {
163952
+ if (nodejsCompatMode !== "legacy") {
163953
+ rewriteNodeCompatBuildFailure(errors);
163954
+ }
163955
+ logBuildFailure(errors, warnings);
163956
+ return;
163957
+ }
163958
+ if (warnings.length > 0) {
163959
+ logBuildWarnings(warnings);
163960
+ }
163961
+ if (!bundled) {
163962
+ bundled = true;
163963
+ } else {
163964
+ await updateBundle?.();
163965
+ }
163966
+ });
163967
+ }
163968
+ };
163969
+ }
163970
+ __name(logBuildOutput, "logBuildOutput");
163971
+
163979
163972
  // src/deployments.ts
163980
163973
  init_import_meta_url();
163981
163974
  var import_url8 = require("url");
@@ -178611,7 +178604,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
178611
178604
  "**/.git"
178612
178605
  ].map((pattern) => new import_minimatch.Minimatch(pattern));
178613
178606
  const directory = (0, import_node_path33.resolve)(args.directory);
178614
- const walk2 = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
178607
+ const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
178615
178608
  const files = await (0, import_promises11.readdir)(dir);
178616
178609
  await Promise.all(
178617
178610
  files.map(async (file) => {
@@ -178627,7 +178620,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
178627
178620
  return;
178628
178621
  }
178629
178622
  if (filestat.isDirectory()) {
178630
- fileMap2 = await walk2(filepath, fileMap2, startingDir);
178623
+ fileMap2 = await walk(filepath, fileMap2, startingDir);
178631
178624
  } else {
178632
178625
  const name = relativeFilepath.split(import_node_path33.sep).join("/");
178633
178626
  if (filestat.size > MAX_ASSET_SIZE) {
@@ -178653,7 +178646,7 @@ ${name} is ${prettyBytes(filestat.size, {
178653
178646
  );
178654
178647
  return fileMap2;
178655
178648
  }, "walk");
178656
- const fileMap = await walk2(directory);
178649
+ const fileMap = await walk(directory);
178657
178650
  if (fileMap.size > MAX_ASSET_COUNT) {
178658
178651
  throw new FatalError(
178659
178652
  `Error: Pages only supports up to ${MAX_ASSET_COUNT.toLocaleString()} files in a deployment. Ensure you have specified your build output directory correctly.`,
@@ -178958,14 +178951,14 @@ __name(Progress, "Progress");
178958
178951
 
178959
178952
  // src/experimental-assets.ts
178960
178953
  var BULK_UPLOAD_CONCURRENCY2 = 3;
178961
- var MAX_ASSET_COUNT2 = 2e4;
178962
- var MAX_ASSET_SIZE2 = 25 * 1024 * 1024;
178963
178954
  var MAX_UPLOAD_ATTEMPTS2 = 5;
178964
178955
  var MAX_UPLOAD_GATEWAY_ERRORS2 = 5;
178956
+ var MAX_ASSET_COUNT2 = 2e4;
178957
+ var MAX_ASSET_SIZE2 = 25 * 1024 * 1024;
178965
178958
  var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName, assetDirectory) => {
178966
178959
  (0, import_node_assert15.default)(accountId, "Missing accountId");
178967
178960
  logger.info("\u{1F300} Building list of assets...");
178968
- const manifest = await walk(assetDirectory, {});
178961
+ const manifest = await buildAssetsManifest(assetDirectory);
178969
178962
  logger.info("\u{1F300} Starting asset upload...");
178970
178963
  const initializeAssetsResponse = await fetchResult(
178971
178964
  `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`,
@@ -179105,24 +179098,22 @@ Assets already uploaded have been saved, so the next attempt will automatically
179105
179098
  );
179106
179099
  return completionJwt;
179107
179100
  }, "syncExperimentalAssets");
179108
- var walk = /* @__PURE__ */ __name(async (dir, manifest, startingDir = dir) => {
179109
- const files = await (0, import_promises13.readdir)(dir);
179101
+ var buildAssetsManifest = /* @__PURE__ */ __name(async (dir) => {
179102
+ const files = await (0, import_promises13.readdir)(dir, { recursive: true });
179103
+ const manifest = {};
179110
179104
  let counter = 0;
179111
179105
  await Promise.all(
179112
179106
  files.map(async (file) => {
179113
179107
  const filepath = path39.join(dir, file);
179114
- const relativeFilepath = path39.relative(startingDir, filepath);
179108
+ const relativeFilepath = path39.relative(dir, filepath);
179115
179109
  const filestat = await (0, import_promises13.stat)(filepath);
179116
- if (filestat.isSymbolicLink()) {
179110
+ if (filestat.isSymbolicLink() || filestat.isDirectory()) {
179117
179111
  return;
179118
- }
179119
- if (filestat.isDirectory()) {
179120
- manifest = await walk(filepath, manifest, startingDir);
179121
179112
  } else {
179122
179113
  if (counter >= MAX_ASSET_COUNT2) {
179123
179114
  throw new UserError(
179124
179115
  `Maximum number of assets exceeded.
179125
- Cloudflare Workers supports up to ${MAX_ASSET_COUNT2.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${startingDir}".
179116
+ Cloudflare Workers supports up to ${MAX_ASSET_COUNT2.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".
179126
179117
  Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT2.toLocaleString()} files, and that you have specified your assets directory correctly.`
179127
179118
  );
179128
179119
  }
@@ -179140,7 +179131,7 @@ Cloudflare Workers supports assets with sizes of up to ${prettyBytes(
179140
179131
  binary: true
179141
179132
  }
179142
179133
  )}.
179143
- Ensure all assets in your assets directory "${startingDir}" conform with the Workers maximum size requirement.`
179134
+ Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`
179144
179135
  );
179145
179136
  }
179146
179137
  manifest[encodeFilePath(relativeFilepath)] = {
@@ -179152,7 +179143,7 @@ Ensure all assets in your assets directory "${startingDir}" conform with the Wor
179152
179143
  })
179153
179144
  );
179154
179145
  return manifest;
179155
- }, "walk");
179146
+ }, "buildAssetsManifest");
179156
179147
  var MAX_DIFF_LINES = 100;
179157
179148
  function logAssetUpload(line, diffCount) {
179158
179149
  const level = logger.loggerLevel;
@@ -181993,71 +181984,7 @@ function buildWorkerFromFunctions({
181993
181984
  doBindings: [],
181994
181985
  // Pages functions don't support internal Durable Objects
181995
181986
  external,
181996
- plugins: [
181997
- buildNotifierPlugin(onEnd),
181998
- {
181999
- name: "Assets",
182000
- setup(pluginBuild) {
182001
- const identifiers = /* @__PURE__ */ new Map();
182002
- pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
182003
- const directory = (0, import_node_path41.resolve)(
182004
- args.resolveDir,
182005
- args.path.slice("assets:".length)
182006
- );
182007
- const exists = await (0, import_promises15.access)(directory).then(() => true).catch(() => false);
182008
- const isDirectory2 = exists && (await (0, import_promises15.lstat)(directory)).isDirectory();
182009
- if (!isDirectory2) {
182010
- return {
182011
- errors: [
182012
- {
182013
- text: `'${directory}' does not exist or is not a directory.`
182014
- }
182015
- ]
182016
- };
182017
- }
182018
- identifiers.set(directory, nanoid());
182019
- if (!buildOutputDirectory) {
182020
- console.warn(
182021
- "You're attempting to import static assets as part of your Pages Functions, but have not specified a directory in which to put them. You must use 'wrangler pages dev <directory>' rather than 'wrangler pages dev -- <command>' to import static assets in Functions."
182022
- );
182023
- }
182024
- return { path: directory, namespace: "assets" };
182025
- });
182026
- pluginBuild.onLoad(
182027
- { filter: /.*/, namespace: "assets" },
182028
- async (args) => {
182029
- const identifier = identifiers.get(args.path);
182030
- if (buildOutputDirectory) {
182031
- const staticAssetsOutputDirectory = (0, import_node_path41.join)(
182032
- buildOutputDirectory,
182033
- "cdn-cgi",
182034
- "pages-plugins",
182035
- identifier
182036
- );
182037
- await (0, import_promises15.rm)(staticAssetsOutputDirectory, {
182038
- force: true,
182039
- recursive: true
182040
- });
182041
- await (0, import_promises15.cp)(args.path, staticAssetsOutputDirectory, {
182042
- force: true,
182043
- recursive: true
182044
- });
182045
- return {
182046
- // TODO: Watch args.path for changes and re-copy when updated
182047
- contents: `export const onRequest = ({ request, env, functionPath }) => {
182048
- const url = new URL(request.url)
182049
- const relativePathname = \`/\${url.pathname.replace(functionPath, "") || ""}\`.replace(/^\\/\\//, '/');
182050
- url.pathname = '/cdn-cgi/pages-plugins/${identifier}' + relativePathname
182051
- request = new Request(url.toString(), request)
182052
- return env.ASSETS.fetch(request)
182053
- }`
182054
- };
182055
- }
182056
- }
182057
- );
182058
- }
182059
- }
182060
- ],
181987
+ plugins: [buildNotifierPlugin(onEnd), assetsPlugin(buildOutputDirectory)],
182061
181988
  isOutfile: !outdir,
182062
181989
  serveLegacyAssetsFromWorker: false,
182063
181990
  checkFetch: local,
@@ -182260,6 +182187,71 @@ function blockWorkerJsImports(nodejsCompatMode) {
182260
182187
  };
182261
182188
  }
182262
182189
  __name(blockWorkerJsImports, "blockWorkerJsImports");
182190
+ function assetsPlugin(buildOutputDirectory) {
182191
+ return {
182192
+ name: "Assets",
182193
+ setup(pluginBuild) {
182194
+ const identifiers = /* @__PURE__ */ new Map();
182195
+ pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
182196
+ const directory = (0, import_node_path41.resolve)(
182197
+ args.resolveDir,
182198
+ args.path.slice("assets:".length)
182199
+ );
182200
+ const exists = await (0, import_promises15.access)(directory).then(() => true).catch(() => false);
182201
+ const isDirectory2 = exists && (await (0, import_promises15.lstat)(directory)).isDirectory();
182202
+ if (!isDirectory2) {
182203
+ return {
182204
+ errors: [
182205
+ {
182206
+ text: `'${directory}' does not exist or is not a directory.`
182207
+ }
182208
+ ]
182209
+ };
182210
+ }
182211
+ identifiers.set(directory, nanoid());
182212
+ if (!buildOutputDirectory) {
182213
+ console.warn(
182214
+ "You're attempting to import static assets as part of your Pages Functions, but have not specified a directory in which to put them. You must use 'wrangler pages dev <directory>' rather than 'wrangler pages dev -- <command>' to import static assets in Functions."
182215
+ );
182216
+ }
182217
+ return { path: directory, namespace: "assets" };
182218
+ });
182219
+ pluginBuild.onLoad(
182220
+ { filter: /.*/, namespace: "assets" },
182221
+ async (args) => {
182222
+ const identifier = identifiers.get(args.path);
182223
+ if (buildOutputDirectory) {
182224
+ const staticAssetsOutputDirectory = (0, import_node_path41.join)(
182225
+ buildOutputDirectory,
182226
+ "cdn-cgi",
182227
+ "pages-plugins",
182228
+ identifier
182229
+ );
182230
+ await (0, import_promises15.rm)(staticAssetsOutputDirectory, {
182231
+ force: true,
182232
+ recursive: true
182233
+ });
182234
+ await (0, import_promises15.cp)(args.path, staticAssetsOutputDirectory, {
182235
+ force: true,
182236
+ recursive: true
182237
+ });
182238
+ return {
182239
+ // TODO: Watch args.path for changes and re-copy when updated
182240
+ contents: `export const onRequest = ({ request, env, functionPath }) => {
182241
+ const url = new URL(request.url);
182242
+ const relativePathname = \`/\${url.pathname.replace(functionPath, "") || ""}\`.replace(/^\\/\\//, '/');
182243
+ url.pathname = '/cdn-cgi/pages-plugins/${identifier}' + relativePathname;
182244
+ request = new Request(url.toString(), request);
182245
+ return env.ASSETS.fetch(request);
182246
+ }`
182247
+ };
182248
+ }
182249
+ }
182250
+ );
182251
+ }
182252
+ };
182253
+ }
182254
+ __name(assetsPlugin, "assetsPlugin");
182263
182255
 
182264
182256
  // src/pages/functions/buildPlugin.ts
182265
182257
  function buildPluginFromFunctions({
@@ -199108,7 +199100,10 @@ async function generateRuntimeTypes({
199108
199100
  await ensureDirectoryExists(outFile);
199109
199101
  const types = await generate({
199110
199102
  compatibilityDate: compatibility_date,
199111
- compatibilityFlags: compatibility_flags
199103
+ // Ignore nodejs compat flags as there is currently no mechanism to generate these dynamically.
199104
+ compatibilityFlags: compatibility_flags.filter(
199105
+ (flag) => !flag.includes("nodejs_compat")
199106
+ )
199112
199107
  });
199113
199108
  await (0, import_promises24.writeFile)(outFile, types, "utf8");
199114
199109
  return {
@@ -199182,7 +199177,7 @@ function logRuntimeTypesMessage(outFile, tsconfigTypes, isNodeCompat = false) {
199182
199177
  }
199183
199178
  if (isNodeCompat && !isNodeTypesInstalled) {
199184
199179
  logger.info(
199185
- '\u{1F4E3} It looks like you have some Node.js compatibility turned on in your project. You might want to consider adding Node.js typings with "npm i --save-dev @types/node@20.8.3". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types'
199180
+ '\u{1F4E3} Since you have Node.js compatibility mode enabled, you should consider adding Node.js for TypeScript by running "npm i --save-dev @types/node@20.8.3". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types'
199186
199181
  );
199187
199182
  }
199188
199183
  logger.info(
@@ -199696,7 +199691,9 @@ async function queryIndex(config, indexName, vector, options29) {
199696
199691
  `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/query`,
199697
199692
  {
199698
199693
  method: "POST",
199699
- headers: { "Content-Type": "application/json" },
199694
+ headers: {
199695
+ "content-type": jsonContentType
199696
+ },
199700
199697
  body: JSON.stringify({
199701
199698
  ...options29,
199702
199699
  vector: Array.isArray(vector) ? vector : Array.from(vector)
@@ -199711,6 +199708,9 @@ async function getByIds(config, indexName, ids) {
199711
199708
  `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/get_by_ids`,
199712
199709
  {
199713
199710
  method: "POST",
199711
+ headers: {
199712
+ "content-type": jsonContentType
199713
+ },
199714
199714
  body: JSON.stringify(ids)
199715
199715
  }
199716
199716
  );
@@ -199722,6 +199722,9 @@ async function deleteByIds(config, indexName, ids) {
199722
199722
  `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/delete_by_ids`,
199723
199723
  {
199724
199724
  method: "POST",
199725
+ headers: {
199726
+ "content-type": jsonContentType
199727
+ },
199725
199728
  body: JSON.stringify(ids)
199726
199729
  }
199727
199730
  );
@@ -199743,6 +199746,9 @@ async function createMetadataIndex(config, indexName, payload) {
199743
199746
  `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/metadata_index/create`,
199744
199747
  {
199745
199748
  method: "POST",
199749
+ headers: {
199750
+ "content-type": jsonContentType
199751
+ },
199746
199752
  body: JSON.stringify(payload)
199747
199753
  }
199748
199754
  );
@@ -199764,6 +199770,9 @@ async function deleteMetadataIndex(config, indexName, payload) {
199764
199770
  `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/metadata_index/delete`,
199765
199771
  {
199766
199772
  method: "POST",
199773
+ headers: {
199774
+ "content-type": jsonContentType
199775
+ },
199767
199776
  body: JSON.stringify(payload)
199768
199777
  }
199769
199778
  );
@@ -199964,7 +199973,10 @@ async function handler20(args) {
199964
199973
  return;
199965
199974
  }
199966
199975
  logger.log(`\u{1F4CB} Deleting vectors...`);
199967
- const mutation = await deleteByIds(config, args.name, args.ids);
199976
+ const ids = {
199977
+ ids: args.ids
199978
+ };
199979
+ const mutation = await deleteByIds(config, args.name, ids);
199968
199980
  logger.log(
199969
199981
  `\u2705 Successfully enqueued ${args.ids.length} vectors into index '${args.name}' for deletion. Mutation changeset identifier: ${mutation.mutationId}.`
199970
199982
  );
@@ -200060,7 +200072,10 @@ async function handler23(args) {
200060
200072
  return;
200061
200073
  }
200062
200074
  logger.log(`\u{1F4CB} Fetching vectors...`);
200063
- const vectors = await getByIds(config, args.name, args.ids);
200075
+ const ids = {
200076
+ ids: args.ids
200077
+ };
200078
+ const vectors = await getByIds(config, args.name, ids);
200064
200079
  if (vectors.length === 0) {
200065
200080
  logger.warn(
200066
200081
  `The index does not contain vectors corresponding to the provided identifiers`
@@ -205446,12 +205461,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
205446
205461
  const jsxFragment = props.jsxFragment || config.jsx_fragment;
205447
205462
  const keepVars = props.keepVars || config.keep_vars;
205448
205463
  const minify = props.minify ?? config.minify;
205464
+ const compatibilityFlags = props.compatibilityFlags ?? config.compatibility_flags;
205449
205465
  const nodejsCompatMode = validateNodeCompat({
205450
205466
  legacyNodeCompat: props.nodeCompat ?? config.node_compat ?? false,
205451
- compatibilityFlags: props.compatibilityFlags ?? config.compatibility_flags,
205467
+ compatibilityFlags,
205452
205468
  noBundle: props.noBundle ?? config.no_bundle ?? false
205453
205469
  });
205454
- const compatibilityFlags = props.compatibilityFlags ?? config.compatibility_flags;
205455
205470
  if (props.noBundle && minify) {
205456
205471
  logger.warn(
205457
205472
  "`--minify` and `--no-bundle` can't be used together. If you want to minify your Worker and disable Wrangler's bundling, please minify as part of your own bundling process."
@@ -205568,7 +205583,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
205568
205583
  defineNavigatorUserAgent: isNavigatorDefined(
205569
205584
  props.compatibilityDate ?? config.compatibility_date,
205570
205585
  props.compatibilityFlags ?? config.compatibility_flags
205571
- )
205586
+ ),
205587
+ plugins: [logBuildOutput(nodejsCompatMode)]
205572
205588
  }
205573
205589
  );
205574
205590
  for (const module3 of modules) {
@@ -205576,11 +205592,6 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
205576
205592
  const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
205577
205593
  dependencies[modulePath] = { bytesInOutput };
205578
205594
  }
205579
- for (const module3 of modules) {
205580
- const modulePath = module3.filePath === void 0 ? module3.name : import_node_path60.default.relative("", module3.filePath);
205581
- const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
205582
- dependencies[modulePath] = { bytesInOutput };
205583
- }
205584
205595
  const content = (0, import_node_fs35.readFileSync)(resolvedEntryPointPath, {
205585
205596
  encoding: "utf-8"
205586
205597
  });
@@ -207172,7 +207183,7 @@ async function createRemoteWorkerInit(props) {
207172
207183
  migrations: void 0,
207173
207184
  // no migrations in dev
207174
207185
  compatibility_date: props.compatibilityDate,
207175
- compatibility_flags: props.compatibilityFlags,
207186
+ compatibility_flags: stripExperimentalPrefixes(props.compatibilityFlags),
207176
207187
  keepVars: true,
207177
207188
  keepSecrets: true,
207178
207189
  logpush: false,
@@ -207332,34 +207343,6 @@ function runBuild({
207332
207343
  });
207333
207344
  }
207334
207345
  __name(updateBundle, "updateBundle");
207335
- let bundled = false;
207336
- const onEnd = {
207337
- name: "on-end",
207338
- setup(b2) {
207339
- b2.onStart(() => {
207340
- onStart();
207341
- });
207342
- b2.onEnd(async (result) => {
207343
- const errors = result.errors;
207344
- const warnings = result.warnings;
207345
- if (errors.length > 0) {
207346
- if (nodejsCompatMode !== "legacy") {
207347
- rewriteNodeCompatBuildFailure(result.errors);
207348
- }
207349
- logBuildFailure(errors, warnings);
207350
- return;
207351
- }
207352
- if (warnings.length > 0) {
207353
- logBuildWarnings(warnings);
207354
- }
207355
- if (!bundled) {
207356
- bundled = true;
207357
- } else {
207358
- await updateBundle();
207359
- }
207360
- });
207361
- }
207362
- };
207363
207346
  async function build5() {
207364
207347
  if (!destination) {
207365
207348
  return;
@@ -207385,7 +207368,7 @@ function runBuild({
207385
207368
  bypassAssetCache: true,
207386
207369
  targetConsumer,
207387
207370
  testScheduled,
207388
- plugins: [onEnd],
207371
+ plugins: [logBuildOutput(nodejsCompatMode, onStart, updateBundle)],
207389
207372
  local,
207390
207373
  projectRoot,
207391
207374
  defineNavigatorUserAgent
@@ -212901,4 +212884,3 @@ yargs-parser/build/lib/index.js:
212901
212884
  * SPDX-License-Identifier: ISC
212902
212885
  *)
212903
212886
  */
212904
- //# sourceMappingURL=cli.js.map