sst 2.0.0-rc.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/bootstrap.d.ts +2 -4
  2. package/bootstrap.js +208 -61
  3. package/bus.d.ts +3 -3
  4. package/bus.js +1 -1
  5. package/cache.js +1 -1
  6. package/cdk/cloudformation-deployments-wrapper.d.ts +3 -0
  7. package/cdk/cloudformation-deployments-wrapper.js +117 -0
  8. package/cdk/cloudformation-deployments.d.ts +19 -4
  9. package/cdk/deploy-stack.d.ts +17 -2
  10. package/cdk/deploy-stack.js +6 -1
  11. package/cli/colors.d.ts +28 -0
  12. package/cli/colors.js +27 -0
  13. package/cli/commands/bind.d.ts +4 -0
  14. package/cli/commands/bind.js +10 -7
  15. package/cli/commands/bootstrap.d.ts +13 -0
  16. package/cli/commands/bootstrap.js +11 -0
  17. package/cli/commands/build.d.ts +6 -2
  18. package/cli/commands/build.js +13 -8
  19. package/cli/commands/console.d.ts +5 -1
  20. package/cli/commands/console.js +8 -6
  21. package/cli/commands/deploy.d.ts +4 -2
  22. package/cli/commands/deploy.js +71 -29
  23. package/cli/commands/dev.d.ts +5 -1
  24. package/cli/commands/dev.js +157 -79
  25. package/cli/commands/diff.d.ts +15 -0
  26. package/cli/commands/diff.js +61 -0
  27. package/cli/commands/env.d.ts +5 -1
  28. package/cli/commands/env.js +14 -15
  29. package/cli/commands/plugins/kysely.js +13 -5
  30. package/cli/commands/plugins/pothos.js +9 -4
  31. package/cli/commands/remove.d.ts +4 -0
  32. package/cli/commands/remove.js +26 -18
  33. package/cli/commands/secrets/get.d.ts +7 -3
  34. package/cli/commands/secrets/get.js +11 -24
  35. package/cli/commands/secrets/list.d.ts +6 -2
  36. package/cli/commands/secrets/list.js +15 -7
  37. package/cli/commands/secrets/remove.d.ts +8 -4
  38. package/cli/commands/secrets/remove.js +18 -16
  39. package/cli/commands/secrets/secrets.js +3 -3
  40. package/cli/commands/secrets/set.d.ts +8 -6
  41. package/cli/commands/secrets/set.js +16 -33
  42. package/cli/commands/telemetry.d.ts +15 -0
  43. package/cli/commands/telemetry.js +17 -0
  44. package/cli/commands/transform.d.ts +15 -0
  45. package/cli/commands/transform.js +55 -0
  46. package/cli/commands/update.d.ts +6 -2
  47. package/cli/commands/update.js +41 -33
  48. package/cli/commands/version.d.ts +13 -0
  49. package/cli/commands/version.js +7 -0
  50. package/cli/local/router.d.ts +6 -6
  51. package/cli/local/router.js +3 -3
  52. package/cli/local/server.d.ts +5 -3
  53. package/cli/local/server.js +21 -14
  54. package/cli/program.d.ts +5 -1
  55. package/cli/program.js +29 -5
  56. package/cli/spinner.js +2 -0
  57. package/cli/sst.js +35 -23
  58. package/cli/telemetry/environment.d.ts +1 -1
  59. package/cli/telemetry/environment.js +1 -1
  60. package/cli/terminal.d.ts +1 -0
  61. package/cli/terminal.js +8 -0
  62. package/cli/ui/deploy.d.ts +3 -2
  63. package/cli/ui/deploy.js +106 -106
  64. package/cli/ui/functions.d.ts +2 -0
  65. package/cli/ui/functions.js +132 -0
  66. package/cli/ui/header.d.ts +5 -0
  67. package/cli/ui/header.js +16 -0
  68. package/cli/ui/stack.d.ts +1 -0
  69. package/cli/ui/stack.js +6 -0
  70. package/config.d.ts +1 -1
  71. package/config.js +8 -8
  72. package/constructs/Api.d.ts +3 -71
  73. package/constructs/Api.js +3 -42
  74. package/constructs/ApiGatewayV1Api.d.ts +3 -3
  75. package/constructs/ApiGatewayV1Api.js +4 -3
  76. package/constructs/App.d.ts +2 -22
  77. package/constructs/App.js +12 -25
  78. package/constructs/AppSyncApi.d.ts +4 -5
  79. package/constructs/AppSyncApi.js +8 -5
  80. package/constructs/AstroSite.d.ts +2 -3
  81. package/constructs/AstroSite.js +43 -53
  82. package/constructs/Auth.js +27 -16
  83. package/constructs/BaseSite.d.ts +10 -10
  84. package/constructs/BaseSite.js +2 -2
  85. package/constructs/Cognito.js +28 -28
  86. package/constructs/EdgeFunction.d.ts +6 -4
  87. package/constructs/EdgeFunction.js +56 -59
  88. package/constructs/EventBus.js +1 -1
  89. package/constructs/Function.d.ts +4 -44
  90. package/constructs/Function.js +14 -50
  91. package/constructs/FunctionalStack.d.ts +2 -2
  92. package/constructs/Job.d.ts +23 -63
  93. package/constructs/Job.js +11 -32
  94. package/constructs/Metadata.d.ts +18 -20
  95. package/constructs/NextjsSite.d.ts +21 -5
  96. package/constructs/NextjsSite.js +67 -101
  97. package/constructs/Queue.js +10 -10
  98. package/constructs/RDS.d.ts +1 -1
  99. package/constructs/RDS.js +1 -1
  100. package/constructs/RemixSite.d.ts +0 -2
  101. package/constructs/RemixSite.js +20 -20
  102. package/constructs/Script.js +1 -1
  103. package/constructs/Secret.js +5 -3
  104. package/constructs/SolidStartSite.d.ts +2 -3
  105. package/constructs/SolidStartSite.js +42 -52
  106. package/constructs/SsrFunction.d.ts +22 -0
  107. package/constructs/SsrFunction.js +113 -0
  108. package/constructs/SsrSite.d.ts +104 -104
  109. package/constructs/SsrSite.js +196 -217
  110. package/constructs/Stack.d.ts +1 -20
  111. package/constructs/Stack.js +3 -65
  112. package/constructs/StaticSite.d.ts +33 -53
  113. package/constructs/StaticSite.js +92 -118
  114. package/constructs/Table.d.ts +1 -1
  115. package/constructs/Table.js +4 -4
  116. package/constructs/Topic.js +1 -1
  117. package/constructs/cdk/certificate-base.d.ts +18 -0
  118. package/constructs/cdk/certificate-base.js +26 -0
  119. package/constructs/cdk/dns-validated-certificate.d.ts +77 -0
  120. package/constructs/cdk/dns-validated-certificate.js +125 -0
  121. package/constructs/cdk/website-redirect.d.ts +53 -0
  122. package/constructs/cdk/website-redirect.js +77 -0
  123. package/constructs/deferred_task.d.ts +1 -1
  124. package/constructs/deprecated/NextjsSite.js +8 -6
  125. package/constructs/index.d.ts +0 -6
  126. package/constructs/index.js +0 -6
  127. package/constructs/util/apiGatewayV1AccessLog.d.ts +1 -1
  128. package/constructs/util/apiGatewayV2AccessLog.js +4 -4
  129. package/constructs/util/apiGatewayV2Domain.js +9 -2
  130. package/constructs/util/appSyncApiDomain.d.ts +1 -1
  131. package/constructs/util/appSyncApiDomain.js +9 -15
  132. package/constructs/util/duration.d.ts +1 -1
  133. package/constructs/util/functionBinding.js +1 -1
  134. package/constructs/util/permission.d.ts +3 -3
  135. package/constructs/util/permission.js +16 -18
  136. package/constructs/util/size.d.ts +1 -1
  137. package/constructs/util/warning.js +2 -2
  138. package/context/context.d.ts +2 -2
  139. package/context/context.js +4 -4
  140. package/context/handler.d.ts +1 -1
  141. package/credentials.d.ts +1 -1
  142. package/credentials.js +42 -6
  143. package/index.d.ts +1 -0
  144. package/index.js +1 -0
  145. package/iot.js +6 -2
  146. package/logger.js +3 -1
  147. package/node/api/index.d.ts +4 -3
  148. package/node/api/index.js +8 -2
  149. package/node/auth/adapter/adapter.d.ts +1 -1
  150. package/node/auth/adapter/facebook.js +1 -1
  151. package/node/auth/adapter/github.js +4 -4
  152. package/node/auth/adapter/google.d.ts +1 -1
  153. package/node/auth/adapter/google.js +2 -2
  154. package/node/auth/adapter/twitch.js +1 -1
  155. package/node/auth/session.d.ts +1 -1
  156. package/node/config/index.d.ts +2 -2
  157. package/node/config/index.js +3 -8
  158. package/node/job/index.d.ts +2 -2
  159. package/node/site/index.js +3 -5
  160. package/package.json +26 -21
  161. package/pothos.js +1 -0
  162. package/project.d.ts +47 -0
  163. package/{app.js → project.js} +60 -53
  164. package/runtime/handlers/dotnet.d.ts +1 -1
  165. package/runtime/handlers/dotnet.js +4 -4
  166. package/runtime/handlers/go.d.ts +1 -1
  167. package/runtime/handlers/go.js +3 -3
  168. package/runtime/handlers/java.d.ts +1 -1
  169. package/runtime/handlers/java.js +4 -4
  170. package/runtime/handlers/node.d.ts +1 -1
  171. package/runtime/handlers/node.js +60 -39
  172. package/runtime/handlers/python.d.ts +1 -1
  173. package/runtime/handlers/python.js +3 -3
  174. package/runtime/handlers.js +15 -12
  175. package/runtime/iot.js +3 -0
  176. package/runtime/runtime.d.ts +4 -0
  177. package/runtime/server.d.ts +3 -3
  178. package/runtime/server.js +11 -5
  179. package/runtime/workers.d.ts +4 -2
  180. package/runtime/workers.js +13 -3
  181. package/site-env.js +2 -1
  182. package/sst.mjs +6357 -20846
  183. package/stacks/app-metadata.d.ts +7 -0
  184. package/stacks/app-metadata.js +78 -0
  185. package/stacks/assembly.d.ts +1 -0
  186. package/stacks/assembly.js +4 -0
  187. package/stacks/build.d.ts +1 -1
  188. package/stacks/build.js +41 -48
  189. package/stacks/deploy.d.ts +1 -0
  190. package/stacks/deploy.js +128 -7
  191. package/stacks/diff.d.ts +8 -0
  192. package/stacks/diff.js +62 -0
  193. package/stacks/index.d.ts +3 -0
  194. package/stacks/index.js +3 -0
  195. package/stacks/metadata.d.ts +2 -0
  196. package/stacks/metadata.js +14 -12
  197. package/stacks/monitor.d.ts +8 -3
  198. package/stacks/monitor.js +38 -4
  199. package/stacks/remove.js +0 -4
  200. package/stacks/synth.d.ts +1 -0
  201. package/stacks/synth.js +27 -13
  202. package/support/base-site-archiver.mjs +1 -1
  203. package/support/bootstrap-metadata-function/index.mjs +68740 -0
  204. package/support/bridge/bridge.mjs +28 -28
  205. package/support/certificate-requestor/index.js +549 -0
  206. package/support/custom-resources/index.mjs +3824 -26567
  207. package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +1 -1
  208. package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +1 -1
  209. package/support/edge-function/edge-lambda.mjs +2 -2
  210. package/support/job-invoker/index.mjs +26 -0
  211. package/support/nodejs-runtime/index.mjs +75 -72
  212. package/support/rds-migrator/index.mjs +22 -23
  213. package/support/remix-site-function/edge-server.js +1 -1
  214. package/support/script-function/index.mjs +30485 -0
  215. package/support/{edge-function-code-replacer → sls-nextjs-site-function-code-replacer}/lambda-code-updater.py +0 -0
  216. package/support/ssr-site-function-archiver.mjs +96 -0
  217. package/util/process.d.ts +0 -1
  218. package/watcher.js +1 -1
  219. package/app.d.ts +0 -36
  220. package/constructs/DebugApp.d.ts +0 -49
  221. package/constructs/DebugApp.js +0 -63
  222. package/constructs/DebugStack.d.ts +0 -34
  223. package/constructs/DebugStack.js +0 -132
  224. package/constructs/GraphQLApi.d.ts +0 -98
  225. package/constructs/GraphQLApi.js +0 -80
  226. package/constructs/ReactStaticSite.d.ts +0 -20
  227. package/constructs/ReactStaticSite.js +0 -54
  228. package/constructs/Script/cfn-response.d.ts +0 -19
  229. package/constructs/Script/cfn-response.js +0 -77
  230. package/constructs/Script/index.d.ts +0 -1
  231. package/constructs/Script/index.js +0 -78
  232. package/constructs/Script/outbound.d.ts +0 -10
  233. package/constructs/Script/outbound.js +0 -42
  234. package/constructs/Script/util.d.ts +0 -2
  235. package/constructs/Script/util.js +0 -11
  236. package/constructs/ViteStaticSite.d.ts +0 -32
  237. package/constructs/ViteStaticSite.js +0 -66
  238. package/support/astro-site-html-stub/index.html +0 -99
  239. package/support/base-site-archiver.cjs +0 -116
  240. package/support/nextjs-site-html-stub/index.html +0 -99
  241. package/support/remix-site-html-stub/index.html +0 -99
  242. package/support/solid-start-site-html-stub/index.html +0 -99
  243. package/support/static-site-stub/index.html +0 -90
package/stacks/synth.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Logger } from "../logger.js";
2
- import { useProject } from "../app.js";
2
+ import { useProject } from "../project.js";
3
3
  import { useAWSProvider, useSTSIdentity } from "../credentials.js";
4
- import { useBootstrap } from "../bootstrap.js";
5
4
  import * as contextproviders from "aws-cdk/lib/context-providers/index.js";
6
5
  import path from "path";
7
6
  import { VisibleError } from "../error.js";
@@ -20,13 +19,10 @@ export async function synth(opts) {
20
19
  useDotnetHandler();
21
20
  const { Configuration } = await import("aws-cdk/lib/settings.js");
22
21
  const project = useProject();
23
- const [identity, bootstrap] = await Promise.all([
24
- useSTSIdentity(),
25
- useBootstrap(),
26
- ]);
22
+ const identity = await useSTSIdentity();
27
23
  opts = {
28
- buildDir: path.join(project.paths.out, "cdk.out"),
29
24
  ...opts,
25
+ buildDir: opts.buildDir || path.join(project.paths.out, "dist"),
30
26
  };
31
27
  /*
32
28
  console.log(JSON.stringify(cfg.context));
@@ -43,14 +39,14 @@ export async function synth(opts) {
43
39
  while (true) {
44
40
  const app = new App({
45
41
  account: identity.Account,
46
- stage: project.stage,
47
- name: project.name,
48
- region: project.region,
42
+ stage: project.config.stage,
43
+ name: project.config.name,
44
+ region: project.config.region,
49
45
  mode: opts.mode,
46
+ debugIncreaseTimeout: opts.increaseTimeout,
50
47
  skipBuild: opts.mode === "remove",
51
- bootstrap,
52
48
  }, {
53
- outdir: opts.buildDir || path.join(project.paths.out, "cdk.out"),
49
+ outdir: opts.buildDir,
54
50
  context: cfg.context.all,
55
51
  });
56
52
  await opts.fn(app);
@@ -62,7 +58,7 @@ export async function synth(opts) {
62
58
  if (missing && missing.length) {
63
59
  const next = missing.map((x) => x.key);
64
60
  if (next.length === previous.size && next.every((x) => previous.has(x)))
65
- throw new VisibleError(`Could not resolve context values for ${next}`);
61
+ throw new VisibleError(formatErrorMessage(next.join("")));
66
62
  Logger.debug("Looking up context for:", next, "Previous:", previous);
67
63
  previous = new Set(next);
68
64
  await contextproviders.provideContextValues(missing, cfg.context, provider);
@@ -75,3 +71,21 @@ export async function synth(opts) {
75
71
  return assembly;
76
72
  }
77
73
  }
74
+ function formatErrorMessage(message) {
75
+ return (formatCustomDomainError(message) ||
76
+ `Could not resolve context values for ${message}`);
77
+ }
78
+ function formatCustomDomainError(message) {
79
+ const ret = message.match(/hosted-zone:account=\d+:domainName=(\S+):/);
80
+ if (!ret) {
81
+ return;
82
+ }
83
+ const hostedZone = ret && ret[1];
84
+ return [
85
+ `It seems you are configuring custom domains for you URL.`,
86
+ hostedZone
87
+ ? `And SST is not able to find the hosted zone "${hostedZone}" in your AWS Route 53 account.`
88
+ : `And SST is not able to find the hosted zone in your AWS Route 53 account.`,
89
+ `Please double check and make sure the zone exists, or pass in a different zone.`,
90
+ ].join(" ");
91
+ }
@@ -16,7 +16,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof be))r
16
16
  `));var r=e.pax;if(r)for(var i in r)t+=To(" "+i+"="+r[i]+`
17
17
  `);return Buffer.from(t)};br.decodePax=function(e){for(var t={};e.length;){for(var r=0;r<e.length&&e[r]!==32;)r++;var i=parseInt(e.slice(0,r).toString(),10);if(!i)return t;var n=e.slice(r+1,i-1).toString(),s=n.indexOf("=");if(s===-1)return t;t[n.slice(0,s)]=n.slice(s+1),e=e.slice(i)}return t};br.encode=function(e){var t=cE(512),r=e.name,i="";if(e.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var n=r.indexOf("/");if(n===-1)return null;i+=i?"/"+r.slice(0,n):r.slice(0,n),r=r.slice(n+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(i)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(r),t.write(wt(e.mode&mE,6),100),t.write(wt(e.uid,6),108),t.write(wt(e.gid,6),116),t.write(wt(e.size,11),124),t.write(wt(e.mtime.getTime()/1e3|0,11),136),t[156]=kd+wE(e.type),e.linkname&&t.write(e.linkname,157),Bd.copy(t,fi),gE.copy(t,xo),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(wt(e.devmajor||0,6),329),t.write(wt(e.devminor||0,6),337),i&&t.write(i,345),t.write(wt(Gd(t),6),148),t)};br.decode=function(e,t,r){var i=e[156]===0?0:e[156]-kd,n=_r(e,0,100,t),s=St(e,100,8),o=St(e,108,8),u=St(e,116,8),l=St(e,124,12),d=St(e,136,12),p=bE(i),m=e[157]===0?null:_r(e,157,100,t),g=_r(e,265,32),y=_r(e,297,32),b=St(e,329,8),A=St(e,337,8),E=Gd(e);if(E===8*32)return null;if(E!==St(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(Bd.compare(e,fi,fi+6)===0)e[345]&&(n=_r(e,345,155,t)+"/"+n);else if(!(yE.compare(e,fi,fi+6)===0&&vE.compare(e,xo,xo+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return i===0&&n&&n[n.length-1]==="/"&&(i=5),{name:n,mode:s,uid:o,gid:u,size:l,mtime:new Date(1e3*d),type:p,linkname:m,uname:g,gname:y,devmajor:b,devminor:A}}});var Qd=L((gx,Vd)=>{var Wd=D("util"),EE=jd(),li=Ro(),Hd=We().Writable,$d=We().PassThrough,Zd=a(function(){},"noop"),zd=a(function(e){return e&=511,e&&512-e},"overflow"),OE=a(function(e,t){var r=new Gn(e,t);return r.end(),r},"emptyStream"),TE=a(function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e},"mixinPax"),Gn=a(function(e,t){this._parent=e,this.offset=t,$d.call(this,{autoDestroy:!1})},"Source");Wd.inherits(Gn,$d);Gn.prototype.destroy=function(e){this._parent.destroy(e)};var it=a(function(e){if(!(this instanceof it))return new it(e);Hd.call(this,e),e=e||{},this._offset=0,this._buffer=EE(),this._missing=0,this._partial=!1,this._onparse=Zd,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,r=t._buffer,i=a(function(){t._continue()},"oncontinue"),n=a(function(g){if(t._locked=!1,g)return t.destroy(g);t._stream||i()},"onunlock"),s=a(function(){t._stream=null;var g=zd(t._header.size);g?t._parse(g,o):t._parse(512,m),t._locked||i()},"onstreamend"),o=a(function(){t._buffer.consume(zd(t._header.size)),t._parse(512,m),i()},"ondrain"),u=a(function(){var g=t._header.size;t._paxGlobal=li.decodePax(r.slice(0,g)),r.consume(g),s()},"onpaxglobalheader"),l=a(function(){var g=t._header.size;t._pax=li.decodePax(r.slice(0,g)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),r.consume(g),s()},"onpaxheader"),d=a(function(){var g=t._header.size;this._gnuLongPath=li.decodeLongPath(r.slice(0,g),e.filenameEncoding),r.consume(g),s()},"ongnulongpath"),p=a(function(){var g=t._header.size;this._gnuLongLinkPath=li.decodeLongPath(r.slice(0,g),e.filenameEncoding),r.consume(g),s()},"ongnulonglinkpath"),m=a(function(){var g=t._offset,y;try{y=t._header=li.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(b){t.emit("error",b)}if(r.consume(512),!y){t._parse(512,m),i();return}if(y.type==="gnu-long-path"){t._parse(y.size,d),i();return}if(y.type==="gnu-long-link-path"){t._parse(y.size,p),i();return}if(y.type==="pax-global-header"){t._parse(y.size,u),i();return}if(y.type==="pax-header"){t._parse(y.size,l),i();return}if(t._gnuLongPath&&(y.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(y.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=y=TE(y,t._pax),t._pax=null),t._locked=!0,!y.size||y.type==="directory"){t._parse(512,m),t.emit("entry",y,OE(t,g),n);return}t._stream=new Gn(t,g),t.emit("entry",y,t._stream,n),t._parse(y.size,s),i()},"onheader");this._onheader=m,this._parse(512,m)},"Extract");Wd.inherits(it,Hd);it.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))};it.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)};it.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=Zd,this._overflow?this._write(this._overflow,void 0,e):e()}};it.prototype._write=function(e,t,r){if(!this._destroyed){var i=this._stream,n=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,i?i.write(e,r):(n.append(e),r());this._cb=r,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),i?i.end(e):n.append(e),this._overflow=o,this._onparse()}};it.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()};Vd.exports=it});var Kd=L((vx,Yd)=>{Yd.exports=D("fs").constants||D("constants")});var ep=L((mx,Jd)=>{var xE=Yr(),RE=a(function(){},"noop"),AE=a(function(e){return e.setHeader&&typeof e.abort=="function"},"isRequest"),IE=a(function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},"isChildProcess"),Xd=a(function(e,t,r){if(typeof t=="function")return Xd(e,null,t);t||(t={}),r=xE(r||RE);var i=e._writableState,n=e._readableState,s=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,u=!1,l=a(function(){e.writable||d()},"onlegacyfinish"),d=a(function(){o=!1,s||r.call(e)},"onfinish"),p=a(function(){s=!1,o||r.call(e)},"onend"),m=a(function(E){r.call(e,E?new Error("exited with error code: "+E):null)},"onexit"),g=a(function(E){r.call(e,E)},"onerror"),y=a(function(){process.nextTick(b)},"onclose"),b=a(function(){if(!u){if(s&&!(n&&n.ended&&!n.destroyed))return r.call(e,new Error("premature close"));if(o&&!(i&&i.ended&&!i.destroyed))return r.call(e,new Error("premature close"))}},"onclosenexttick"),A=a(function(){e.req.on("finish",d)},"onrequest");return AE(e)?(e.on("complete",d),e.on("abort",y),e.req?A():e.on("request",A)):o&&!i&&(e.on("end",l),e.on("close",l)),IE(e)&&e.on("exit",m),e.on("end",p),e.on("finish",d),t.error!==!1&&e.on("error",g),e.on("close",y),function(){u=!0,e.removeListener("complete",d),e.removeListener("abort",y),e.removeListener("request",A),e.req&&e.req.removeListener("finish",d),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",d),e.removeListener("exit",m),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",y)}},"eos");Jd.exports=Xd});var ap=L((bx,np)=>{var wr=Kd(),tp=ep(),Wn=Me(),LE=Buffer.alloc,rp=We().Readable,Sr=We().Writable,ME=D("string_decoder").StringDecoder,zn=Ro(),DE=parseInt("755",8),CE=parseInt("644",8),ip=LE(1024),Io=a(function(){},"noop"),Ao=a(function(e,t){t&=511,t&&e.push(ip.slice(0,512-t))},"overflow");function PE(e){switch(e&wr.S_IFMT){case wr.S_IFBLK:return"block-device";case wr.S_IFCHR:return"character-device";case wr.S_IFDIR:return"directory";case wr.S_IFIFO:return"fifo";case wr.S_IFLNK:return"symlink"}return"file"}a(PE,"modeToType");var Hn=a(function(e){Sr.call(this),this.written=0,this._to=e,this._destroyed=!1},"Sink");Wn(Hn,Sr);Hn.prototype._write=function(e,t,r){if(this.written+=e.length,this._to.push(e))return r();this._to._drain=r};Hn.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var $n=a(function(){Sr.call(this),this.linkname="",this._decoder=new ME("utf-8"),this._destroyed=!1},"LinkSink");Wn($n,Sr);$n.prototype._write=function(e,t,r){this.linkname+=this._decoder.write(e),r()};$n.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var hi=a(function(){Sr.call(this),this._destroyed=!1},"Void");Wn(hi,Sr);hi.prototype._write=function(e,t,r){r(new Error("No body allowed for this entry"))};hi.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var Ye=a(function(e){if(!(this instanceof Ye))return new Ye(e);rp.call(this,e),this._drain=Io,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null},"Pack");Wn(Ye,rp);Ye.prototype.entry=function(e,t,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof t=="function"&&(r=t,t=null),r||(r=Io);var i=this;if((!e.size||e.type==="symlink")&&(e.size=0),e.type||(e.type=PE(e.mode)),e.mode||(e.mode=e.type==="directory"?DE:CE),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),typeof t=="string"&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var n=this.push(t);return Ao(i,e.size),n?process.nextTick(r):this._drain=r,new hi}if(e.type==="symlink"&&!e.linkname){var s=new $n;return tp(s,function(u){if(u)return i.destroy(),r(u);e.linkname=s.linkname,i._encode(e),r()}),s}if(this._encode(e),e.type!=="file"&&e.type!=="contiguous-file")return process.nextTick(r),new hi;var o=new Hn(this);return this._stream=o,tp(o,function(u){if(i._stream=null,u)return i.destroy(),r(u);if(o.written!==e.size)return i.destroy(),r(new Error("size mismatch"));Ao(i,e.size),i._finalizing&&i.finalize(),r()}),o}};Ye.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(ip),this.push(null))};Ye.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};Ye.prototype._encode=function(e){if(!e.pax){var t=zn.encode(e);if(t){this.push(t);return}}this._encodePax(e)};Ye.prototype._encodePax=function(e){var t=zn.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),r={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(zn.encode(r)),this.push(t),Ao(this,t.length),r.size=e.size,r.type=e.type,this.push(zn.encode(r))};Ye.prototype._read=function(e){var t=this._drain;this._drain=Io,t()};np.exports=Ye});var sp=L(Lo=>{Lo.extract=Qd();Lo.pack=ap()});var fp=L((Ex,up)=>{var NE=D("zlib"),qE=sp(),op=dr(),nt=a(function(e){if(!(this instanceof nt))return new nt(e);e=this.options=op.defaults(e,{gzip:!1}),typeof e.gzipOptions!="object"&&(e.gzipOptions={}),this.supports={directory:!0,symlink:!0},this.engine=qE.pack(e),this.compressor=!1,e.gzip&&(this.compressor=NE.createGzip(e.gzipOptions),this.compressor.on("error",this._onCompressorError.bind(this)))},"Tar");nt.prototype._onCompressorError=function(e){this.engine.emit("error",e)};nt.prototype.append=function(e,t,r){var i=this;t.mtime=t.date;function n(o,u){if(o){r(o);return}i.engine.entry(t,u,function(l){r(l,t)})}if(a(n,"append"),t.sourceType==="buffer")n(null,e);else if(t.sourceType==="stream"&&t.stats){t.size=t.stats.size;var s=i.engine.entry(t,function(o){r(o,t)});e.pipe(s)}else t.sourceType==="stream"&&op.collectStream(e,n)};nt.prototype.finalize=function(){this.engine.finalize()};nt.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};nt.prototype.pipe=function(e,t){return this.compressor?this.engine.pipe.apply(this.engine,[this.compressor]).pipe(e,t):this.engine.pipe.apply(this.engine,arguments)};nt.prototype.unpipe=function(){return this.compressor?this.compressor.unpipe.apply(this.compressor,arguments):this.engine.unpipe.apply(this.engine,arguments)};up.exports=nt});var dp=L((Tx,cp)=>{var FE=D("util").inherits,lp=We().Transform,jE=vo(),hp=dr(),Et=a(function(e){if(!(this instanceof Et))return new Et(e);e=this.options=hp.defaults(e,{}),lp.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]},"Json");FE(Et,lp);Et.prototype._transform=function(e,t,r){r(null,e)};Et.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)};Et.prototype.append=function(e,t,r){var i=this;t.crc32=0;function n(s,o){if(s){r(s);return}t.size=o.length||0,t.crc32=jE.unsigned(o),i.files.push(t),r(null,t)}a(n,"onend"),t.sourceType==="buffer"?n(null,e):t.sourceType==="stream"&&hp.collectStream(e,n)};Et.prototype.finalize=function(){this._writeStringified(),this.end()};cp.exports=Et});var gp=L((Rx,pp)=>{var kE=Jc(),ci={},Ot=a(function(e,t){return Ot.create(e,t)},"vending");Ot.create=function(e,t){if(ci[e]){var r=new kE(e,t);return r.setFormat(e),r.setModule(new ci[e](t)),r}else throw new Error("create("+e+"): format not registered")};Ot.registerFormat=function(e,t){if(ci[e])throw new Error("register("+e+"): format already registered");if(typeof t!="function")throw new Error("register("+e+"): format module invalid");if(typeof t.prototype.append!="function"||typeof t.prototype.finalize!="function")throw new Error("register("+e+"): format module missing methods");ci[e]=t};Ot.isRegisteredFormat=function(e){return!!ci[e]};Ot.registerFormat("zip",Pd());Ot.registerFormat("tar",fp());Ot.registerFormat("json",dp());pp.exports=Ot});var Do=L(Tt=>{Tt.setopts=HE;Tt.ownProp=yp;Tt.makeAbs=di;Tt.finish=$E;Tt.mark=ZE;Tt.isIgnored=mp;Tt.childrenIgnored=VE;function yp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}a(yp,"ownProp");var BE=D("fs"),Wt=D("path"),UE=Mr(),vp=D("path").isAbsolute,Mo=UE.Minimatch;function GE(e,t){return e.localeCompare(t,"en")}a(GE,"alphasort");function zE(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(WE))}a(zE,"setupIgnores");function WE(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new Mo(r,{dot:!0})}return{matcher:new Mo(e,{dot:!0}),gmatcher:t}}a(WE,"ignoreMap");function HE(e,t,r){if(r||(r={}),r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir&&(e.mark=!0),e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.absolute=!!r.absolute,e.fs=r.fs||BE,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),zE(e,r),e.changedCwd=!1;var i=process.cwd();yp(r,"cwd")?(e.cwd=Wt.resolve(r.cwd),e.changedCwd=e.cwd!==i):e.cwd=Wt.resolve(i),e.root=r.root||Wt.resolve(e.cwd,"/"),e.root=Wt.resolve(e.root),e.cwdAbs=vp(e.cwd)?e.cwd:di(e,e.cwd),e.nomount=!!r.nomount,process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/"),e.cwd=e.cwd.replace(/\\/g,"/"),e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")),r.nonegate=!0,r.nocomment=!0,r.allowWindowsEscape=!0,e.minimatch=new Mo(t,r),e.options=e.minimatch.options}a(HE,"setopts");function $E(e){for(var t=e.nounique,r=t?[]:Object.create(null),i=0,n=e.matches.length;i<n;i++){var s=e.matches[i];if(!s||Object.keys(s).length===0){if(e.nonull){var o=e.minimatch.globSet[i];t?r.push(o):r[o]=!0}}else{var u=Object.keys(s);t?r.push.apply(r,u):u.forEach(function(l){r[l]=!0})}}if(t||(r=Object.keys(r)),e.nosort||(r=r.sort(GE)),e.mark){for(var i=0;i<r.length;i++)r[i]=e._mark(r[i]);e.nodir&&(r=r.filter(function(l){var d=!/\/$/.test(l),p=e.cache[l]||e.cache[di(e,l)];return d&&p&&(d=p!=="DIR"&&!Array.isArray(p)),d}))}e.ignore.length&&(r=r.filter(function(l){return!mp(e,l)})),e.found=r}a($E,"finish");function ZE(e,t){var r=di(e,t),i=e.cache[r],n=t;if(i){var s=i==="DIR"||Array.isArray(i),o=t.slice(-1)==="/";if(s&&!o?n+="/":!s&&o&&(n=n.slice(0,-1)),n!==t){var u=di(e,n);e.statCache[u]=e.statCache[r],e.cache[u]=e.cache[r]}}return n}a(ZE,"mark");function di(e,t){var r=t;return t.charAt(0)==="/"?r=Wt.join(e.root,t):vp(t)||t===""?r=t:e.changedCwd?r=Wt.resolve(e.cwd,t):r=Wt.resolve(t),process.platform==="win32"&&(r=r.replace(/\\/g,"/")),r}a(di,"makeAbs");function mp(e,t){return e.ignore.length?e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))}):!1}a(mp,"isIgnored");function VE(e,t){return e.ignore.length?e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))}):!1}a(VE,"childrenIgnored")});var Ep=L((Px,Sp)=>{Sp.exports=wp;wp.GlobSync=we;var QE=Zr(),_p=Mr(),Mx=_p.Minimatch,Dx=No().Glob,Cx=D("util"),Co=D("path"),bp=D("assert"),Zn=D("path").isAbsolute,Ht=Do(),YE=Ht.setopts,Po=Ht.ownProp,KE=Ht.childrenIgnored,XE=Ht.isIgnored;function wp(e,t){if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
18
18
  See: https://github.com/isaacs/node-glob/issues/167`);return new we(e,t).found}a(wp,"globSync");function we(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
19
- See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof we))return new we(e,t);if(YE(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var i=0;i<r;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}a(we,"GlobSync");we.prototype._finish=function(){if(bp.ok(this instanceof we),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var n in t)try{n=e._makeAbs(n);var s=QE.realpathSync(n,e.realpathCache);i[s]=!0}catch(o){if(o.syscall==="stat")i[e._makeAbs(n)]=!0;else throw o}})}Ht.finish(this)};we.prototype._process=function(e,t,r){bp.ok(this instanceof we);for(var i=0;typeof e[i]=="string";)i++;var n;switch(i){case e.length:this._processSimple(e.join("/"),t);return;case 0:n=null;break;default:n=e.slice(0,i).join("/");break}var s=e.slice(i),o;n===null?o=".":((Zn(n)||Zn(e.map(function(d){return typeof d=="string"?d:"[*]"}).join("/")))&&(!n||!Zn(n))&&(n="/"+n),o=n);var u=this._makeAbs(o);if(!KE(this,o)){var l=s[0]===_p.GLOBSTAR;l?this._processGlobStar(n,o,u,s,t,r):this._processReaddir(n,o,u,s,t,r)}};we.prototype._processReaddir=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){for(var u=i[0],l=!!this.minimatch.negate,d=u._glob,p=this.dot||d.charAt(0)===".",m=[],g=0;g<o.length;g++){var y=o[g];if(y.charAt(0)!=="."||p){var b;l&&!e?b=!y.match(u):b=y.match(u),b&&m.push(y)}}var A=m.length;if(A!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var g=0;g<A;g++){var y=m[g];e&&(e.slice(-1)!=="/"?y=e+"/"+y:y=e+y),y.charAt(0)==="/"&&!this.nomount&&(y=Co.join(this.root,y)),this._emitMatch(n,y)}return}i.shift();for(var g=0;g<A;g++){var y=m[g],E;e?E=[e,y]:E=[y],this._process(E.concat(i),n,s)}}}};we.prototype._emitMatch=function(e,t){if(!XE(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};we.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,i;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();return this.symlinks[e]=n,!n&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};we.prototype._readdir=function(e,t){var r;if(t&&!Po(this.symlinks,e))return this._readdirInGlobStar(e);if(Po(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};we.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,t};we.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=t.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};we.prototype._processGlobStar=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){var u=i.slice(1),l=e?[e]:[],d=l.concat(u);this._process(d,n,!1);var p=o.length,m=this.symlinks[r];if(!(m&&s))for(var g=0;g<p;g++){var y=o[g];if(!(y.charAt(0)==="."&&!this.dot)){var b=l.concat(o[g],u);this._process(b,n,!0);var A=l.concat(o[g],i);this._process(A,n,!0)}}}};we.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&Zn(e)&&!this.nomount){var i=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Co.join(this.root,e):(e=Co.resolve(this.root,e),i&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};we.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&Po(this.cache,t)){var o=this.cache[t];if(Array.isArray(o)&&(o="DIR"),!r||o==="DIR")return o;if(r&&o==="FILE")return!1}var i,n=this.statCache[t];if(!n){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(t)}catch{n=s}else n=s}this.statCache[t]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,r&&o==="FILE"?!1:o};we.prototype._mark=function(e){return Ht.mark(this,e)};we.prototype._makeAbs=function(e){return Ht.makeAbs(this,e)}});var No=L((jx,Tp)=>{Tp.exports=$t;var JE=Zr(),Op=Mr(),qx=Op.Minimatch,e1=Me(),t1=D("events").EventEmitter,qo=D("path"),Fo=D("assert"),pi=D("path").isAbsolute,ko=Ep(),Zt=Do(),r1=Zt.setopts,jo=Zt.ownProp,Bo=Ss(),Fx=D("util"),i1=Zt.childrenIgnored,n1=Zt.isIgnored,a1=Yr();function $t(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return ko(e,t)}return new le(e,t,r)}a($t,"glob");$t.sync=ko;var s1=$t.GlobSync=ko.GlobSync;$t.glob=$t;function o1(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e}a(o1,"extend");$t.hasMagic=function(e,t){var r=o1({},t);r.noprocess=!0;var i=new le(e,r),n=i.minimatch.set;if(!e)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};$t.Glob=le;e1(le,t1);function le(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new s1(e,t)}if(!(this instanceof le))return new le(e,t,r);r1(this,e,t),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=a1(r),this.on("error",r),this.on("end",function(l){r(null,l)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,o=0;o<i;o++)this._process(this.minimatch.set[o],o,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}a(u,"done")}a(le,"Glob");le.prototype._finish=function(){if(Fo(this instanceof le),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Zt.finish(this),this.emit("end",this.found)}};le.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,i);function i(){--e===0&&t._finish()}a(i,"next")};le.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),n=this,s=i.length;if(s===0)return t();var o=this.matches[e]=Object.create(null);i.forEach(function(u,l){u=n._makeAbs(u),JE.realpath(u,n.realpathCache,function(d,p){d?d.syscall==="stat"?o[u]=!0:n.emit("error",d):o[p]=!0,--s===0&&(n.matches[e]=o,t())})})};le.prototype._mark=function(e){return Zt.mark(this,e)};le.prototype._makeAbs=function(e){return Zt.makeAbs(this,e)};le.prototype.abort=function(){this.aborted=!0,this.emit("abort")};le.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};le.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<i.length;t++){var n=i[t];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};le.prototype._process=function(e,t,r,i){if(Fo(this instanceof le),Fo(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,i]);return}for(var n=0;typeof e[n]=="string";)n++;var s;switch(n){case e.length:this._processSimple(e.join("/"),t,i);return;case 0:s=null;break;default:s=e.slice(0,n).join("/");break}var o=e.slice(n),u;s===null?u=".":((pi(s)||pi(e.map(function(p){return typeof p=="string"?p:"[*]"}).join("/")))&&(!s||!pi(s))&&(s="/"+s),u=s);var l=this._makeAbs(u);if(i1(this,u))return i();var d=o[0]===Op.GLOBSTAR;d?this._processGlobStar(s,u,l,o,t,r,i):this._processReaddir(s,u,l,o,t,r,i)}};le.prototype._processReaddir=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,d){return u._processReaddir2(e,t,r,i,n,s,d,o)})};le.prototype._processReaddir2=function(e,t,r,i,n,s,o,u){if(!o)return u();for(var l=i[0],d=!!this.minimatch.negate,p=l._glob,m=this.dot||p.charAt(0)===".",g=[],y=0;y<o.length;y++){var b=o[y];if(b.charAt(0)!=="."||m){var A;d&&!e?A=!b.match(l):A=b.match(l),A&&g.push(b)}}var E=g.length;if(E===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var y=0;y<E;y++){var b=g[y];e&&(e!=="/"?b=e+"/"+b:b=e+b),b.charAt(0)==="/"&&!this.nomount&&(b=qo.join(this.root,b)),this._emitMatch(n,b)}return u()}i.shift();for(var y=0;y<E;y++){var b=g[y],x;e&&(e!=="/"?b=e+"/"+b:b=e+b),this._process([b].concat(i),n,s,u)}u()};le.prototype._emitMatch=function(e,t){if(!this.aborted&&!n1(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=pi(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0;var n=this.statCache[r];n&&this.emit("stat",t,n),this.emit("match",t)}}};le.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,i=this,n=Bo(r,s);n&&i.fs.lstat(e,n);function s(o,u){if(o&&o.code==="ENOENT")return t();var l=u&&u.isSymbolicLink();i.symlinks[e]=l,!l&&u&&!u.isDirectory()?(i.cache[e]="FILE",t()):i._readdir(e,!1,t)}a(s,"lstatcb_")};le.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Bo("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!jo(this.symlinks,e))return this._readdirInGlobStar(e,r);if(jo(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return r();if(Array.isArray(i))return r(null,i)}var n=this;n.fs.readdir(e,u1(this,e,r))}};function u1(e,t,r){return function(i,n){i?e._readdirError(t,i,r):e._readdirEntries(t,n,r)}}a(u1,"readdirCb");le.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<t.length;i++){var n=t[i];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,r(null,t)}};le.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(e);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=t.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};le.prototype._processGlobStar=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,d){u._processGlobStar2(e,t,r,i,n,s,d,o)})};le.prototype._processGlobStar2=function(e,t,r,i,n,s,o,u){if(!o)return u();var l=i.slice(1),d=e?[e]:[],p=d.concat(l);this._process(p,n,!1,u);var m=this.symlinks[r],g=o.length;if(m&&s)return u();for(var y=0;y<g;y++){var b=o[y];if(!(b.charAt(0)==="."&&!this.dot)){var A=d.concat(o[y],l);this._process(A,n,!0,u);var E=d.concat(o[y],i);this._process(E,n,!0,u)}}u()};le.prototype._processSimple=function(e,t,r){var i=this;this._stat(e,function(n,s){i._processSimple2(e,t,n,s,r)})};le.prototype._processSimple2=function(e,t,r,i,n){if(this.matches[t]||(this.matches[t]=Object.create(null)),!i)return n();if(e&&pi(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=qo.join(this.root,e):(e=qo.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),n()};le.prototype._stat=function(e,t){var r=this._makeAbs(e),i=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&jo(this.cache,r)){var n=this.cache[r];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return t(null,n);if(i&&n==="FILE")return t()}var s,o=this.statCache[r];if(o!==void 0){if(o===!1)return t(null,o);var u=o.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?t():t(null,u,o)}var l=this,d=Bo("stat\0"+r,p);d&&l.fs.lstat(r,d);function p(m,g){if(g&&g.isSymbolicLink())return l.fs.stat(r,function(y,b){y?l._stat2(e,r,null,g,t):l._stat2(e,r,y,b,t)});l._stat2(e,r,m,g,t)}a(p,"lstatcb_")};le.prototype._stat2=function(e,t,r,i,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,n();var s=e.slice(-1)==="/";if(this.statCache[t]=i,t.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var o=!0;return i&&(o=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,s&&o==="FILE"?n():n(null,o,i)}});var p1=L(()=>{process.on("unhandledRejection",e=>{throw e});var Vn=D("path"),Qn=D("fs/promises"),f1=D("fs"),l1=gp(),h1=No(),Uo=process.argv.slice(2),Ip=Uo[0],xp=Uo[1],Lp=Uo[2],Rp=Lp*1024*1024,c1={dot:!0,nodir:!0,follow:!0,cwd:Ip},Ap=h1.sync("**",c1);d1().catch(()=>{process.exit(1)});function d1(){return new Promise(async(e,t)=>{let r,i,n,s=[];async function o(){let l=s.length,d=Vn.join(xp,`part${l}.zip`);await Qn.mkdir(Vn.dirname(d),{recursive:!0}),r=f1.createWriteStream(d),i=l1("zip"),n=0,s.push({output:r,archive:i,isOutputClosed:!1}),i.on("warning",t),i.on("error",t),r.once("close",()=>{s[l].isOutputClosed=!0,s.every(({isOutputClosed:p})=>p)&&e()}),i.pipe(r)}a(o,"openZip"),await o();for(let l of Ap){let d=Vn.join(Ip,l),[p,m]=await Promise.all([Qn.readFile(d),Qn.stat(d)]),g=m.size;if(g>Rp)throw new Error(`Cannot package file "${d}". The file is larger than ${Lp}MB.`);n+g>Rp&&(await i.finalize(),o()),i.append(p,{name:l,date:new Date("1980-01-01T00:00:00.000Z"),mode:m.mode}),n+=g}await i.finalize();let u=Vn.join(xp,"filenames");await Qn.writeFile(u,Ap.join(`
19
+ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof we))return new we(e,t);if(YE(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var i=0;i<r;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}a(we,"GlobSync");we.prototype._finish=function(){if(bp.ok(this instanceof we),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var n in t)try{n=e._makeAbs(n);var s=QE.realpathSync(n,e.realpathCache);i[s]=!0}catch(o){if(o.syscall==="stat")i[e._makeAbs(n)]=!0;else throw o}})}Ht.finish(this)};we.prototype._process=function(e,t,r){bp.ok(this instanceof we);for(var i=0;typeof e[i]=="string";)i++;var n;switch(i){case e.length:this._processSimple(e.join("/"),t);return;case 0:n=null;break;default:n=e.slice(0,i).join("/");break}var s=e.slice(i),o;n===null?o=".":((Zn(n)||Zn(e.map(function(d){return typeof d=="string"?d:"[*]"}).join("/")))&&(!n||!Zn(n))&&(n="/"+n),o=n);var u=this._makeAbs(o);if(!KE(this,o)){var l=s[0]===_p.GLOBSTAR;l?this._processGlobStar(n,o,u,s,t,r):this._processReaddir(n,o,u,s,t,r)}};we.prototype._processReaddir=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){for(var u=i[0],l=!!this.minimatch.negate,d=u._glob,p=this.dot||d.charAt(0)===".",m=[],g=0;g<o.length;g++){var y=o[g];if(y.charAt(0)!=="."||p){var b;l&&!e?b=!y.match(u):b=y.match(u),b&&m.push(y)}}var A=m.length;if(A!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var g=0;g<A;g++){var y=m[g];e&&(e.slice(-1)!=="/"?y=e+"/"+y:y=e+y),y.charAt(0)==="/"&&!this.nomount&&(y=Co.join(this.root,y)),this._emitMatch(n,y)}return}i.shift();for(var g=0;g<A;g++){var y=m[g],E;e?E=[e,y]:E=[y],this._process(E.concat(i),n,s)}}}};we.prototype._emitMatch=function(e,t){if(!XE(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};we.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,i;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();return this.symlinks[e]=n,!n&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};we.prototype._readdir=function(e,t){var r;if(t&&!Po(this.symlinks,e))return this._readdirInGlobStar(e);if(Po(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};we.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,t};we.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=t.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};we.prototype._processGlobStar=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){var u=i.slice(1),l=e?[e]:[],d=l.concat(u);this._process(d,n,!1);var p=o.length,m=this.symlinks[r];if(!(m&&s))for(var g=0;g<p;g++){var y=o[g];if(!(y.charAt(0)==="."&&!this.dot)){var b=l.concat(o[g],u);this._process(b,n,!0);var A=l.concat(o[g],i);this._process(A,n,!0)}}}};we.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&Zn(e)&&!this.nomount){var i=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Co.join(this.root,e):(e=Co.resolve(this.root,e),i&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};we.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&Po(this.cache,t)){var o=this.cache[t];if(Array.isArray(o)&&(o="DIR"),!r||o==="DIR")return o;if(r&&o==="FILE")return!1}var i,n=this.statCache[t];if(!n){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(t)}catch{n=s}else n=s}this.statCache[t]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,r&&o==="FILE"?!1:o};we.prototype._mark=function(e){return Ht.mark(this,e)};we.prototype._makeAbs=function(e){return Ht.makeAbs(this,e)}});var No=L((jx,Tp)=>{Tp.exports=$t;var JE=Zr(),Op=Mr(),qx=Op.Minimatch,e1=Me(),t1=D("events").EventEmitter,qo=D("path"),Fo=D("assert"),pi=D("path").isAbsolute,ko=Ep(),Zt=Do(),r1=Zt.setopts,jo=Zt.ownProp,Bo=Ss(),Fx=D("util"),i1=Zt.childrenIgnored,n1=Zt.isIgnored,a1=Yr();function $t(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return ko(e,t)}return new le(e,t,r)}a($t,"glob");$t.sync=ko;var s1=$t.GlobSync=ko.GlobSync;$t.glob=$t;function o1(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e}a(o1,"extend");$t.hasMagic=function(e,t){var r=o1({},t);r.noprocess=!0;var i=new le(e,r),n=i.minimatch.set;if(!e)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};$t.Glob=le;e1(le,t1);function le(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new s1(e,t)}if(!(this instanceof le))return new le(e,t,r);r1(this,e,t),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=a1(r),this.on("error",r),this.on("end",function(l){r(null,l)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,o=0;o<i;o++)this._process(this.minimatch.set[o],o,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}a(u,"done")}a(le,"Glob");le.prototype._finish=function(){if(Fo(this instanceof le),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Zt.finish(this),this.emit("end",this.found)}};le.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,i);function i(){--e===0&&t._finish()}a(i,"next")};le.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),n=this,s=i.length;if(s===0)return t();var o=this.matches[e]=Object.create(null);i.forEach(function(u,l){u=n._makeAbs(u),JE.realpath(u,n.realpathCache,function(d,p){d?d.syscall==="stat"?o[u]=!0:n.emit("error",d):o[p]=!0,--s===0&&(n.matches[e]=o,t())})})};le.prototype._mark=function(e){return Zt.mark(this,e)};le.prototype._makeAbs=function(e){return Zt.makeAbs(this,e)};le.prototype.abort=function(){this.aborted=!0,this.emit("abort")};le.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};le.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<i.length;t++){var n=i[t];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};le.prototype._process=function(e,t,r,i){if(Fo(this instanceof le),Fo(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,i]);return}for(var n=0;typeof e[n]=="string";)n++;var s;switch(n){case e.length:this._processSimple(e.join("/"),t,i);return;case 0:s=null;break;default:s=e.slice(0,n).join("/");break}var o=e.slice(n),u;s===null?u=".":((pi(s)||pi(e.map(function(p){return typeof p=="string"?p:"[*]"}).join("/")))&&(!s||!pi(s))&&(s="/"+s),u=s);var l=this._makeAbs(u);if(i1(this,u))return i();var d=o[0]===Op.GLOBSTAR;d?this._processGlobStar(s,u,l,o,t,r,i):this._processReaddir(s,u,l,o,t,r,i)}};le.prototype._processReaddir=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,d){return u._processReaddir2(e,t,r,i,n,s,d,o)})};le.prototype._processReaddir2=function(e,t,r,i,n,s,o,u){if(!o)return u();for(var l=i[0],d=!!this.minimatch.negate,p=l._glob,m=this.dot||p.charAt(0)===".",g=[],y=0;y<o.length;y++){var b=o[y];if(b.charAt(0)!=="."||m){var A;d&&!e?A=!b.match(l):A=b.match(l),A&&g.push(b)}}var E=g.length;if(E===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var y=0;y<E;y++){var b=g[y];e&&(e!=="/"?b=e+"/"+b:b=e+b),b.charAt(0)==="/"&&!this.nomount&&(b=qo.join(this.root,b)),this._emitMatch(n,b)}return u()}i.shift();for(var y=0;y<E;y++){var b=g[y],x;e&&(e!=="/"?b=e+"/"+b:b=e+b),this._process([b].concat(i),n,s,u)}u()};le.prototype._emitMatch=function(e,t){if(!this.aborted&&!n1(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=pi(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0;var n=this.statCache[r];n&&this.emit("stat",t,n),this.emit("match",t)}}};le.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,i=this,n=Bo(r,s);n&&i.fs.lstat(e,n);function s(o,u){if(o&&o.code==="ENOENT")return t();var l=u&&u.isSymbolicLink();i.symlinks[e]=l,!l&&u&&!u.isDirectory()?(i.cache[e]="FILE",t()):i._readdir(e,!1,t)}a(s,"lstatcb_")};le.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Bo("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!jo(this.symlinks,e))return this._readdirInGlobStar(e,r);if(jo(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return r();if(Array.isArray(i))return r(null,i)}var n=this;n.fs.readdir(e,u1(this,e,r))}};function u1(e,t,r){return function(i,n){i?e._readdirError(t,i,r):e._readdirEntries(t,n,r)}}a(u1,"readdirCb");le.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<t.length;i++){var n=t[i];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,r(null,t)}};le.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(e);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=t.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};le.prototype._processGlobStar=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,d){u._processGlobStar2(e,t,r,i,n,s,d,o)})};le.prototype._processGlobStar2=function(e,t,r,i,n,s,o,u){if(!o)return u();var l=i.slice(1),d=e?[e]:[],p=d.concat(l);this._process(p,n,!1,u);var m=this.symlinks[r],g=o.length;if(m&&s)return u();for(var y=0;y<g;y++){var b=o[y];if(!(b.charAt(0)==="."&&!this.dot)){var A=d.concat(o[y],l);this._process(A,n,!0,u);var E=d.concat(o[y],i);this._process(E,n,!0,u)}}u()};le.prototype._processSimple=function(e,t,r){var i=this;this._stat(e,function(n,s){i._processSimple2(e,t,n,s,r)})};le.prototype._processSimple2=function(e,t,r,i,n){if(this.matches[t]||(this.matches[t]=Object.create(null)),!i)return n();if(e&&pi(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=qo.join(this.root,e):(e=qo.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),n()};le.prototype._stat=function(e,t){var r=this._makeAbs(e),i=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&jo(this.cache,r)){var n=this.cache[r];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return t(null,n);if(i&&n==="FILE")return t()}var s,o=this.statCache[r];if(o!==void 0){if(o===!1)return t(null,o);var u=o.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?t():t(null,u,o)}var l=this,d=Bo("stat\0"+r,p);d&&l.fs.lstat(r,d);function p(m,g){if(g&&g.isSymbolicLink())return l.fs.stat(r,function(y,b){y?l._stat2(e,r,null,g,t):l._stat2(e,r,y,b,t)});l._stat2(e,r,m,g,t)}a(p,"lstatcb_")};le.prototype._stat2=function(e,t,r,i,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,n();var s=e.slice(-1)==="/";if(this.statCache[t]=i,t.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var o=!0;return i&&(o=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,s&&o==="FILE"?n():n(null,o,i)}});var p1=L(()=>{process.on("unhandledRejection",e=>{throw e});var Vn=D("path"),Qn=D("fs/promises"),f1=D("fs"),l1=gp(),h1=No(),Uo=process.argv.slice(2),Ip=Uo[0],xp=Uo[1],Lp=Uo[2],Rp=Lp*1024*1024,c1={dot:!0,nodir:!0,follow:!0,cwd:Ip},Ap=h1.sync("**",c1);d1().catch(()=>{process.exit(1)});function d1(){return new Promise(async(e,t)=>{let r,i,n,s=[];async function o(){let l=s.length,d=Vn.join(xp,`part${l}.zip`);await Qn.mkdir(Vn.dirname(d),{recursive:!0}),r=f1.createWriteStream(d),i=l1("zip"),n=0,s.push({output:r,archive:i,isOutputClosed:!1}),i.on("warning",t),i.on("error",t),r.once("close",()=>{s[l].isOutputClosed=!0,s.every(({isOutputClosed:p})=>p)&&e()}),i.pipe(r)}a(o,"openZip"),await o();for(let l of Ap){let d=Vn.join(Ip,l),[p,m]=await Promise.all([Qn.readFile(d),Qn.stat(d)]),g=m.size;if(g>Rp)throw new Error(`Cannot package file "${d}". The file is larger than ${Lp}MB.`);n+g>Rp&&(await i.finalize(),await o()),i.append(p,{name:l,date:new Date("1980-01-01T00:00:00.000Z"),mode:m.mode}),n+=g}await i.finalize();let u=Vn.join(xp,"filenames");await Qn.writeFile(u,Ap.join(`
20
20
  `))})}a(d1,"generateZips")});export default p1();
21
21
  /*! Bundled license information:
22
22