wrangler 3.72.1 → 3.72.2

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": "3.72.1",
3
+ "version": "3.72.2",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -63,15 +63,15 @@
63
63
  "selfsigned": "^2.0.1",
64
64
  "source-map": "^0.6.1",
65
65
  "unenv": "npm:unenv-nightly@1.10.0-1717606461.a117952",
66
- "workerd": "1.20240806.0",
66
+ "workerd": "1.20240821.1",
67
67
  "xxhash-wasm": "^1.0.1",
68
- "@cloudflare/workers-shared": "0.2.0",
69
68
  "@cloudflare/kv-asset-handler": "0.3.4",
70
- "miniflare": "3.20240806.1"
69
+ "@cloudflare/workers-shared": "0.3.0",
70
+ "miniflare": "3.20240821.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@cloudflare/types": "^6.18.4",
74
- "@cloudflare/workers-types": "^4.20240806.0",
74
+ "@cloudflare/workers-types": "^4.20240821.1",
75
75
  "@cspotcode/source-map-support": "0.8.1",
76
76
  "@iarna/toml": "^3.0.0",
77
77
  "@microsoft/api-extractor": "^7.47.0",
@@ -152,13 +152,13 @@
152
152
  "xdg-app-paths": "^8.3.0",
153
153
  "yargs": "^17.7.2",
154
154
  "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
155
- "@cloudflare/cli": "1.1.1",
156
- "@cloudflare/pages-shared": "^0.11.52",
157
155
  "@cloudflare/eslint-config-worker": "1.1.0",
156
+ "@cloudflare/cli": "1.1.1",
157
+ "@cloudflare/pages-shared": "^0.11.53",
158
158
  "@cloudflare/workers-tsconfig": "0.0.0"
159
159
  },
160
160
  "peerDependencies": {
161
- "@cloudflare/workers-types": "^4.20240806.0"
161
+ "@cloudflare/workers-types": "^4.20240821.1"
162
162
  },
163
163
  "peerDependenciesMeta": {
164
164
  "@cloudflare/workers-types": {
@@ -975,6 +975,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
975
975
  modified_on: string;
976
976
  short_id: string;
977
977
  build_image_major_version: number;
978
+ kv_namespaces?: any;
978
979
  source?: {
979
980
  type: "github" | "gitlab";
980
981
  config: {
@@ -989,7 +990,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
989
990
  preview_branch_excludes?: string[] | undefined;
990
991
  };
991
992
  } | undefined;
992
- kv_namespaces?: any;
993
993
  env_vars?: any;
994
994
  durable_object_namespaces?: any;
995
995
  is_skipped?: boolean | undefined;
@@ -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.2";
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();
@@ -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 },
@@ -178611,7 +178572,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
178611
178572
  "**/.git"
178612
178573
  ].map((pattern) => new import_minimatch.Minimatch(pattern));
178613
178574
  const directory = (0, import_node_path33.resolve)(args.directory);
178614
- const walk2 = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
178575
+ const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
178615
178576
  const files = await (0, import_promises11.readdir)(dir);
178616
178577
  await Promise.all(
178617
178578
  files.map(async (file) => {
@@ -178627,7 +178588,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
178627
178588
  return;
178628
178589
  }
178629
178590
  if (filestat.isDirectory()) {
178630
- fileMap2 = await walk2(filepath, fileMap2, startingDir);
178591
+ fileMap2 = await walk(filepath, fileMap2, startingDir);
178631
178592
  } else {
178632
178593
  const name = relativeFilepath.split(import_node_path33.sep).join("/");
178633
178594
  if (filestat.size > MAX_ASSET_SIZE) {
@@ -178653,7 +178614,7 @@ ${name} is ${prettyBytes(filestat.size, {
178653
178614
  );
178654
178615
  return fileMap2;
178655
178616
  }, "walk");
178656
- const fileMap = await walk2(directory);
178617
+ const fileMap = await walk(directory);
178657
178618
  if (fileMap.size > MAX_ASSET_COUNT) {
178658
178619
  throw new FatalError(
178659
178620
  `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 +178919,14 @@ __name(Progress, "Progress");
178958
178919
 
178959
178920
  // src/experimental-assets.ts
178960
178921
  var BULK_UPLOAD_CONCURRENCY2 = 3;
178961
- var MAX_ASSET_COUNT2 = 2e4;
178962
- var MAX_ASSET_SIZE2 = 25 * 1024 * 1024;
178963
178922
  var MAX_UPLOAD_ATTEMPTS2 = 5;
178964
178923
  var MAX_UPLOAD_GATEWAY_ERRORS2 = 5;
178924
+ var MAX_ASSET_COUNT2 = 2e4;
178925
+ var MAX_ASSET_SIZE2 = 25 * 1024 * 1024;
178965
178926
  var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName, assetDirectory) => {
178966
178927
  (0, import_node_assert15.default)(accountId, "Missing accountId");
178967
178928
  logger.info("\u{1F300} Building list of assets...");
178968
- const manifest = await walk(assetDirectory, {});
178929
+ const manifest = await buildAssetsManifest(assetDirectory);
178969
178930
  logger.info("\u{1F300} Starting asset upload...");
178970
178931
  const initializeAssetsResponse = await fetchResult(
178971
178932
  `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`,
@@ -179105,24 +179066,22 @@ Assets already uploaded have been saved, so the next attempt will automatically
179105
179066
  );
179106
179067
  return completionJwt;
179107
179068
  }, "syncExperimentalAssets");
179108
- var walk = /* @__PURE__ */ __name(async (dir, manifest, startingDir = dir) => {
179109
- const files = await (0, import_promises13.readdir)(dir);
179069
+ var buildAssetsManifest = /* @__PURE__ */ __name(async (dir) => {
179070
+ const files = await (0, import_promises13.readdir)(dir, { recursive: true });
179071
+ const manifest = {};
179110
179072
  let counter = 0;
179111
179073
  await Promise.all(
179112
179074
  files.map(async (file) => {
179113
179075
  const filepath = path39.join(dir, file);
179114
- const relativeFilepath = path39.relative(startingDir, filepath);
179076
+ const relativeFilepath = path39.relative(dir, filepath);
179115
179077
  const filestat = await (0, import_promises13.stat)(filepath);
179116
- if (filestat.isSymbolicLink()) {
179078
+ if (filestat.isSymbolicLink() || filestat.isDirectory()) {
179117
179079
  return;
179118
- }
179119
- if (filestat.isDirectory()) {
179120
- manifest = await walk(filepath, manifest, startingDir);
179121
179080
  } else {
179122
179081
  if (counter >= MAX_ASSET_COUNT2) {
179123
179082
  throw new UserError(
179124
179083
  `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}".
179084
+ 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
179085
  Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT2.toLocaleString()} files, and that you have specified your assets directory correctly.`
179127
179086
  );
179128
179087
  }
@@ -179140,7 +179099,7 @@ Cloudflare Workers supports assets with sizes of up to ${prettyBytes(
179140
179099
  binary: true
179141
179100
  }
179142
179101
  )}.
179143
- Ensure all assets in your assets directory "${startingDir}" conform with the Workers maximum size requirement.`
179102
+ Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`
179144
179103
  );
179145
179104
  }
179146
179105
  manifest[encodeFilePath(relativeFilepath)] = {
@@ -179152,7 +179111,7 @@ Ensure all assets in your assets directory "${startingDir}" conform with the Wor
179152
179111
  })
179153
179112
  );
179154
179113
  return manifest;
179155
- }, "walk");
179114
+ }, "buildAssetsManifest");
179156
179115
  var MAX_DIFF_LINES = 100;
179157
179116
  function logAssetUpload(line, diffCount) {
179158
179117
  const level = logger.loggerLevel;
@@ -181993,71 +181952,7 @@ function buildWorkerFromFunctions({
181993
181952
  doBindings: [],
181994
181953
  // Pages functions don't support internal Durable Objects
181995
181954
  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
- ],
181955
+ plugins: [buildNotifierPlugin(onEnd), assetsPlugin(buildOutputDirectory)],
182061
181956
  isOutfile: !outdir,
182062
181957
  serveLegacyAssetsFromWorker: false,
182063
181958
  checkFetch: local,
@@ -182260,6 +182155,71 @@ function blockWorkerJsImports(nodejsCompatMode) {
182260
182155
  };
182261
182156
  }
182262
182157
  __name(blockWorkerJsImports, "blockWorkerJsImports");
182158
+ function assetsPlugin(buildOutputDirectory) {
182159
+ return {
182160
+ name: "Assets",
182161
+ setup(pluginBuild) {
182162
+ const identifiers = /* @__PURE__ */ new Map();
182163
+ pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
182164
+ const directory = (0, import_node_path41.resolve)(
182165
+ args.resolveDir,
182166
+ args.path.slice("assets:".length)
182167
+ );
182168
+ const exists = await (0, import_promises15.access)(directory).then(() => true).catch(() => false);
182169
+ const isDirectory2 = exists && (await (0, import_promises15.lstat)(directory)).isDirectory();
182170
+ if (!isDirectory2) {
182171
+ return {
182172
+ errors: [
182173
+ {
182174
+ text: `'${directory}' does not exist or is not a directory.`
182175
+ }
182176
+ ]
182177
+ };
182178
+ }
182179
+ identifiers.set(directory, nanoid());
182180
+ if (!buildOutputDirectory) {
182181
+ console.warn(
182182
+ "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."
182183
+ );
182184
+ }
182185
+ return { path: directory, namespace: "assets" };
182186
+ });
182187
+ pluginBuild.onLoad(
182188
+ { filter: /.*/, namespace: "assets" },
182189
+ async (args) => {
182190
+ const identifier = identifiers.get(args.path);
182191
+ if (buildOutputDirectory) {
182192
+ const staticAssetsOutputDirectory = (0, import_node_path41.join)(
182193
+ buildOutputDirectory,
182194
+ "cdn-cgi",
182195
+ "pages-plugins",
182196
+ identifier
182197
+ );
182198
+ await (0, import_promises15.rm)(staticAssetsOutputDirectory, {
182199
+ force: true,
182200
+ recursive: true
182201
+ });
182202
+ await (0, import_promises15.cp)(args.path, staticAssetsOutputDirectory, {
182203
+ force: true,
182204
+ recursive: true
182205
+ });
182206
+ return {
182207
+ // TODO: Watch args.path for changes and re-copy when updated
182208
+ contents: `export const onRequest = ({ request, env, functionPath }) => {
182209
+ const url = new URL(request.url);
182210
+ const relativePathname = \`/\${url.pathname.replace(functionPath, "") || ""}\`.replace(/^\\/\\//, '/');
182211
+ url.pathname = '/cdn-cgi/pages-plugins/${identifier}' + relativePathname;
182212
+ request = new Request(url.toString(), request);
182213
+ return env.ASSETS.fetch(request);
182214
+ }`
182215
+ };
182216
+ }
182217
+ }
182218
+ );
182219
+ }
182220
+ };
182221
+ }
182222
+ __name(assetsPlugin, "assetsPlugin");
182263
182223
 
182264
182224
  // src/pages/functions/buildPlugin.ts
182265
182225
  function buildPluginFromFunctions({
@@ -205446,12 +205406,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
205446
205406
  const jsxFragment = props.jsxFragment || config.jsx_fragment;
205447
205407
  const keepVars = props.keepVars || config.keep_vars;
205448
205408
  const minify = props.minify ?? config.minify;
205409
+ const compatibilityFlags = props.compatibilityFlags ?? config.compatibility_flags;
205449
205410
  const nodejsCompatMode = validateNodeCompat({
205450
205411
  legacyNodeCompat: props.nodeCompat ?? config.node_compat ?? false,
205451
- compatibilityFlags: props.compatibilityFlags ?? config.compatibility_flags,
205412
+ compatibilityFlags,
205452
205413
  noBundle: props.noBundle ?? config.no_bundle ?? false
205453
205414
  });
205454
- const compatibilityFlags = props.compatibilityFlags ?? config.compatibility_flags;
205455
205415
  if (props.noBundle && minify) {
205456
205416
  logger.warn(
205457
205417
  "`--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."
@@ -207172,7 +207132,7 @@ async function createRemoteWorkerInit(props) {
207172
207132
  migrations: void 0,
207173
207133
  // no migrations in dev
207174
207134
  compatibility_date: props.compatibilityDate,
207175
- compatibility_flags: props.compatibilityFlags,
207135
+ compatibility_flags: stripExperimentalPrefixes(props.compatibilityFlags),
207176
207136
  keepVars: true,
207177
207137
  keepSecrets: true,
207178
207138
  logpush: false,