wrangler 2.1.14 → 2.1.15

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": "2.1.14",
3
+ "version": "2.1.15",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -160,6 +160,7 @@
160
160
  "jest-fetch-mock": "^3.0.3",
161
161
  "jest-websocket-mock": "^2.3.0",
162
162
  "mime": "^3.0.0",
163
+ "minimatch": "^5.1.0",
163
164
  "msw": "^0.47.1",
164
165
  "npx-import": "^1.1.3",
165
166
  "open": "^8.4.0",
@@ -1905,6 +1905,116 @@ and that at least one include rule is provided.
1905
1905
  `);
1906
1906
  });
1907
1907
 
1908
+ it("should avoid uploading some files", async () => {
1909
+ mkdirSync("some_dir/node_modules", { recursive: true });
1910
+ mkdirSync("some_dir/functions", { recursive: true });
1911
+
1912
+ writeFileSync("logo.png", "foobar");
1913
+ writeFileSync("some_dir/functions/foo.js", "func");
1914
+ writeFileSync("some_dir/_headers", "headersfile");
1915
+
1916
+ writeFileSync("_headers", "headersfile");
1917
+ writeFileSync("_redirects", "redirectsfile");
1918
+ writeFileSync("_worker.js", "workerfile");
1919
+ writeFileSync("_routes.json", "routesfile");
1920
+ mkdirSync(".git");
1921
+ writeFileSync(".git/foo", "gitfile");
1922
+ writeFileSync("some_dir/node_modules/some_package", "nodefile");
1923
+ mkdirSync("functions");
1924
+ writeFileSync("functions/foo.js", "func");
1925
+
1926
+ setMockResponse(
1927
+ "/pages/assets/check-missing",
1928
+ "POST",
1929
+ async (_, init) => {
1930
+ const body = JSON.parse(init.body as string) as { hashes: string[] };
1931
+ assertLater(() => {
1932
+ expect(init.headers).toMatchObject({
1933
+ Authorization: "Bearer <<funfetti-auth-jwt>>",
1934
+ });
1935
+ expect(body).toMatchObject({
1936
+ hashes: [
1937
+ "2082190357cfd3617ccfe04f340c6247",
1938
+ "95dedb64e6d4940fc2e0f11f711cc2f4",
1939
+ "09a79777abda8ccc8bdd51dd3ff8e9e9",
1940
+ ],
1941
+ });
1942
+ });
1943
+ return body.hashes;
1944
+ }
1945
+ );
1946
+
1947
+ // Accumulate multiple requests then assert afterwards
1948
+ const requests: RequestInit[] = [];
1949
+ setMockRawResponse("/pages/assets/upload", "POST", async (_, init) => {
1950
+ requests.push(init);
1951
+
1952
+ return createFetchResult(null, true);
1953
+ });
1954
+
1955
+ assertLater(() => {
1956
+ expect(requests.length).toBe(3);
1957
+
1958
+ expect(requests[0].headers).toMatchObject({
1959
+ Authorization: "Bearer <<funfetti-auth-jwt>>",
1960
+ });
1961
+
1962
+ let body = JSON.parse(
1963
+ requests[0].body as string
1964
+ ) as UploadPayloadFile[];
1965
+ expect(body).toMatchObject([
1966
+ {
1967
+ key: "95dedb64e6d4940fc2e0f11f711cc2f4",
1968
+ value: Buffer.from("headersfile").toString("base64"),
1969
+ metadata: {
1970
+ contentType: "application/octet-stream",
1971
+ },
1972
+ base64: true,
1973
+ },
1974
+ ]);
1975
+
1976
+ expect(requests[1].headers).toMatchObject({
1977
+ Authorization: "Bearer <<funfetti-auth-jwt>>",
1978
+ });
1979
+
1980
+ body = JSON.parse(requests[1].body as string) as UploadPayloadFile[];
1981
+ expect(body).toMatchObject([
1982
+ {
1983
+ key: "2082190357cfd3617ccfe04f340c6247",
1984
+ value: Buffer.from("foobar").toString("base64"),
1985
+ metadata: {
1986
+ contentType: "image/png",
1987
+ },
1988
+ base64: true,
1989
+ },
1990
+ ]);
1991
+
1992
+ expect(requests[2].headers).toMatchObject({
1993
+ Authorization: "Bearer <<funfetti-auth-jwt>>",
1994
+ });
1995
+
1996
+ body = JSON.parse(requests[2].body as string) as UploadPayloadFile[];
1997
+ expect(body).toMatchObject([
1998
+ {
1999
+ key: "09a79777abda8ccc8bdd51dd3ff8e9e9",
2000
+ value: Buffer.from("func").toString("base64"),
2001
+ metadata: {
2002
+ contentType: "application/javascript",
2003
+ },
2004
+ base64: true,
2005
+ },
2006
+ ]);
2007
+ });
2008
+
2009
+ await runWrangler("pages project upload .");
2010
+
2011
+ expect(std.out).toMatchInlineSnapshot(`
2012
+ "✨ Success! Uploaded 3 files (TIMINGS)
2013
+
2014
+ ✨ Upload complete!"
2015
+ `);
2016
+ });
2017
+
1908
2018
  it("should retry uploads", async () => {
1909
2019
  writeFileSync("logo.txt", "foobar");
1910
2020
 
@@ -4,6 +4,10 @@
4
4
  * or you're piping values from / to another process, etc
5
5
  */
6
6
  export default function isInteractive(): boolean {
7
+ if (process.env.CF_PAGES === "1") {
8
+ return false;
9
+ }
10
+
7
11
  try {
8
12
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
9
13
  } catch {
@@ -1,5 +1,7 @@
1
1
  import { version as wranglerVersion } from "../../package.json";
2
2
 
3
+ export const MAX_ASSET_COUNT = 20_000;
4
+ export const MAX_ASSET_SIZE = 25 * 1024 * 1024;
3
5
  export const PAGES_CONFIG_CACHE_FILENAME = "pages.json";
4
6
  export const MAX_BUCKET_SIZE = 50 * 1024 * 1024;
5
7
  export const MAX_BUCKET_FILE_COUNT = 5000;
@@ -3,13 +3,17 @@ import { dirname, join, relative, resolve, sep } from "node:path";
3
3
  import { render, Text } from "ink";
4
4
  import Spinner from "ink-spinner";
5
5
  import { getType } from "mime";
6
+ import { Minimatch } from "minimatch";
6
7
  import PQueue from "p-queue";
7
8
  import prettyBytes from "pretty-bytes";
8
9
  import React from "react";
9
10
  import { fetchResult } from "../cfetch";
10
11
  import { FatalError } from "../errors";
12
+ import isInteractive from "../is-interactive";
11
13
  import { logger } from "../logger";
12
14
  import {
15
+ MAX_ASSET_COUNT,
16
+ MAX_ASSET_SIZE,
13
17
  BULK_UPLOAD_CONCURRENCY,
14
18
  MAX_BUCKET_FILE_COUNT,
15
19
  MAX_BUCKET_SIZE,
@@ -96,10 +100,11 @@ export const upload = async (
96
100
  "_redirects",
97
101
  "_headers",
98
102
  "_routes.json",
99
- ".DS_Store",
100
- "node_modules",
101
- ".git",
102
- ];
103
+ "functions",
104
+ "**/.DS_Store",
105
+ "**/node_modules",
106
+ "**/.git",
107
+ ].map((pattern) => new Minimatch(pattern));
103
108
 
104
109
  const directory = resolve(args.directory);
105
110
 
@@ -121,10 +126,13 @@ export const upload = async (
121
126
  await Promise.all(
122
127
  files.map(async (file) => {
123
128
  const filepath = join(dir, file);
129
+ const relativeFilepath = relative(startingDir, filepath);
124
130
  const filestat = await stat(filepath);
125
131
 
126
- if (IGNORE_LIST.includes(file)) {
127
- return;
132
+ for (const minimatch of IGNORE_LIST) {
133
+ if (minimatch.match(relativeFilepath)) {
134
+ return;
135
+ }
128
136
  }
129
137
 
130
138
  if (filestat.isSymbolicLink()) {
@@ -134,12 +142,12 @@ export const upload = async (
134
142
  if (filestat.isDirectory()) {
135
143
  fileMap = await walk(filepath, fileMap, startingDir);
136
144
  } else {
137
- const name = relative(startingDir, filepath).split(sep).join("/");
145
+ const name = relativeFilepath.split(sep).join("/");
138
146
 
139
- if (filestat.size > 25 * 1024 * 1024) {
147
+ if (filestat.size > MAX_ASSET_SIZE) {
140
148
  throw new FatalError(
141
149
  `Error: Pages only supports files up to ${prettyBytes(
142
- 25 * 1024 * 1024
150
+ MAX_ASSET_SIZE
143
151
  )} in size\n${name} is ${prettyBytes(filestat.size)} in size`,
144
152
  1
145
153
  );
@@ -161,9 +169,9 @@ export const upload = async (
161
169
 
162
170
  const fileMap = await walk(directory);
163
171
 
164
- if (fileMap.size > 20000) {
172
+ if (fileMap.size > MAX_ASSET_COUNT) {
165
173
  throw new FatalError(
166
- `Error: Pages only supports up to 20,000 files in a deployment. Ensure you have specified your build output directory correctly.`,
174
+ `Error: Pages only supports up to ${MAX_ASSET_COUNT.toLocaleString()} files in a deployment. Ensure you have specified your build output directory correctly.`,
167
175
  1
168
176
  );
169
177
  }
@@ -309,7 +317,9 @@ export const upload = async (
309
317
  (error) => {
310
318
  return Promise.reject(
311
319
  new FatalError(
312
- "Failed to upload files. Please try again.",
320
+ `Failed to upload files. Please try again. Error: ${JSON.stringify(
321
+ error
322
+ )})`,
313
323
  error.code || 1
314
324
  )
315
325
  );
@@ -390,7 +400,7 @@ function Progress({ done, total }: { done: number; total: number }) {
390
400
  return (
391
401
  <>
392
402
  <Text>
393
- <Spinner type="earth" />
403
+ {isInteractive() ? <Spinner type="earth" /> : null}
394
404
  {` Uploading... (${done}/${total})\n`}
395
405
  </Text>
396
406
  </>
@@ -19,6 +19,7 @@ type EventContext<Env, P extends string, Data> = {
19
19
  request: Request;
20
20
  functionPath: string;
21
21
  waitUntil: (promise: Promise<unknown>) => void;
22
+ passThroughOnException: () => void;
22
23
  next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
23
24
  env: Env & { ASSETS: { fetch: typeof fetch } };
24
25
  params: Params<P>;
@@ -29,6 +30,7 @@ type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
29
30
  request: Request;
30
31
  functionPath: string;
31
32
  waitUntil: (promise: Promise<unknown>) => void;
33
+ passThroughOnException: () => void;
32
34
  next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
33
35
  env: Env & { ASSETS: { fetch: typeof fetch } };
34
36
  params: Params<P>;
@@ -146,6 +148,8 @@ export default function (pluginArgs) {
146
148
  pluginArgs,
147
149
  env,
148
150
  waitUntil: workerContext.waitUntil.bind(workerContext),
151
+ passThroughOnException:
152
+ workerContext.passThroughOnException.bind(workerContext),
149
153
  };
150
154
 
151
155
  const response = await handler(context);
@@ -19,6 +19,7 @@ type EventContext<Env, P extends string, Data> = {
19
19
  request: Request;
20
20
  functionPath: string;
21
21
  waitUntil: (promise: Promise<unknown>) => void;
22
+ passThroughOnException: () => void;
22
23
  next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
23
24
  env: Env & { ASSETS: { fetch: typeof fetch } };
24
25
  params: Params<P>;
@@ -53,6 +54,7 @@ type FetchEnv = {
53
54
 
54
55
  type WorkerContext = {
55
56
  waitUntil: (promise: Promise<unknown>) => void;
57
+ passThroughOnException: () => void;
56
58
  };
57
59
 
58
60
  function* executeRequest(request: Request) {
@@ -111,9 +113,16 @@ function* executeRequest(request: Request) {
111
113
  }
112
114
 
113
115
  export default {
114
- async fetch(request: Request, env: FetchEnv, workerContext: WorkerContext) {
116
+ async fetch(
117
+ originalRequest: Request,
118
+ env: FetchEnv,
119
+ workerContext: WorkerContext
120
+ ) {
121
+ let request = originalRequest;
115
122
  const handlerIterator = executeRequest(request);
116
123
  const data = {}; // arbitrary data the user can set between functions
124
+ let isFailOpen = false;
125
+
117
126
  const next = async (input?: RequestInfo, init?: RequestInit) => {
118
127
  if (input !== undefined) {
119
128
  let url = input;
@@ -135,6 +144,9 @@ export default {
135
144
  data,
136
145
  env,
137
146
  waitUntil: workerContext.waitUntil.bind(workerContext),
147
+ passThroughOnException: () => {
148
+ isFailOpen = true;
149
+ },
138
150
  };
139
151
 
140
152
  const response = await handler(context);
@@ -156,9 +168,14 @@ export default {
156
168
  };
157
169
 
158
170
  try {
159
- return next();
160
- } catch (err) {
161
- return new Response("Internal Error", { status: 500 });
171
+ return await next();
172
+ } catch (error) {
173
+ if (isFailOpen) {
174
+ const response = await env[__FALLBACK_SERVICE__].fetch(request);
175
+ return cloneResponse(response);
176
+ }
177
+
178
+ throw error;
162
179
  }
163
180
  },
164
181
  };
@@ -80868,7 +80868,7 @@ var require_minimatch = __commonJS({
80868
80868
  "../../node_modules/minimatch/minimatch.js"(exports2, module2) {
80869
80869
  init_import_meta_url();
80870
80870
  module2.exports = minimatch;
80871
- minimatch.Minimatch = Minimatch;
80871
+ minimatch.Minimatch = Minimatch2;
80872
80872
  var path36 = function() {
80873
80873
  try {
80874
80874
  return require("path");
@@ -80878,7 +80878,7 @@ var require_minimatch = __commonJS({
80878
80878
  sep: "/"
80879
80879
  };
80880
80880
  minimatch.sep = path36.sep;
80881
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
80881
+ var GLOBSTAR = minimatch.GLOBSTAR = Minimatch2.GLOBSTAR = {};
80882
80882
  var expand = require_brace_expansion();
80883
80883
  var plTypes = {
80884
80884
  "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
@@ -80925,7 +80925,7 @@ var require_minimatch = __commonJS({
80925
80925
  var m = function minimatch2(p, pattern, options) {
80926
80926
  return orig(p, pattern, ext(def, options));
80927
80927
  };
80928
- m.Minimatch = function Minimatch2(pattern, options) {
80928
+ m.Minimatch = function Minimatch3(pattern, options) {
80929
80929
  return new orig.Minimatch(pattern, ext(def, options));
80930
80930
  };
80931
80931
  m.Minimatch.defaults = function defaults(options) {
@@ -80948,7 +80948,7 @@ var require_minimatch = __commonJS({
80948
80948
  };
80949
80949
  return m;
80950
80950
  };
80951
- Minimatch.defaults = function(def) {
80951
+ Minimatch2.defaults = function(def) {
80952
80952
  return minimatch.defaults(def).Minimatch;
80953
80953
  };
80954
80954
  function minimatch(p, pattern, options) {
@@ -80958,11 +80958,11 @@ var require_minimatch = __commonJS({
80958
80958
  if (!options.nocomment && pattern.charAt(0) === "#") {
80959
80959
  return false;
80960
80960
  }
80961
- return new Minimatch(pattern, options).match(p);
80961
+ return new Minimatch2(pattern, options).match(p);
80962
80962
  }
80963
- function Minimatch(pattern, options) {
80964
- if (!(this instanceof Minimatch)) {
80965
- return new Minimatch(pattern, options);
80963
+ function Minimatch2(pattern, options) {
80964
+ if (!(this instanceof Minimatch2)) {
80965
+ return new Minimatch2(pattern, options);
80966
80966
  }
80967
80967
  assertValidPattern(pattern);
80968
80968
  if (!options)
@@ -80981,9 +80981,9 @@ var require_minimatch = __commonJS({
80981
80981
  this.partial = !!options.partial;
80982
80982
  this.make();
80983
80983
  }
80984
- Minimatch.prototype.debug = function() {
80984
+ Minimatch2.prototype.debug = function() {
80985
80985
  };
80986
- Minimatch.prototype.make = make;
80986
+ Minimatch2.prototype.make = make;
80987
80987
  function make() {
80988
80988
  var pattern = this.pattern;
80989
80989
  var options = this.options;
@@ -81016,7 +81016,7 @@ var require_minimatch = __commonJS({
81016
81016
  this.debug(this.pattern, set);
81017
81017
  this.set = set;
81018
81018
  }
81019
- Minimatch.prototype.parseNegate = parseNegate;
81019
+ Minimatch2.prototype.parseNegate = parseNegate;
81020
81020
  function parseNegate() {
81021
81021
  var pattern = this.pattern;
81022
81022
  var negate = false;
@@ -81035,10 +81035,10 @@ var require_minimatch = __commonJS({
81035
81035
  minimatch.braceExpand = function(pattern, options) {
81036
81036
  return braceExpand(pattern, options);
81037
81037
  };
81038
- Minimatch.prototype.braceExpand = braceExpand;
81038
+ Minimatch2.prototype.braceExpand = braceExpand;
81039
81039
  function braceExpand(pattern, options) {
81040
81040
  if (!options) {
81041
- if (this instanceof Minimatch) {
81041
+ if (this instanceof Minimatch2) {
81042
81042
  options = this.options;
81043
81043
  } else {
81044
81044
  options = {};
@@ -81060,7 +81060,7 @@ var require_minimatch = __commonJS({
81060
81060
  throw new TypeError("pattern is too long");
81061
81061
  }
81062
81062
  };
81063
- Minimatch.prototype.parse = parse2;
81063
+ Minimatch2.prototype.parse = parse2;
81064
81064
  var SUBPARSE = {};
81065
81065
  function parse2(pattern, isSub) {
81066
81066
  assertValidPattern(pattern);
@@ -81295,9 +81295,9 @@ var require_minimatch = __commonJS({
81295
81295
  return regExp;
81296
81296
  }
81297
81297
  minimatch.makeRe = function(pattern, options) {
81298
- return new Minimatch(pattern, options || {}).makeRe();
81298
+ return new Minimatch2(pattern, options || {}).makeRe();
81299
81299
  };
81300
- Minimatch.prototype.makeRe = makeRe;
81300
+ Minimatch2.prototype.makeRe = makeRe;
81301
81301
  function makeRe() {
81302
81302
  if (this.regexp || this.regexp === false)
81303
81303
  return this.regexp;
@@ -81326,7 +81326,7 @@ var require_minimatch = __commonJS({
81326
81326
  }
81327
81327
  minimatch.match = function(list, pattern, options) {
81328
81328
  options = options || {};
81329
- var mm = new Minimatch(pattern, options);
81329
+ var mm = new Minimatch2(pattern, options);
81330
81330
  list = list.filter(function(f) {
81331
81331
  return mm.match(f);
81332
81332
  });
@@ -81335,7 +81335,7 @@ var require_minimatch = __commonJS({
81335
81335
  }
81336
81336
  return list;
81337
81337
  };
81338
- Minimatch.prototype.match = function match(f, partial) {
81338
+ Minimatch2.prototype.match = function match(f, partial) {
81339
81339
  if (typeof partial === "undefined")
81340
81340
  partial = this.partial;
81341
81341
  this.debug("match", f, this.pattern);
@@ -81377,7 +81377,7 @@ var require_minimatch = __commonJS({
81377
81377
  return false;
81378
81378
  return this.negate;
81379
81379
  };
81380
- Minimatch.prototype.matchOne = function(file, pattern, partial) {
81380
+ Minimatch2.prototype.matchOne = function(file, pattern, partial) {
81381
81381
  var options = this.options;
81382
81382
  this.debug(
81383
81383
  "matchOne",
@@ -81542,7 +81542,7 @@ var require_common = __commonJS({
81542
81542
  var path36 = require("path");
81543
81543
  var minimatch = require_minimatch();
81544
81544
  var isAbsolute = require_path_is_absolute();
81545
- var Minimatch = minimatch.Minimatch;
81545
+ var Minimatch2 = minimatch.Minimatch;
81546
81546
  function alphasort(a, b) {
81547
81547
  return a.localeCompare(b, "en");
81548
81548
  }
@@ -81558,10 +81558,10 @@ var require_common = __commonJS({
81558
81558
  var gmatcher = null;
81559
81559
  if (pattern.slice(-3) === "/**") {
81560
81560
  var gpattern = pattern.replace(/(\/\*\*)+$/, "");
81561
- gmatcher = new Minimatch(gpattern, { dot: true });
81561
+ gmatcher = new Minimatch2(gpattern, { dot: true });
81562
81562
  }
81563
81563
  return {
81564
- matcher: new Minimatch(pattern, { dot: true }),
81564
+ matcher: new Minimatch2(pattern, { dot: true }),
81565
81565
  gmatcher
81566
81566
  };
81567
81567
  }
@@ -81617,7 +81617,7 @@ var require_common = __commonJS({
81617
81617
  self2.nomount = !!options.nomount;
81618
81618
  options.nonegate = true;
81619
81619
  options.nocomment = true;
81620
- self2.minimatch = new Minimatch(pattern, options);
81620
+ self2.minimatch = new Minimatch2(pattern, options);
81621
81621
  self2.options = self2.minimatch.options;
81622
81622
  }
81623
81623
  function finish(self2) {
@@ -81726,7 +81726,7 @@ var require_sync = __commonJS({
81726
81726
  globSync.GlobSync = GlobSync;
81727
81727
  var rp = require_fs();
81728
81728
  var minimatch = require_minimatch();
81729
- var Minimatch = minimatch.Minimatch;
81729
+ var Minimatch2 = minimatch.Minimatch;
81730
81730
  var Glob = require_glob().Glob;
81731
81731
  var util3 = require("util");
81732
81732
  var path36 = require("path");
@@ -82202,7 +82202,7 @@ var require_glob = __commonJS({
82202
82202
  module2.exports = glob;
82203
82203
  var rp = require_fs();
82204
82204
  var minimatch = require_minimatch();
82205
- var Minimatch = minimatch.Minimatch;
82205
+ var Minimatch2 = minimatch.Minimatch;
82206
82206
  var inherits = require_inherits();
82207
82207
  var EE = require("events").EventEmitter;
82208
82208
  var path36 = require("path");
@@ -133191,6 +133191,710 @@ var require_mime2 = __commonJS({
133191
133191
  }
133192
133192
  });
133193
133193
 
133194
+ // node_modules/minimatch/lib/path.js
133195
+ var require_path = __commonJS({
133196
+ "node_modules/minimatch/lib/path.js"(exports2, module2) {
133197
+ init_import_meta_url();
133198
+ var isWindows2 = typeof process === "object" && process && process.platform === "win32";
133199
+ module2.exports = isWindows2 ? { sep: "\\" } : { sep: "/" };
133200
+ }
133201
+ });
133202
+
133203
+ // node_modules/brace-expansion/index.js
133204
+ var require_brace_expansion2 = __commonJS({
133205
+ "node_modules/brace-expansion/index.js"(exports2, module2) {
133206
+ init_import_meta_url();
133207
+ var balanced = require_balanced_match();
133208
+ module2.exports = expandTop;
133209
+ var escSlash = "\0SLASH" + Math.random() + "\0";
133210
+ var escOpen = "\0OPEN" + Math.random() + "\0";
133211
+ var escClose = "\0CLOSE" + Math.random() + "\0";
133212
+ var escComma = "\0COMMA" + Math.random() + "\0";
133213
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
133214
+ function numeric(str) {
133215
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
133216
+ }
133217
+ function escapeBraces(str) {
133218
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
133219
+ }
133220
+ function unescapeBraces(str) {
133221
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
133222
+ }
133223
+ function parseCommaParts(str) {
133224
+ if (!str)
133225
+ return [""];
133226
+ var parts = [];
133227
+ var m = balanced("{", "}", str);
133228
+ if (!m)
133229
+ return str.split(",");
133230
+ var pre = m.pre;
133231
+ var body = m.body;
133232
+ var post = m.post;
133233
+ var p = pre.split(",");
133234
+ p[p.length - 1] += "{" + body + "}";
133235
+ var postParts = parseCommaParts(post);
133236
+ if (post.length) {
133237
+ p[p.length - 1] += postParts.shift();
133238
+ p.push.apply(p, postParts);
133239
+ }
133240
+ parts.push.apply(parts, p);
133241
+ return parts;
133242
+ }
133243
+ function expandTop(str) {
133244
+ if (!str)
133245
+ return [];
133246
+ if (str.substr(0, 2) === "{}") {
133247
+ str = "\\{\\}" + str.substr(2);
133248
+ }
133249
+ return expand(escapeBraces(str), true).map(unescapeBraces);
133250
+ }
133251
+ function embrace(str) {
133252
+ return "{" + str + "}";
133253
+ }
133254
+ function isPadded(el) {
133255
+ return /^-?0\d/.test(el);
133256
+ }
133257
+ function lte(i2, y) {
133258
+ return i2 <= y;
133259
+ }
133260
+ function gte(i2, y) {
133261
+ return i2 >= y;
133262
+ }
133263
+ function expand(str, isTop) {
133264
+ var expansions = [];
133265
+ var m = balanced("{", "}", str);
133266
+ if (!m)
133267
+ return [str];
133268
+ var pre = m.pre;
133269
+ var post = m.post.length ? expand(m.post, false) : [""];
133270
+ if (/\$$/.test(m.pre)) {
133271
+ for (var k = 0; k < post.length; k++) {
133272
+ var expansion = pre + "{" + m.body + "}" + post[k];
133273
+ expansions.push(expansion);
133274
+ }
133275
+ } else {
133276
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
133277
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
133278
+ var isSequence = isNumericSequence || isAlphaSequence;
133279
+ var isOptions = m.body.indexOf(",") >= 0;
133280
+ if (!isSequence && !isOptions) {
133281
+ if (m.post.match(/,.*\}/)) {
133282
+ str = m.pre + "{" + m.body + escClose + m.post;
133283
+ return expand(str);
133284
+ }
133285
+ return [str];
133286
+ }
133287
+ var n;
133288
+ if (isSequence) {
133289
+ n = m.body.split(/\.\./);
133290
+ } else {
133291
+ n = parseCommaParts(m.body);
133292
+ if (n.length === 1) {
133293
+ n = expand(n[0], false).map(embrace);
133294
+ if (n.length === 1) {
133295
+ return post.map(function(p) {
133296
+ return m.pre + n[0] + p;
133297
+ });
133298
+ }
133299
+ }
133300
+ }
133301
+ var N;
133302
+ if (isSequence) {
133303
+ var x = numeric(n[0]);
133304
+ var y = numeric(n[1]);
133305
+ var width = Math.max(n[0].length, n[1].length);
133306
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
133307
+ var test = lte;
133308
+ var reverse = y < x;
133309
+ if (reverse) {
133310
+ incr *= -1;
133311
+ test = gte;
133312
+ }
133313
+ var pad = n.some(isPadded);
133314
+ N = [];
133315
+ for (var i2 = x; test(i2, y); i2 += incr) {
133316
+ var c;
133317
+ if (isAlphaSequence) {
133318
+ c = String.fromCharCode(i2);
133319
+ if (c === "\\")
133320
+ c = "";
133321
+ } else {
133322
+ c = String(i2);
133323
+ if (pad) {
133324
+ var need = width - c.length;
133325
+ if (need > 0) {
133326
+ var z = new Array(need + 1).join("0");
133327
+ if (i2 < 0)
133328
+ c = "-" + z + c.slice(1);
133329
+ else
133330
+ c = z + c;
133331
+ }
133332
+ }
133333
+ }
133334
+ N.push(c);
133335
+ }
133336
+ } else {
133337
+ N = [];
133338
+ for (var j = 0; j < n.length; j++) {
133339
+ N.push.apply(N, expand(n[j], false));
133340
+ }
133341
+ }
133342
+ for (var j = 0; j < N.length; j++) {
133343
+ for (var k = 0; k < post.length; k++) {
133344
+ var expansion = pre + N[j] + post[k];
133345
+ if (!isTop || isSequence || expansion)
133346
+ expansions.push(expansion);
133347
+ }
133348
+ }
133349
+ }
133350
+ return expansions;
133351
+ }
133352
+ }
133353
+ });
133354
+
133355
+ // node_modules/minimatch/minimatch.js
133356
+ var require_minimatch2 = __commonJS({
133357
+ "node_modules/minimatch/minimatch.js"(exports2, module2) {
133358
+ init_import_meta_url();
133359
+ var minimatch = module2.exports = (p, pattern, options = {}) => {
133360
+ assertValidPattern(pattern);
133361
+ if (!options.nocomment && pattern.charAt(0) === "#") {
133362
+ return false;
133363
+ }
133364
+ return new Minimatch2(pattern, options).match(p);
133365
+ };
133366
+ module2.exports = minimatch;
133367
+ var path36 = require_path();
133368
+ minimatch.sep = path36.sep;
133369
+ var GLOBSTAR = Symbol("globstar **");
133370
+ minimatch.GLOBSTAR = GLOBSTAR;
133371
+ var expand = require_brace_expansion2();
133372
+ var plTypes = {
133373
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
133374
+ "?": { open: "(?:", close: ")?" },
133375
+ "+": { open: "(?:", close: ")+" },
133376
+ "*": { open: "(?:", close: ")*" },
133377
+ "@": { open: "(?:", close: ")" }
133378
+ };
133379
+ var qmark = "[^/]";
133380
+ var star = qmark + "*?";
133381
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
133382
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
133383
+ var charSet = (s) => s.split("").reduce((set, c) => {
133384
+ set[c] = true;
133385
+ return set;
133386
+ }, {});
133387
+ var reSpecials = charSet("().*{}+?[]^$\\!");
133388
+ var addPatternStartSet = charSet("[.(");
133389
+ var slashSplit = /\/+/;
133390
+ minimatch.filter = (pattern, options = {}) => (p, i2, list) => minimatch(p, pattern, options);
133391
+ var ext = (a, b = {}) => {
133392
+ const t2 = {};
133393
+ Object.keys(a).forEach((k) => t2[k] = a[k]);
133394
+ Object.keys(b).forEach((k) => t2[k] = b[k]);
133395
+ return t2;
133396
+ };
133397
+ minimatch.defaults = (def) => {
133398
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
133399
+ return minimatch;
133400
+ }
133401
+ const orig = minimatch;
133402
+ const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
133403
+ m.Minimatch = class Minimatch extends orig.Minimatch {
133404
+ constructor(pattern, options) {
133405
+ super(pattern, ext(def, options));
133406
+ }
133407
+ };
133408
+ m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
133409
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
133410
+ m.defaults = (options) => orig.defaults(ext(def, options));
133411
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
133412
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
133413
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
133414
+ return m;
133415
+ };
133416
+ minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
133417
+ var braceExpand = (pattern, options = {}) => {
133418
+ assertValidPattern(pattern);
133419
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
133420
+ return [pattern];
133421
+ }
133422
+ return expand(pattern);
133423
+ };
133424
+ var MAX_PATTERN_LENGTH = 1024 * 64;
133425
+ var assertValidPattern = (pattern) => {
133426
+ if (typeof pattern !== "string") {
133427
+ throw new TypeError("invalid pattern");
133428
+ }
133429
+ if (pattern.length > MAX_PATTERN_LENGTH) {
133430
+ throw new TypeError("pattern is too long");
133431
+ }
133432
+ };
133433
+ var SUBPARSE = Symbol("subparse");
133434
+ minimatch.makeRe = (pattern, options) => new Minimatch2(pattern, options || {}).makeRe();
133435
+ minimatch.match = (list, pattern, options = {}) => {
133436
+ const mm = new Minimatch2(pattern, options);
133437
+ list = list.filter((f) => mm.match(f));
133438
+ if (mm.options.nonull && !list.length) {
133439
+ list.push(pattern);
133440
+ }
133441
+ return list;
133442
+ };
133443
+ var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
133444
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
133445
+ var Minimatch2 = class {
133446
+ constructor(pattern, options) {
133447
+ assertValidPattern(pattern);
133448
+ if (!options)
133449
+ options = {};
133450
+ this.options = options;
133451
+ this.set = [];
133452
+ this.pattern = pattern;
133453
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
133454
+ if (this.windowsPathsNoEscape) {
133455
+ this.pattern = this.pattern.replace(/\\/g, "/");
133456
+ }
133457
+ this.regexp = null;
133458
+ this.negate = false;
133459
+ this.comment = false;
133460
+ this.empty = false;
133461
+ this.partial = !!options.partial;
133462
+ this.make();
133463
+ }
133464
+ debug() {
133465
+ }
133466
+ make() {
133467
+ const pattern = this.pattern;
133468
+ const options = this.options;
133469
+ if (!options.nocomment && pattern.charAt(0) === "#") {
133470
+ this.comment = true;
133471
+ return;
133472
+ }
133473
+ if (!pattern) {
133474
+ this.empty = true;
133475
+ return;
133476
+ }
133477
+ this.parseNegate();
133478
+ let set = this.globSet = this.braceExpand();
133479
+ if (options.debug)
133480
+ this.debug = (...args) => console.error(...args);
133481
+ this.debug(this.pattern, set);
133482
+ set = this.globParts = set.map((s) => s.split(slashSplit));
133483
+ this.debug(this.pattern, set);
133484
+ set = set.map((s, si2, set2) => s.map(this.parse, this));
133485
+ this.debug(this.pattern, set);
133486
+ set = set.filter((s) => s.indexOf(false) === -1);
133487
+ this.debug(this.pattern, set);
133488
+ this.set = set;
133489
+ }
133490
+ parseNegate() {
133491
+ if (this.options.nonegate)
133492
+ return;
133493
+ const pattern = this.pattern;
133494
+ let negate = false;
133495
+ let negateOffset = 0;
133496
+ for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
133497
+ negate = !negate;
133498
+ negateOffset++;
133499
+ }
133500
+ if (negateOffset)
133501
+ this.pattern = pattern.substr(negateOffset);
133502
+ this.negate = negate;
133503
+ }
133504
+ matchOne(file, pattern, partial) {
133505
+ var options = this.options;
133506
+ this.debug(
133507
+ "matchOne",
133508
+ { "this": this, file, pattern }
133509
+ );
133510
+ this.debug("matchOne", file.length, pattern.length);
133511
+ for (var fi = 0, pi = 0, fl = file.length, pl2 = pattern.length; fi < fl && pi < pl2; fi++, pi++) {
133512
+ this.debug("matchOne loop");
133513
+ var p = pattern[pi];
133514
+ var f = file[fi];
133515
+ this.debug(pattern, p, f);
133516
+ if (p === false)
133517
+ return false;
133518
+ if (p === GLOBSTAR) {
133519
+ this.debug("GLOBSTAR", [pattern, p, f]);
133520
+ var fr2 = fi;
133521
+ var pr = pi + 1;
133522
+ if (pr === pl2) {
133523
+ this.debug("** at the end");
133524
+ for (; fi < fl; fi++) {
133525
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
133526
+ return false;
133527
+ }
133528
+ return true;
133529
+ }
133530
+ while (fr2 < fl) {
133531
+ var swallowee = file[fr2];
133532
+ this.debug("\nglobstar while", file, fr2, pattern, pr, swallowee);
133533
+ if (this.matchOne(file.slice(fr2), pattern.slice(pr), partial)) {
133534
+ this.debug("globstar found match!", fr2, fl, swallowee);
133535
+ return true;
133536
+ } else {
133537
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
133538
+ this.debug("dot detected!", file, fr2, pattern, pr);
133539
+ break;
133540
+ }
133541
+ this.debug("globstar swallow a segment, and continue");
133542
+ fr2++;
133543
+ }
133544
+ }
133545
+ if (partial) {
133546
+ this.debug("\n>>> no match, partial?", file, fr2, pattern, pr);
133547
+ if (fr2 === fl)
133548
+ return true;
133549
+ }
133550
+ return false;
133551
+ }
133552
+ var hit;
133553
+ if (typeof p === "string") {
133554
+ hit = f === p;
133555
+ this.debug("string match", p, f, hit);
133556
+ } else {
133557
+ hit = f.match(p);
133558
+ this.debug("pattern match", p, f, hit);
133559
+ }
133560
+ if (!hit)
133561
+ return false;
133562
+ }
133563
+ if (fi === fl && pi === pl2) {
133564
+ return true;
133565
+ } else if (fi === fl) {
133566
+ return partial;
133567
+ } else if (pi === pl2) {
133568
+ return fi === fl - 1 && file[fi] === "";
133569
+ }
133570
+ throw new Error("wtf?");
133571
+ }
133572
+ braceExpand() {
133573
+ return braceExpand(this.pattern, this.options);
133574
+ }
133575
+ parse(pattern, isSub) {
133576
+ assertValidPattern(pattern);
133577
+ const options = this.options;
133578
+ if (pattern === "**") {
133579
+ if (!options.noglobstar)
133580
+ return GLOBSTAR;
133581
+ else
133582
+ pattern = "*";
133583
+ }
133584
+ if (pattern === "")
133585
+ return "";
133586
+ let re = "";
133587
+ let hasMagic = !!options.nocase;
133588
+ let escaping = false;
133589
+ const patternListStack = [];
133590
+ const negativeLists = [];
133591
+ let stateChar;
133592
+ let inClass = false;
133593
+ let reClassStart = -1;
133594
+ let classStart = -1;
133595
+ let cs2;
133596
+ let pl2;
133597
+ let sp;
133598
+ const patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
133599
+ const clearStateChar = () => {
133600
+ if (stateChar) {
133601
+ switch (stateChar) {
133602
+ case "*":
133603
+ re += star;
133604
+ hasMagic = true;
133605
+ break;
133606
+ case "?":
133607
+ re += qmark;
133608
+ hasMagic = true;
133609
+ break;
133610
+ default:
133611
+ re += "\\" + stateChar;
133612
+ break;
133613
+ }
133614
+ this.debug("clearStateChar %j %j", stateChar, re);
133615
+ stateChar = false;
133616
+ }
133617
+ };
133618
+ for (let i2 = 0, c; i2 < pattern.length && (c = pattern.charAt(i2)); i2++) {
133619
+ this.debug("%s %s %s %j", pattern, i2, re, c);
133620
+ if (escaping) {
133621
+ if (c === "/") {
133622
+ return false;
133623
+ }
133624
+ if (reSpecials[c]) {
133625
+ re += "\\";
133626
+ }
133627
+ re += c;
133628
+ escaping = false;
133629
+ continue;
133630
+ }
133631
+ switch (c) {
133632
+ case "/": {
133633
+ return false;
133634
+ }
133635
+ case "\\":
133636
+ clearStateChar();
133637
+ escaping = true;
133638
+ continue;
133639
+ case "?":
133640
+ case "*":
133641
+ case "+":
133642
+ case "@":
133643
+ case "!":
133644
+ this.debug("%s %s %s %j <-- stateChar", pattern, i2, re, c);
133645
+ if (inClass) {
133646
+ this.debug(" in class");
133647
+ if (c === "!" && i2 === classStart + 1)
133648
+ c = "^";
133649
+ re += c;
133650
+ continue;
133651
+ }
133652
+ this.debug("call clearStateChar %j", stateChar);
133653
+ clearStateChar();
133654
+ stateChar = c;
133655
+ if (options.noext)
133656
+ clearStateChar();
133657
+ continue;
133658
+ case "(":
133659
+ if (inClass) {
133660
+ re += "(";
133661
+ continue;
133662
+ }
133663
+ if (!stateChar) {
133664
+ re += "\\(";
133665
+ continue;
133666
+ }
133667
+ patternListStack.push({
133668
+ type: stateChar,
133669
+ start: i2 - 1,
133670
+ reStart: re.length,
133671
+ open: plTypes[stateChar].open,
133672
+ close: plTypes[stateChar].close
133673
+ });
133674
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
133675
+ this.debug("plType %j %j", stateChar, re);
133676
+ stateChar = false;
133677
+ continue;
133678
+ case ")":
133679
+ if (inClass || !patternListStack.length) {
133680
+ re += "\\)";
133681
+ continue;
133682
+ }
133683
+ clearStateChar();
133684
+ hasMagic = true;
133685
+ pl2 = patternListStack.pop();
133686
+ re += pl2.close;
133687
+ if (pl2.type === "!") {
133688
+ negativeLists.push(pl2);
133689
+ }
133690
+ pl2.reEnd = re.length;
133691
+ continue;
133692
+ case "|":
133693
+ if (inClass || !patternListStack.length) {
133694
+ re += "\\|";
133695
+ continue;
133696
+ }
133697
+ clearStateChar();
133698
+ re += "|";
133699
+ continue;
133700
+ case "[":
133701
+ clearStateChar();
133702
+ if (inClass) {
133703
+ re += "\\" + c;
133704
+ continue;
133705
+ }
133706
+ inClass = true;
133707
+ classStart = i2;
133708
+ reClassStart = re.length;
133709
+ re += c;
133710
+ continue;
133711
+ case "]":
133712
+ if (i2 === classStart + 1 || !inClass) {
133713
+ re += "\\" + c;
133714
+ continue;
133715
+ }
133716
+ cs2 = pattern.substring(classStart + 1, i2);
133717
+ try {
133718
+ RegExp("[" + cs2 + "]");
133719
+ } catch (er) {
133720
+ sp = this.parse(cs2, SUBPARSE);
133721
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
133722
+ hasMagic = hasMagic || sp[1];
133723
+ inClass = false;
133724
+ continue;
133725
+ }
133726
+ hasMagic = true;
133727
+ inClass = false;
133728
+ re += c;
133729
+ continue;
133730
+ default:
133731
+ clearStateChar();
133732
+ if (reSpecials[c] && !(c === "^" && inClass)) {
133733
+ re += "\\";
133734
+ }
133735
+ re += c;
133736
+ break;
133737
+ }
133738
+ }
133739
+ if (inClass) {
133740
+ cs2 = pattern.substr(classStart + 1);
133741
+ sp = this.parse(cs2, SUBPARSE);
133742
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
133743
+ hasMagic = hasMagic || sp[1];
133744
+ }
133745
+ for (pl2 = patternListStack.pop(); pl2; pl2 = patternListStack.pop()) {
133746
+ let tail;
133747
+ tail = re.slice(pl2.reStart + pl2.open.length);
133748
+ this.debug("setting tail", re, pl2);
133749
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_2, $1, $2) => {
133750
+ if (!$2) {
133751
+ $2 = "\\";
133752
+ }
133753
+ return $1 + $1 + $2 + "|";
133754
+ });
133755
+ this.debug("tail=%j\n %s", tail, tail, pl2, re);
133756
+ const t2 = pl2.type === "*" ? star : pl2.type === "?" ? qmark : "\\" + pl2.type;
133757
+ hasMagic = true;
133758
+ re = re.slice(0, pl2.reStart) + t2 + "\\(" + tail;
133759
+ }
133760
+ clearStateChar();
133761
+ if (escaping) {
133762
+ re += "\\\\";
133763
+ }
133764
+ const addPatternStart = addPatternStartSet[re.charAt(0)];
133765
+ for (let n = negativeLists.length - 1; n > -1; n--) {
133766
+ const nl = negativeLists[n];
133767
+ const nlBefore = re.slice(0, nl.reStart);
133768
+ const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
133769
+ let nlAfter = re.slice(nl.reEnd);
133770
+ const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
133771
+ const openParensBefore = nlBefore.split("(").length - 1;
133772
+ let cleanAfter = nlAfter;
133773
+ for (let i2 = 0; i2 < openParensBefore; i2++) {
133774
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
133775
+ }
133776
+ nlAfter = cleanAfter;
133777
+ const dollar = nlAfter === "" && isSub !== SUBPARSE ? "$" : "";
133778
+ re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
133779
+ }
133780
+ if (re !== "" && hasMagic) {
133781
+ re = "(?=.)" + re;
133782
+ }
133783
+ if (addPatternStart) {
133784
+ re = patternStart + re;
133785
+ }
133786
+ if (isSub === SUBPARSE) {
133787
+ return [re, hasMagic];
133788
+ }
133789
+ if (!hasMagic) {
133790
+ return globUnescape(pattern);
133791
+ }
133792
+ const flags = options.nocase ? "i" : "";
133793
+ try {
133794
+ return Object.assign(new RegExp("^" + re + "$", flags), {
133795
+ _glob: pattern,
133796
+ _src: re
133797
+ });
133798
+ } catch (er) {
133799
+ return new RegExp("$.");
133800
+ }
133801
+ }
133802
+ makeRe() {
133803
+ if (this.regexp || this.regexp === false)
133804
+ return this.regexp;
133805
+ const set = this.set;
133806
+ if (!set.length) {
133807
+ this.regexp = false;
133808
+ return this.regexp;
133809
+ }
133810
+ const options = this.options;
133811
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
133812
+ const flags = options.nocase ? "i" : "";
133813
+ let re = set.map((pattern) => {
133814
+ pattern = pattern.map(
133815
+ (p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src
133816
+ ).reduce((set2, p) => {
133817
+ if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
133818
+ set2.push(p);
133819
+ }
133820
+ return set2;
133821
+ }, []);
133822
+ pattern.forEach((p, i2) => {
133823
+ if (p !== GLOBSTAR || pattern[i2 - 1] === GLOBSTAR) {
133824
+ return;
133825
+ }
133826
+ if (i2 === 0) {
133827
+ if (pattern.length > 1) {
133828
+ pattern[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i2 + 1];
133829
+ } else {
133830
+ pattern[i2] = twoStar;
133831
+ }
133832
+ } else if (i2 === pattern.length - 1) {
133833
+ pattern[i2 - 1] += "(?:\\/|" + twoStar + ")?";
133834
+ } else {
133835
+ pattern[i2 - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i2 + 1];
133836
+ pattern[i2 + 1] = GLOBSTAR;
133837
+ }
133838
+ });
133839
+ return pattern.filter((p) => p !== GLOBSTAR).join("/");
133840
+ }).join("|");
133841
+ re = "^(?:" + re + ")$";
133842
+ if (this.negate)
133843
+ re = "^(?!" + re + ").*$";
133844
+ try {
133845
+ this.regexp = new RegExp(re, flags);
133846
+ } catch (ex) {
133847
+ this.regexp = false;
133848
+ }
133849
+ return this.regexp;
133850
+ }
133851
+ match(f, partial = this.partial) {
133852
+ this.debug("match", f, this.pattern);
133853
+ if (this.comment)
133854
+ return false;
133855
+ if (this.empty)
133856
+ return f === "";
133857
+ if (f === "/" && partial)
133858
+ return true;
133859
+ const options = this.options;
133860
+ if (path36.sep !== "/") {
133861
+ f = f.split(path36.sep).join("/");
133862
+ }
133863
+ f = f.split(slashSplit);
133864
+ this.debug(this.pattern, "split", f);
133865
+ const set = this.set;
133866
+ this.debug(this.pattern, "set", set);
133867
+ let filename;
133868
+ for (let i2 = f.length - 1; i2 >= 0; i2--) {
133869
+ filename = f[i2];
133870
+ if (filename)
133871
+ break;
133872
+ }
133873
+ for (let i2 = 0; i2 < set.length; i2++) {
133874
+ const pattern = set[i2];
133875
+ let file = f;
133876
+ if (options.matchBase && pattern.length === 1) {
133877
+ file = [filename];
133878
+ }
133879
+ const hit = this.matchOne(file, pattern, partial);
133880
+ if (hit) {
133881
+ if (options.flipNegate)
133882
+ return true;
133883
+ return !this.negate;
133884
+ }
133885
+ }
133886
+ if (options.flipNegate)
133887
+ return false;
133888
+ return this.negate;
133889
+ }
133890
+ static defaults(def) {
133891
+ return minimatch.defaults(def).Minimatch;
133892
+ }
133893
+ };
133894
+ minimatch.Minimatch = Minimatch2;
133895
+ }
133896
+ });
133897
+
133194
133898
  // ../../node_modules/eventemitter3/index.js
133195
133899
  var require_eventemitter3 = __commonJS({
133196
133900
  "../../node_modules/eventemitter3/index.js"(exports2, module2) {
@@ -140329,7 +141033,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
140329
141033
  var wrapper_default = import_websocket.default;
140330
141034
 
140331
141035
  // package.json
140332
- var version = "2.1.14";
141036
+ var version = "2.1.15";
140333
141037
  var package_default = {
140334
141038
  name: "wrangler",
140335
141039
  version,
@@ -140492,6 +141196,7 @@ var package_default = {
140492
141196
  "jest-fetch-mock": "^3.0.3",
140493
141197
  "jest-websocket-mock": "^2.3.0",
140494
141198
  mime: "^3.0.0",
141199
+ minimatch: "^5.1.0",
140495
141200
  msw: "^0.47.1",
140496
141201
  "npx-import": "^1.1.3",
140497
141202
  open: "^8.4.0",
@@ -142467,6 +143172,9 @@ var CI = {
142467
143172
  // src/is-interactive.ts
142468
143173
  init_import_meta_url();
142469
143174
  function isInteractive() {
143175
+ if (process.env.CF_PAGES === "1") {
143176
+ return false;
143177
+ }
142470
143178
  try {
142471
143179
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
142472
143180
  } catch {
@@ -154933,6 +155641,8 @@ var import_node_path29 = require("node:path");
154933
155641
 
154934
155642
  // src/pages/constants.ts
154935
155643
  init_import_meta_url();
155644
+ var MAX_ASSET_COUNT = 2e4;
155645
+ var MAX_ASSET_SIZE = 25 * 1024 * 1024;
154936
155646
  var PAGES_CONFIG_CACHE_FILENAME = "pages.json";
154937
155647
  var MAX_BUCKET_SIZE = 50 * 1024 * 1024;
154938
155648
  var MAX_BUCKET_FILE_COUNT = 5e3;
@@ -156768,6 +157478,7 @@ var import_node_path33 = require("node:path");
156768
157478
  var import_ink12 = __toESM(require_build2());
156769
157479
  var import_ink_spinner = __toESM(require_build5());
156770
157480
  var import_mime = __toESM(require_mime2());
157481
+ var import_minimatch = __toESM(require_minimatch2());
156771
157482
 
156772
157483
  // ../../node_modules/p-queue/dist/index.js
156773
157484
  init_import_meta_url();
@@ -157250,19 +157961,23 @@ var upload = async (args) => {
157250
157961
  "_redirects",
157251
157962
  "_headers",
157252
157963
  "_routes.json",
157253
- ".DS_Store",
157254
- "node_modules",
157255
- ".git"
157256
- ];
157964
+ "functions",
157965
+ "**/.DS_Store",
157966
+ "**/node_modules",
157967
+ "**/.git"
157968
+ ].map((pattern) => new import_minimatch.Minimatch(pattern));
157257
157969
  const directory = (0, import_node_path33.resolve)(args.directory);
157258
157970
  const walk = async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
157259
157971
  const files2 = await (0, import_promises14.readdir)(dir);
157260
157972
  await Promise.all(
157261
157973
  files2.map(async (file) => {
157262
157974
  const filepath = (0, import_node_path33.join)(dir, file);
157975
+ const relativeFilepath = (0, import_node_path33.relative)(startingDir, filepath);
157263
157976
  const filestat = await (0, import_promises14.stat)(filepath);
157264
- if (IGNORE_LIST.includes(file)) {
157265
- return;
157977
+ for (const minimatch of IGNORE_LIST) {
157978
+ if (minimatch.match(relativeFilepath)) {
157979
+ return;
157980
+ }
157266
157981
  }
157267
157982
  if (filestat.isSymbolicLink()) {
157268
157983
  return;
@@ -157270,11 +157985,11 @@ var upload = async (args) => {
157270
157985
  if (filestat.isDirectory()) {
157271
157986
  fileMap2 = await walk(filepath, fileMap2, startingDir);
157272
157987
  } else {
157273
- const name = (0, import_node_path33.relative)(startingDir, filepath).split(import_node_path33.sep).join("/");
157274
- if (filestat.size > 25 * 1024 * 1024) {
157988
+ const name = relativeFilepath.split(import_node_path33.sep).join("/");
157989
+ if (filestat.size > MAX_ASSET_SIZE) {
157275
157990
  throw new FatalError(
157276
157991
  `Error: Pages only supports files up to ${prettyBytes(
157277
- 25 * 1024 * 1024
157992
+ MAX_ASSET_SIZE
157278
157993
  )} in size
157279
157994
  ${name} is ${prettyBytes(filestat.size)} in size`,
157280
157995
  1
@@ -157292,9 +158007,9 @@ ${name} is ${prettyBytes(filestat.size)} in size`,
157292
158007
  return fileMap2;
157293
158008
  };
157294
158009
  const fileMap = await walk(directory);
157295
- if (fileMap.size > 2e4) {
158010
+ if (fileMap.size > MAX_ASSET_COUNT) {
157296
158011
  throw new FatalError(
157297
- `Error: Pages only supports up to 20,000 files in a deployment. Ensure you have specified your build output directory correctly.`,
158012
+ `Error: Pages only supports up to ${MAX_ASSET_COUNT.toLocaleString()} files in a deployment. Ensure you have specified your build output directory correctly.`,
157298
158013
  1
157299
158014
  );
157300
158015
  }
@@ -157412,7 +158127,9 @@ ${name} is ${prettyBytes(filestat.size)} in size`,
157412
158127
  (error) => {
157413
158128
  return Promise.reject(
157414
158129
  new FatalError(
157415
- "Failed to upload files. Please try again.",
158130
+ `Failed to upload files. Please try again. Error: ${JSON.stringify(
158131
+ error
158132
+ )})`,
157416
158133
  error.code || 1
157417
158134
  )
157418
158135
  );
@@ -157476,9 +158193,9 @@ function formatTime(duration) {
157476
158193
  return `(${(duration / 1e3).toFixed(2)} sec)`;
157477
158194
  }
157478
158195
  function Progress({ done, total }) {
157479
- return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_ink12.Text, null, /* @__PURE__ */ import_react16.default.createElement(import_ink_spinner.default, {
158196
+ return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_ink12.Text, null, isInteractive() ? /* @__PURE__ */ import_react16.default.createElement(import_ink_spinner.default, {
157480
158197
  type: "earth"
157481
- }), ` Uploading... (${done}/${total})
158198
+ }) : null, ` Uploading... (${done}/${total})
157482
158199
  `));
157483
158200
  }
157484
158201