@rspress/core 2.0.0-rc.1 → 2.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/bin/rspress.js +1 -1
  2. package/dist/0~7675.723d12b2.js +1794 -0
  3. package/dist/3521.56e42d70.js +56 -0
  4. package/dist/4669.12208c6a.js +2 -0
  5. package/dist/5485.077f14ff.js +98 -0
  6. package/dist/6289.c67fe0d5.js +5 -0
  7. package/dist/8813.9da1f210.js +2 -0
  8. package/dist/9643.f109822d.js +5 -0
  9. package/dist/_private/react/render.js +17 -4
  10. package/dist/cli/config/index.js +4 -0
  11. package/dist/cli/config/loadConfigFile.js +30 -0
  12. package/dist/cli/index.cb89dbd1.js +3 -0
  13. package/dist/cli/index.js +122 -0
  14. package/dist/eject-theme/components/Badge/index.scss +1 -0
  15. package/dist/eject-theme/components/Banner/index.tsx +6 -5
  16. package/dist/eject-theme/components/Callout/index.scss +0 -2
  17. package/dist/eject-theme/components/Callout/index.tsx +8 -2
  18. package/dist/eject-theme/components/CodeBlock/index.scss +12 -18
  19. package/dist/eject-theme/components/CodeBlock/index.tsx +10 -1
  20. package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +50 -11
  21. package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -3
  22. package/dist/eject-theme/components/CodeButtonGroup/index.scss +5 -1
  23. package/dist/eject-theme/components/CodeButtonGroup/index.tsx +1 -3
  24. package/dist/eject-theme/components/DocContent/doc.scss +27 -7
  25. package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +2 -1
  26. package/dist/eject-theme/components/DocContent/docComponents/table.tsx +10 -4
  27. package/dist/eject-theme/components/DocContent/index.tsx +21 -4
  28. package/dist/eject-theme/components/DocFooter/index.tsx +1 -6
  29. package/dist/eject-theme/components/{DocContent/FallbackHeading.tsx → FallbackHeading/index.tsx} +20 -11
  30. package/dist/eject-theme/components/HoverGroup/index.scss +1 -1
  31. package/dist/eject-theme/components/LastUpdated/index.tsx +8 -1
  32. package/dist/eject-theme/components/Link/index.tsx +22 -6
  33. package/dist/eject-theme/components/Nav/NavMenu.tsx +2 -3
  34. package/dist/eject-theme/components/NavHamburger/index.tsx +3 -4
  35. package/dist/eject-theme/components/NavScreen/NavScreenLangs.scss +6 -0
  36. package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +23 -9
  37. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +2 -3
  38. package/dist/eject-theme/components/NavScreen/NavScreenVersions.scss +6 -0
  39. package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +22 -9
  40. package/dist/eject-theme/components/Overview/index.tsx +7 -8
  41. package/dist/eject-theme/components/{Overview/OverviewGroup.scss → OverviewGroup/index.scss} +66 -12
  42. package/dist/eject-theme/components/{Overview/OverviewGroup.tsx → OverviewGroup/index.tsx} +51 -5
  43. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +12 -0
  44. package/dist/eject-theme/components/PrevNextPage/index.tsx +6 -3
  45. package/dist/eject-theme/components/Root/index.tsx +58 -0
  46. package/dist/eject-theme/components/Search/NoSearchResult.tsx +2 -3
  47. package/dist/eject-theme/components/Search/SearchButton.tsx +3 -4
  48. package/dist/eject-theme/components/Search/SearchPanel.tsx +12 -7
  49. package/dist/eject-theme/components/Search/SuggestItem.tsx +15 -12
  50. package/dist/eject-theme/components/Search/logic/util.test.ts +1 -1
  51. package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +2 -3
  52. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -0
  53. package/dist/eject-theme/components/SidebarMenu/index.tsx +4 -4
  54. package/dist/eject-theme/components/SocialLinks/index.tsx +2 -3
  55. package/dist/eject-theme/components/SourceCode/index.tsx +6 -4
  56. package/dist/eject-theme/components/SwitchAppearance/index.tsx +3 -5
  57. package/dist/eject-theme/components/Tabs/index.scss +31 -26
  58. package/dist/eject-theme/components/Tabs/index.tsx +16 -0
  59. package/dist/eject-theme/components/Tag/index.tsx +84 -5
  60. package/dist/eject-theme/components/Toc/TocItem.scss +3 -3
  61. package/dist/eject-theme/components/Toc/TocItem.tsx +1 -0
  62. package/dist/index.d.ts +6 -6
  63. package/dist/index.js +16 -3134
  64. package/dist/node/PluginDriver.d.ts +1 -1
  65. package/dist/node/PluginDriver.js +142 -0
  66. package/dist/node/auto-nav-sidebar/index.js +44 -0
  67. package/dist/node/auto-nav-sidebar/locales.js +26 -0
  68. package/dist/node/auto-nav-sidebar/normalize.js +230 -0
  69. package/dist/node/auto-nav-sidebar/utils.js +68 -0
  70. package/dist/node/auto-nav-sidebar/walk.js +67 -0
  71. package/dist/node/build.js +31 -0
  72. package/dist/node/constants.d.ts +2 -0
  73. package/dist/node/constants.js +34 -0
  74. package/dist/node/dev.js +32 -0
  75. package/dist/node/eject.js +111 -0
  76. package/dist/node/index.d.ts +5 -5
  77. package/dist/node/initRsbuild.d.ts +2 -2
  78. package/dist/node/initRsbuild.js +346 -0
  79. package/dist/node/last-updated/index.js +28 -0
  80. package/dist/node/logger/hint.d.ts +1 -1
  81. package/dist/node/logger/hint.js +85 -0
  82. package/dist/node/mdx/loader.d.ts +1 -1
  83. package/dist/node/mdx/loader.e1578c62.js +13 -0
  84. package/dist/{loader.js → node/mdx/loader.js} +4 -3
  85. package/dist/node/mdx/options.d.ts +2 -2
  86. package/dist/node/mdx/options.js +103 -0
  87. package/dist/node/mdx/processor.d.ts +2 -2
  88. package/dist/node/mdx/processor.js +71 -0
  89. package/dist/node/mdx/rehypePlugins/codeMeta.js +10 -0
  90. package/dist/node/mdx/rehypePlugins/headerAnchor.js +53 -0
  91. package/dist/node/mdx/rehypePlugins/shiki.js +34 -0
  92. package/dist/node/mdx/rehypePlugins/transformers/add-lang.js +15 -0
  93. package/dist/node/mdx/rehypePlugins/transformers/add-line-numbers.js +22 -0
  94. package/dist/node/mdx/rehypePlugins/transformers/add-title.js +24 -0
  95. package/dist/node/mdx/rehypePlugins/transformers/add-wrap-code.js +22 -0
  96. package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +5 -5
  97. package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -0
  98. package/dist/node/mdx/rehypePlugins/transformers/meta-highlight.js +41 -0
  99. package/dist/node/mdx/remarkPlugins/builtin.js +11 -0
  100. package/dist/node/mdx/remarkPlugins/containerSyntax.js +190 -0
  101. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +66 -0
  102. package/dist/node/mdx/remarkPlugins/image.js +67 -0
  103. package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
  104. package/dist/node/mdx/remarkPlugins/link.js +99 -0
  105. package/dist/node/mdx/remarkPlugins/toc.js +50 -0
  106. package/dist/node/mdx/types.d.ts +3 -3
  107. package/dist/node/medium-zoom/index.d.ts +1 -1
  108. package/dist/node/medium-zoom/index.js +14 -0
  109. package/dist/node/route/RoutePage.d.ts +1 -1
  110. package/dist/node/route/RoutePage.js +61 -0
  111. package/dist/node/route/RouteService.d.ts +1 -1
  112. package/dist/node/route/RouteService.js +177 -0
  113. package/dist/node/route/extractPageData.d.ts +1 -1
  114. package/dist/node/route/extractPageData.js +112 -0
  115. package/dist/node/route/normalizeRoutePath.js +54 -0
  116. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +21 -0
  117. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +150 -0
  118. package/dist/node/runtimeModule/globalStyles.d.ts +1 -1
  119. package/dist/node/runtimeModule/globalStyles.js +12 -0
  120. package/dist/node/runtimeModule/globalUIComponents.d.ts +1 -1
  121. package/dist/node/runtimeModule/globalUIComponents.js +25 -0
  122. package/dist/node/runtimeModule/i18n.d.ts +2 -2
  123. package/dist/node/runtimeModule/i18n.js +83 -0
  124. package/dist/node/runtimeModule/pageData/createPageData.d.ts +1 -1
  125. package/dist/node/runtimeModule/pageData/createPageData.js +64 -0
  126. package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
  127. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +51 -0
  128. package/dist/node/runtimeModule/routeList.d.ts +1 -1
  129. package/dist/node/runtimeModule/routeList.js +7 -0
  130. package/dist/node/runtimeModule/searchHooks.d.ts +1 -1
  131. package/dist/node/runtimeModule/searchHooks.js +11 -0
  132. package/dist/node/runtimeModule/siteData/createSiteData.js +34 -0
  133. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +94 -0
  134. package/dist/node/runtimeModule/siteData/rsbuildPlugin.d.ts +1 -1
  135. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +24 -0
  136. package/dist/node/runtimeModule/socialLinks.d.ts +1 -1
  137. package/dist/node/runtimeModule/socialLinks.js +8 -0
  138. package/dist/node/runtimeModule/types.d.ts +2 -2
  139. package/dist/node/serve.js +23 -0
  140. package/dist/node/ssg/renderHtmlTemplate.js +33 -0
  141. package/dist/node/ssg/renderPage.js +34 -0
  142. package/dist/node/ssg/renderPageWorker.474f9f73.js +2 -0
  143. package/dist/node/ssg/renderPageWorker.js +15 -0
  144. package/dist/node/ssg/renderPages.d.ts +1 -1
  145. package/dist/node/ssg/renderPages.js +105 -0
  146. package/dist/node/ssg/renderPages.js.LICENSE.txt +4 -0
  147. package/dist/node/ssg/rsbuildPluginCSR.d.ts +1 -1
  148. package/dist/node/ssg/rsbuildPluginCSR.js +27 -0
  149. package/dist/node/ssg/rsbuildPluginSSG.d.ts +1 -1
  150. package/dist/node/ssg/rsbuildPluginSSG.js +72 -0
  151. package/dist/node/ssg/ssgEnv.js +33 -0
  152. package/dist/node/ssg/ssgEnv.js.LICENSE.txt +5 -0
  153. package/dist/node/ssg-md/llms/emitLlmsTxt.d.ts +1 -1
  154. package/dist/node/ssg-md/llms/emitLlmsTxt.js +84 -0
  155. package/dist/node/ssg-md/llms/llmsTxt.d.ts +1 -1
  156. package/dist/node/ssg-md/llms/llmsTxt.js +66 -0
  157. package/dist/node/ssg-md/react/index.d.ts +1 -1
  158. package/dist/node/ssg-md/remarkSplitMdx.js +244 -0
  159. package/dist/node/ssg-md/renderPage.js +31 -0
  160. package/dist/node/ssg-md/renderPages.d.ts +1 -1
  161. package/dist/node/ssg-md/renderPages.js +27 -0
  162. package/dist/node/ssg-md/rsbuildPluginSSGMD.d.ts +1 -1
  163. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +47 -0
  164. package/dist/node/utils/applyReplaceRules.js +6 -0
  165. package/dist/node/utils/checkLanguageParity.js +77 -0
  166. package/dist/node/utils/createHash.js +5 -0
  167. package/dist/node/utils/error.d.ts +9 -0
  168. package/dist/node/utils/error.js +10 -0
  169. package/dist/node/utils/escapeHeadingIds.js +5 -0
  170. package/dist/node/utils/flattenMdxContent.js +74 -0
  171. package/dist/node/utils/fs.js +14 -0
  172. package/dist/node/utils/getImportAstNode.js +63 -0
  173. package/dist/node/utils/getPageKey.js +6 -0
  174. package/dist/node/utils/getSocialIcons.js +32 -0
  175. package/dist/node/utils/index.d.ts +10 -9
  176. package/dist/node/utils/normalizePath.js +10 -0
  177. package/dist/node/utils/reactAlias.d.ts +2 -0
  178. package/dist/node/utils/reactAlias.js +83 -0
  179. package/dist/rslib-runtime.99091bf6.js +18 -0
  180. package/dist/runtime/App.js +2 -2
  181. package/dist/runtime/ClientApp.d.ts +1 -1
  182. package/dist/runtime/ClientApp.js +0 -4
  183. package/dist/runtime/initPageData.js +1 -1
  184. package/dist/runtime/ssrMdServerEntry.js +1 -1
  185. package/dist/runtime/ssrServerEntry.js +2 -1
  186. package/dist/runtime.72d450ac.js +1 -0
  187. package/dist/runtime.js +3 -2
  188. package/dist/shiki-transformers.d.ts +1 -1
  189. package/dist/shiki-transformers.js +6 -120
  190. package/dist/theme/assets/deprecated.js +18 -0
  191. package/dist/theme/assets/experimental.js +21 -0
  192. package/dist/theme/components/Badge/index.css +1 -0
  193. package/dist/theme/components/Banner/index.d.ts +1 -1
  194. package/dist/theme/components/Banner/index.js +4 -5
  195. package/dist/theme/components/Callout/index.css +0 -2
  196. package/dist/theme/components/Callout/index.js +5 -2
  197. package/dist/theme/components/CodeBlock/index.css +11 -21
  198. package/dist/theme/components/CodeBlock/index.js +5 -1
  199. package/dist/theme/components/CodeBlockRuntime/index.d.ts +1 -1
  200. package/dist/theme/components/CodeBlockRuntime/index.js +38 -8
  201. package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +3 -5
  202. package/dist/theme/components/CodeButtonGroup/index.css +5 -1
  203. package/dist/theme/components/CodeButtonGroup/index.js +3 -5
  204. package/dist/theme/components/DocContent/doc.css +28 -7
  205. package/dist/theme/components/DocContent/docComponents/index.d.ts +3 -3
  206. package/dist/theme/components/DocContent/docComponents/pre.js +3 -1
  207. package/dist/theme/components/DocContent/docComponents/table.d.ts +2 -2
  208. package/dist/theme/components/DocContent/docComponents/table.js +8 -3
  209. package/dist/theme/components/DocContent/index.d.ts +11 -2
  210. package/dist/theme/components/DocContent/index.js +6 -6
  211. package/dist/theme/components/DocFooter/index.js +1 -5
  212. package/dist/theme/components/{DocContent/FallbackHeading.js → FallbackHeading/index.js} +19 -11
  213. package/dist/theme/components/HoverGroup/index.css +3 -3
  214. package/dist/theme/components/HoverGroup/useHoverGroup.d.ts +1 -1
  215. package/dist/theme/components/LastUpdated/index.d.ts +1 -1
  216. package/dist/theme/components/LastUpdated/index.js +5 -1
  217. package/dist/theme/components/Link/index.d.ts +1 -1
  218. package/dist/theme/components/Link/index.js +17 -7
  219. package/dist/theme/components/Nav/NavMenu.js +2 -3
  220. package/dist/theme/components/NavHamburger/index.js +3 -4
  221. package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
  222. package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
  223. package/dist/theme/components/NavScreen/NavScreenMenuItem.js +2 -3
  224. package/dist/theme/components/NavScreen/NavScreenVersions.css +6 -0
  225. package/dist/theme/components/NavScreen/NavScreenVersions.js +12 -3
  226. package/dist/theme/components/Overview/index.d.ts +0 -1
  227. package/dist/theme/components/Overview/index.js +2 -3
  228. package/dist/theme/components/{Overview/OverviewGroup.css → OverviewGroup/index.css} +60 -8
  229. package/dist/theme/components/{Overview/OverviewGroup.d.ts → OverviewGroup/index.d.ts} +1 -1
  230. package/dist/theme/components/OverviewGroup/index.js +88 -0
  231. package/dist/theme/components/PackageManagerTabs/index.d.ts +1 -1
  232. package/dist/theme/components/PackageManagerTabs/index.js +4 -0
  233. package/dist/theme/components/PrevNextPage/index.js +3 -4
  234. package/dist/theme/components/Root/index.d.ts +54 -0
  235. package/dist/theme/components/Root/index.js +7 -0
  236. package/dist/theme/components/Search/NoSearchResult.js +2 -3
  237. package/dist/theme/components/Search/SearchButton.js +3 -4
  238. package/dist/theme/components/Search/SearchPanel.js +12 -15
  239. package/dist/theme/components/Search/SuggestItem.d.ts +1 -1
  240. package/dist/theme/components/Search/SuggestItem.js +7 -11
  241. package/dist/theme/components/Search/logic/Provider.d.ts +1 -1
  242. package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +2 -2
  243. package/dist/theme/components/Search/logic/search.d.ts +1 -1
  244. package/dist/theme/components/Search/logic/util.test.js +1 -1
  245. package/dist/theme/components/Sidebar/SidebarGroup.js +2 -3
  246. package/dist/theme/components/Sidebar/SidebarItem.js +1 -0
  247. package/dist/theme/components/SidebarMenu/index.js +3 -5
  248. package/dist/theme/components/SocialLinks/index.js +2 -3
  249. package/dist/theme/components/SourceCode/index.js +2 -4
  250. package/dist/theme/components/SwitchAppearance/index.js +3 -5
  251. package/dist/theme/components/Tabs/index.css +19 -27
  252. package/dist/theme/components/Tabs/index.js +9 -0
  253. package/dist/theme/components/Tag/index.d.ts +3 -0
  254. package/dist/theme/components/Tag/index.js +63 -8
  255. package/dist/theme/components/Toc/TocItem.css +2 -3
  256. package/dist/theme/components/Toc/TocItem.js +1 -0
  257. package/dist/theme/hooks/useActiveAnchor.js +1 -1
  258. package/dist/theme/icons.d.ts +27 -0
  259. package/dist/theme/icons.js +51 -0
  260. package/dist/theme/index.d.ts +64 -59
  261. package/dist/theme/index.js +7 -2
  262. package/dist/theme/layout/DocLayout/index.css +2 -4
  263. package/dist/theme/layout/Layout/index.js +1 -2
  264. package/dist/theme/layout/NotFountLayout/index.js +1 -1
  265. package/dist/theme/logic/useAppearance.js +1 -1
  266. package/dist/theme/logic/useFullTextSearch.d.ts +1 -1
  267. package/dist/theme/logic/useMediaQuery.js +1 -1
  268. package/dist/theme/styles/base.css +1 -0
  269. package/dist/theme/styles/scrollbar.css +1 -0
  270. package/dist/theme/styles/shiki.css +9 -3
  271. package/dist/theme/styles/vars/base-vars.css +7 -5
  272. package/dist/theme/styles/vars/code-vars.css +2 -0
  273. package/dist/theme/styles/vars/home-vars.css +2 -1
  274. package/package.json +22 -23
  275. package/dist/3~128.js +0 -74
  276. package/dist/3~517.js +0 -1786
  277. package/dist/3~894.js +0 -26
  278. package/dist/cli.js +0 -259
  279. package/dist/index.js.LICENSE.txt +0 -10
  280. package/dist/node/auto-nav-sidebar/fixtures/docs/guide/c.d.ts +0 -2
  281. package/dist/node/auto-nav-sidebar/fixtures/docs-locales/en/guide/c.d.ts +0 -2
  282. package/dist/node/auto-nav-sidebar/fixtures/docs-locales/zh/guide/c.d.ts +0 -2
  283. package/dist/node/auto-nav-sidebar/locales.test.d.ts +0 -1
  284. package/dist/node/auto-nav-sidebar/walk.test.d.ts +0 -1
  285. package/dist/node/mdx/rehypePlugins/headerAnchor.test.d.ts +0 -1
  286. package/dist/node/mdx/remarkPlugins/containerSyntax.test.d.ts +0 -1
  287. package/dist/node/mdx/remarkPlugins/fileCodeBlock.test.d.ts +0 -1
  288. package/dist/node/mdx/remarkPlugins/image.test.d.ts +0 -1
  289. package/dist/node/mdx/remarkPlugins/link.test.d.ts +0 -1
  290. package/dist/node/route/RouteService.test.d.ts +0 -1
  291. package/dist/node/route/extractPageData.test.d.ts +0 -1
  292. package/dist/node/route/fixtures/basic/guide/c.d.ts +0 -2
  293. package/dist/node/route/normalizeRoutePath.test.d.ts +0 -1
  294. package/dist/node/runtimeModule/i18n.test.d.ts +0 -1
  295. package/dist/node/ssg-md/remarkSplitMdx.test.d.ts +0 -4
  296. package/dist/node/utils/checkLanguageParity.test.d.ts +0 -1
  297. package/dist/node/utils/detectCustomIcon.d.ts +0 -1
  298. package/dist/node/utils/detectReactVersion.d.ts +0 -3
  299. package/dist/processor.js +0 -4539
  300. package/dist/renderPageWorker.js +0 -196
  301. package/dist/theme/components/Overview/OverviewGroup.js +0 -58
  302. package/dist/theme/components/Search/logic/util.test.d.ts +0 -1
  303. /package/dist/cli/{config.d.ts → config/index.d.ts} +0 -0
  304. /package/dist/eject-theme/components/{Overview → OverviewGroup}/icons/plugin.svg +0 -0
  305. /package/dist/{shiki-transformers.js.LICENSE.txt → node/mdx/rehypePlugins/transformers/meta-highlight.js.LICENSE.txt} +0 -0
  306. /package/dist/theme/components/{DocContent/FallbackHeading.d.ts → FallbackHeading/index.d.ts} +0 -0
  307. /package/dist/theme/components/{Overview → OverviewGroup}/icons/plugin.js +0 -0
@@ -0,0 +1,1794 @@
1
+ import * as __rspack_external_child_process from "child_process";
2
+ import * as __rspack_external_fs from "fs";
3
+ import * as __rspack_external_path from "path";
4
+ import * as __rspack_external_stream from "stream";
5
+ import { __webpack_require__ } from "./rslib-runtime.99091bf6.js";
6
+ import { Buffer } from "node:buffer";
7
+ import node_child_process, { ChildProcess } from "node:child_process";
8
+ import { setTimeout as promises_setTimeout } from "node:timers/promises";
9
+ import { debuglog } from "node:util";
10
+ import { node_process, node_os, constants } from "./9643.f109822d.js";
11
+ import { node_path } from "./6289.c67fe0d5.js";
12
+ import { node_url } from "./5485.077f14ff.js";
13
+ import { createWriteStream, createReadStream, readFileSync } from "./3521.56e42d70.js";
14
+ __webpack_require__.add({
15
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16
+ const cp = __webpack_require__("child_process");
17
+ const parse = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js");
18
+ const enoent = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");
19
+ function spawn(command, args, options) {
20
+ const parsed = parse(command, args, options);
21
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
22
+ enoent.hookChildProcess(spawned, parsed);
23
+ return spawned;
24
+ }
25
+ function spawnSync(command, args, options) {
26
+ const parsed = parse(command, args, options);
27
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
28
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
29
+ return result;
30
+ }
31
+ module.exports = spawn;
32
+ module.exports.spawn = spawn;
33
+ module.exports.sync = spawnSync;
34
+ module.exports._parse = parse;
35
+ module.exports._enoent = enoent;
36
+ },
37
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js" (module) {
38
+ const isWin = 'win32' === process.platform;
39
+ function notFoundError(original, syscall) {
40
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
41
+ code: 'ENOENT',
42
+ errno: 'ENOENT',
43
+ syscall: `${syscall} ${original.command}`,
44
+ path: original.command,
45
+ spawnargs: original.args
46
+ });
47
+ }
48
+ function hookChildProcess(cp, parsed) {
49
+ if (!isWin) return;
50
+ const originalEmit = cp.emit;
51
+ cp.emit = function(name, arg1) {
52
+ if ('exit' === name) {
53
+ const err = verifyENOENT(arg1, parsed);
54
+ if (err) return originalEmit.call(cp, 'error', err);
55
+ }
56
+ return originalEmit.apply(cp, arguments);
57
+ };
58
+ }
59
+ function verifyENOENT(status, parsed) {
60
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
61
+ return null;
62
+ }
63
+ function verifyENOENTSync(status, parsed) {
64
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
65
+ return null;
66
+ }
67
+ module.exports = {
68
+ hookChildProcess,
69
+ verifyENOENT,
70
+ verifyENOENTSync,
71
+ notFoundError
72
+ };
73
+ },
74
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
75
+ const path = __webpack_require__("path");
76
+ const resolveCommand = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js");
77
+ const escape = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js");
78
+ const readShebang = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js");
79
+ const isWin = 'win32' === process.platform;
80
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
81
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
82
+ function detectShebang(parsed) {
83
+ parsed.file = resolveCommand(parsed);
84
+ const shebang = parsed.file && readShebang(parsed.file);
85
+ if (shebang) {
86
+ parsed.args.unshift(parsed.file);
87
+ parsed.command = shebang;
88
+ return resolveCommand(parsed);
89
+ }
90
+ return parsed.file;
91
+ }
92
+ function parseNonShell(parsed) {
93
+ if (!isWin) return parsed;
94
+ const commandFile = detectShebang(parsed);
95
+ const needsShell = !isExecutableRegExp.test(commandFile);
96
+ if (parsed.options.forceShell || needsShell) {
97
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
98
+ parsed.command = path.normalize(parsed.command);
99
+ parsed.command = escape.command(parsed.command);
100
+ parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
101
+ const shellCommand = [
102
+ parsed.command
103
+ ].concat(parsed.args).join(' ');
104
+ parsed.args = [
105
+ '/d',
106
+ '/s',
107
+ '/c',
108
+ `"${shellCommand}"`
109
+ ];
110
+ parsed.command = process.env.comspec || 'cmd.exe';
111
+ parsed.options.windowsVerbatimArguments = true;
112
+ }
113
+ return parsed;
114
+ }
115
+ function parse(command, args, options) {
116
+ if (args && !Array.isArray(args)) {
117
+ options = args;
118
+ args = null;
119
+ }
120
+ args = args ? args.slice(0) : [];
121
+ options = Object.assign({}, options);
122
+ const parsed = {
123
+ command,
124
+ args,
125
+ options,
126
+ file: void 0,
127
+ original: {
128
+ command,
129
+ args
130
+ }
131
+ };
132
+ return options.shell ? parsed : parseNonShell(parsed);
133
+ }
134
+ module.exports = parse;
135
+ },
136
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js" (module) {
137
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
138
+ function escapeCommand(arg) {
139
+ arg = arg.replace(metaCharsRegExp, '^$1');
140
+ return arg;
141
+ }
142
+ function escapeArgument(arg, doubleEscapeMetaChars) {
143
+ arg = `${arg}`;
144
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
145
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
146
+ arg = `"${arg}"`;
147
+ arg = arg.replace(metaCharsRegExp, '^$1');
148
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
149
+ return arg;
150
+ }
151
+ module.exports.command = escapeCommand;
152
+ module.exports.argument = escapeArgument;
153
+ },
154
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js" (module, __unused_rspack_exports, __webpack_require__) {
155
+ const fs = __webpack_require__("fs");
156
+ const shebangCommand = __webpack_require__("../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");
157
+ function readShebang(command) {
158
+ const size = 150;
159
+ const buffer = Buffer.alloc(size);
160
+ let fd;
161
+ try {
162
+ fd = fs.openSync(command, 'r');
163
+ fs.readSync(fd, buffer, 0, size, 0);
164
+ fs.closeSync(fd);
165
+ } catch (e) {}
166
+ return shebangCommand(buffer.toString());
167
+ }
168
+ module.exports = readShebang;
169
+ },
170
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js" (module, __unused_rspack_exports, __webpack_require__) {
171
+ const path = __webpack_require__("path");
172
+ const which = __webpack_require__("../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js");
173
+ const getPathKey = __webpack_require__("../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");
174
+ function resolveCommandAttempt(parsed, withoutPathExt) {
175
+ const env = parsed.options.env || process.env;
176
+ const cwd = process.cwd();
177
+ const hasCustomCwd = null != parsed.options.cwd;
178
+ const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
179
+ if (shouldSwitchCwd) try {
180
+ process.chdir(parsed.options.cwd);
181
+ } catch (err) {}
182
+ let resolved;
183
+ try {
184
+ resolved = which.sync(parsed.command, {
185
+ path: env[getPathKey({
186
+ env
187
+ })],
188
+ pathExt: withoutPathExt ? path.delimiter : void 0
189
+ });
190
+ } catch (e) {} finally{
191
+ if (shouldSwitchCwd) process.chdir(cwd);
192
+ }
193
+ if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
194
+ return resolved;
195
+ }
196
+ function resolveCommand(parsed) {
197
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
198
+ }
199
+ module.exports = resolveCommand;
200
+ },
201
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js" (module, __unused_rspack_exports, __webpack_require__) {
202
+ __webpack_require__("fs");
203
+ var core;
204
+ core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js") : __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js");
205
+ module.exports = isexe;
206
+ isexe.sync = sync;
207
+ function isexe(path, options, cb) {
208
+ if ('function' == typeof options) {
209
+ cb = options;
210
+ options = {};
211
+ }
212
+ if (!cb) {
213
+ if ('function' != typeof Promise) throw new TypeError('callback not provided');
214
+ return new Promise(function(resolve, reject) {
215
+ isexe(path, options || {}, function(er, is) {
216
+ if (er) reject(er);
217
+ else resolve(is);
218
+ });
219
+ });
220
+ }
221
+ core(path, options || {}, function(er, is) {
222
+ if (er) {
223
+ if ('EACCES' === er.code || options && options.ignoreErrors) {
224
+ er = null;
225
+ is = false;
226
+ }
227
+ }
228
+ cb(er, is);
229
+ });
230
+ }
231
+ function sync(path, options) {
232
+ try {
233
+ return core.sync(path, options || {});
234
+ } catch (er) {
235
+ if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
236
+ throw er;
237
+ }
238
+ }
239
+ },
240
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js" (module, __unused_rspack_exports, __webpack_require__) {
241
+ module.exports = isexe;
242
+ isexe.sync = sync;
243
+ var fs = __webpack_require__("fs");
244
+ function isexe(path, options, cb) {
245
+ fs.stat(path, function(er, stat) {
246
+ cb(er, er ? false : checkStat(stat, options));
247
+ });
248
+ }
249
+ function sync(path, options) {
250
+ return checkStat(fs.statSync(path), options);
251
+ }
252
+ function checkStat(stat, options) {
253
+ return stat.isFile() && checkMode(stat, options);
254
+ }
255
+ function checkMode(stat, options) {
256
+ var mod = stat.mode;
257
+ var uid = stat.uid;
258
+ var gid = stat.gid;
259
+ var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
260
+ var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
261
+ var u = parseInt('100', 8);
262
+ var g = parseInt('010', 8);
263
+ var o = parseInt('001', 8);
264
+ var ug = u | g;
265
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
266
+ return ret;
267
+ }
268
+ },
269
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js" (module, __unused_rspack_exports, __webpack_require__) {
270
+ module.exports = isexe;
271
+ isexe.sync = sync;
272
+ var fs = __webpack_require__("fs");
273
+ function checkPathExt(path, options) {
274
+ var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
275
+ if (!pathext) return true;
276
+ pathext = pathext.split(';');
277
+ if (-1 !== pathext.indexOf('')) return true;
278
+ for(var i = 0; i < pathext.length; i++){
279
+ var p = pathext[i].toLowerCase();
280
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
281
+ }
282
+ return false;
283
+ }
284
+ function checkStat(stat, path, options) {
285
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
286
+ return checkPathExt(path, options);
287
+ }
288
+ function isexe(path, options, cb) {
289
+ fs.stat(path, function(er, stat) {
290
+ cb(er, er ? false : checkStat(stat, path, options));
291
+ });
292
+ }
293
+ function sync(path, options) {
294
+ return checkStat(fs.statSync(path), path, options);
295
+ }
296
+ },
297
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js" (module, __unused_rspack_exports, __webpack_require__) {
298
+ const { PassThrough } = __webpack_require__("stream");
299
+ module.exports = function() {
300
+ var sources = [];
301
+ var output = new PassThrough({
302
+ objectMode: true
303
+ });
304
+ output.setMaxListeners(0);
305
+ output.add = add;
306
+ output.isEmpty = isEmpty;
307
+ output.on('unpipe', remove);
308
+ Array.prototype.slice.call(arguments).forEach(add);
309
+ return output;
310
+ function add(source) {
311
+ if (Array.isArray(source)) {
312
+ source.forEach(add);
313
+ return this;
314
+ }
315
+ sources.push(source);
316
+ source.once('end', remove.bind(null, source));
317
+ source.once('error', output.emit.bind(output, 'error'));
318
+ source.pipe(output, {
319
+ end: false
320
+ });
321
+ return this;
322
+ }
323
+ function isEmpty() {
324
+ return 0 == sources.length;
325
+ }
326
+ function remove(source) {
327
+ sources = sources.filter(function(it) {
328
+ return it !== source;
329
+ });
330
+ if (!sources.length && output.readable) output.end();
331
+ }
332
+ };
333
+ },
334
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js" (module) {
335
+ const pathKey = (options = {})=>{
336
+ const environment = options.env || process.env;
337
+ const platform = options.platform || process.platform;
338
+ if ('win32' !== platform) return 'PATH';
339
+ return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
340
+ };
341
+ module.exports = pathKey;
342
+ module.exports["default"] = pathKey;
343
+ },
344
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
345
+ const shebangRegex = __webpack_require__("../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
346
+ module.exports = (string = '')=>{
347
+ const match = string.match(shebangRegex);
348
+ if (!match) return null;
349
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
350
+ const binary = path.split('/').pop();
351
+ if ('env' === binary) return argument;
352
+ return argument ? `${binary} ${argument}` : binary;
353
+ };
354
+ },
355
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js" (module) {
356
+ module.exports = /^#!(.*)/;
357
+ },
358
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js" (module, __unused_rspack_exports, __webpack_require__) {
359
+ const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
360
+ const path = __webpack_require__("path");
361
+ const COLON = isWindows ? ';' : ':';
362
+ const isexe = __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js");
363
+ const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
364
+ code: 'ENOENT'
365
+ });
366
+ const getPathInfo = (cmd, opt)=>{
367
+ const colon = opt.colon || COLON;
368
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
369
+ ''
370
+ ] : [
371
+ ...isWindows ? [
372
+ process.cwd()
373
+ ] : [],
374
+ ...(opt.path || process.env.PATH || '').split(colon)
375
+ ];
376
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
377
+ const pathExt = isWindows ? pathExtExe.split(colon) : [
378
+ ''
379
+ ];
380
+ if (isWindows) {
381
+ if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
382
+ }
383
+ return {
384
+ pathEnv,
385
+ pathExt,
386
+ pathExtExe
387
+ };
388
+ };
389
+ const which = (cmd, opt, cb)=>{
390
+ if ('function' == typeof opt) {
391
+ cb = opt;
392
+ opt = {};
393
+ }
394
+ if (!opt) opt = {};
395
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
396
+ const found = [];
397
+ const step = (i)=>new Promise((resolve, reject)=>{
398
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
399
+ const ppRaw = pathEnv[i];
400
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
401
+ const pCmd = path.join(pathPart, cmd);
402
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
403
+ resolve(subStep(p, i, 0));
404
+ });
405
+ const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
406
+ if (ii === pathExt.length) return resolve(step(i + 1));
407
+ const ext = pathExt[ii];
408
+ isexe(p + ext, {
409
+ pathExt: pathExtExe
410
+ }, (er, is)=>{
411
+ if (!er && is) if (!opt.all) return resolve(p + ext);
412
+ else found.push(p + ext);
413
+ return resolve(subStep(p, i, ii + 1));
414
+ });
415
+ });
416
+ return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
417
+ };
418
+ const whichSync = (cmd, opt)=>{
419
+ opt = opt || {};
420
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
421
+ const found = [];
422
+ for(let i = 0; i < pathEnv.length; i++){
423
+ const ppRaw = pathEnv[i];
424
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
425
+ const pCmd = path.join(pathPart, cmd);
426
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
427
+ for(let j = 0; j < pathExt.length; j++){
428
+ const cur = p + pathExt[j];
429
+ try {
430
+ const is = isexe.sync(cur, {
431
+ pathExt: pathExtExe
432
+ });
433
+ if (is) if (!opt.all) return cur;
434
+ else found.push(cur);
435
+ } catch (ex) {}
436
+ }
437
+ }
438
+ if (opt.all && found.length) return found;
439
+ if (opt.nothrow) return null;
440
+ throw getNotFoundError(cmd);
441
+ };
442
+ module.exports = which;
443
+ which.sync = whichSync;
444
+ },
445
+ child_process (module) {
446
+ module.exports = __rspack_external_child_process;
447
+ },
448
+ fs (module) {
449
+ module.exports = __rspack_external_fs;
450
+ },
451
+ path (module) {
452
+ module.exports = __rspack_external_path;
453
+ },
454
+ stream (module) {
455
+ module.exports = __rspack_external_stream;
456
+ }
457
+ });
458
+ function stripFinalNewline(input) {
459
+ const LF = 'string' == typeof input ? '\n' : '\n'.charCodeAt();
460
+ const CR = 'string' == typeof input ? '\r' : '\r'.charCodeAt();
461
+ if (input[input.length - 1] === LF) input = input.slice(0, -1);
462
+ if (input[input.length - 1] === CR) input = input.slice(0, -1);
463
+ return input;
464
+ }
465
+ function pathKey(options = {}) {
466
+ const { env = process.env, platform = process.platform } = options;
467
+ if ('win32' !== platform) return 'PATH';
468
+ return Object.keys(env).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
469
+ }
470
+ function npmRunPath(options = {}) {
471
+ const { cwd = node_process.cwd(), path: path_ = node_process.env[pathKey()], execPath = node_process.execPath } = options;
472
+ let previous;
473
+ const cwdString = cwd instanceof URL ? node_url.fileURLToPath(cwd) : cwd;
474
+ let cwdPath = node_path.resolve(cwdString);
475
+ const result = [];
476
+ while(previous !== cwdPath){
477
+ result.push(node_path.join(cwdPath, 'node_modules/.bin'));
478
+ previous = cwdPath;
479
+ cwdPath = node_path.resolve(cwdPath, '..');
480
+ }
481
+ result.push(node_path.resolve(cwdString, execPath, '..'));
482
+ return [
483
+ ...result,
484
+ path_
485
+ ].join(node_path.delimiter);
486
+ }
487
+ function npmRunPathEnv({ env = node_process.env, ...options } = {}) {
488
+ env = {
489
+ ...env
490
+ };
491
+ const path = pathKey({
492
+ env
493
+ });
494
+ options.path = env[path];
495
+ env[path] = npmRunPath(options);
496
+ return env;
497
+ }
498
+ const copyProperty = (to, from, property, ignoreNonConfigurable)=>{
499
+ if ('length' === property || 'prototype' === property) return;
500
+ if ('arguments' === property || 'caller' === property) return;
501
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
502
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
503
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
504
+ Object.defineProperty(to, property, fromDescriptor);
505
+ };
506
+ const canCopyProperty = function(toDescriptor, fromDescriptor) {
507
+ return void 0 === toDescriptor || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
508
+ };
509
+ const changePrototype = (to, from)=>{
510
+ const fromPrototype = Object.getPrototypeOf(from);
511
+ if (fromPrototype === Object.getPrototypeOf(to)) return;
512
+ Object.setPrototypeOf(to, fromPrototype);
513
+ };
514
+ const wrappedToString = (withName, fromBody)=>`/* Wrapped ${withName}*/\n${fromBody}`;
515
+ const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
516
+ const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
517
+ const changeToString = (to, from, name)=>{
518
+ const withName = '' === name ? '' : `with ${name.trim()}() `;
519
+ const newToString = wrappedToString.bind(null, withName, from.toString());
520
+ Object.defineProperty(newToString, 'name', toStringName);
521
+ Object.defineProperty(to, 'toString', {
522
+ ...toStringDescriptor,
523
+ value: newToString
524
+ });
525
+ };
526
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
527
+ const { name } = to;
528
+ for (const property of Reflect.ownKeys(from))copyProperty(to, from, property, ignoreNonConfigurable);
529
+ changePrototype(to, from);
530
+ changeToString(to, from, name);
531
+ return to;
532
+ }
533
+ const calledFunctions = new WeakMap();
534
+ const onetime_onetime = (function_, options = {})=>{
535
+ if ('function' != typeof function_) throw new TypeError('Expected a function');
536
+ let returnValue;
537
+ let callCount = 0;
538
+ const functionName = function_.displayName || function_.name || '<anonymous>';
539
+ const onetime = function(...arguments_) {
540
+ calledFunctions.set(onetime, ++callCount);
541
+ if (1 === callCount) {
542
+ returnValue = function_.apply(this, arguments_);
543
+ function_ = null;
544
+ } else if (true === options.throw) throw new Error(`Function \`${functionName}\` can only be called once`);
545
+ return returnValue;
546
+ };
547
+ mimicFunction(onetime, function_);
548
+ calledFunctions.set(onetime, callCount);
549
+ return onetime;
550
+ };
551
+ onetime_onetime.callCount = (function_)=>{
552
+ if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
553
+ return calledFunctions.get(function_);
554
+ };
555
+ const node_modules_onetime = onetime_onetime;
556
+ const SIGNALS = [
557
+ {
558
+ name: "SIGHUP",
559
+ number: 1,
560
+ action: "terminate",
561
+ description: "Terminal closed",
562
+ standard: "posix"
563
+ },
564
+ {
565
+ name: "SIGINT",
566
+ number: 2,
567
+ action: "terminate",
568
+ description: "User interruption with CTRL-C",
569
+ standard: "ansi"
570
+ },
571
+ {
572
+ name: "SIGQUIT",
573
+ number: 3,
574
+ action: "core",
575
+ description: "User interruption with CTRL-\\",
576
+ standard: "posix"
577
+ },
578
+ {
579
+ name: "SIGILL",
580
+ number: 4,
581
+ action: "core",
582
+ description: "Invalid machine instruction",
583
+ standard: "ansi"
584
+ },
585
+ {
586
+ name: "SIGTRAP",
587
+ number: 5,
588
+ action: "core",
589
+ description: "Debugger breakpoint",
590
+ standard: "posix"
591
+ },
592
+ {
593
+ name: "SIGABRT",
594
+ number: 6,
595
+ action: "core",
596
+ description: "Aborted",
597
+ standard: "ansi"
598
+ },
599
+ {
600
+ name: "SIGIOT",
601
+ number: 6,
602
+ action: "core",
603
+ description: "Aborted",
604
+ standard: "bsd"
605
+ },
606
+ {
607
+ name: "SIGBUS",
608
+ number: 7,
609
+ action: "core",
610
+ description: "Bus error due to misaligned, non-existing address or paging error",
611
+ standard: "bsd"
612
+ },
613
+ {
614
+ name: "SIGEMT",
615
+ number: 7,
616
+ action: "terminate",
617
+ description: "Command should be emulated but is not implemented",
618
+ standard: "other"
619
+ },
620
+ {
621
+ name: "SIGFPE",
622
+ number: 8,
623
+ action: "core",
624
+ description: "Floating point arithmetic error",
625
+ standard: "ansi"
626
+ },
627
+ {
628
+ name: "SIGKILL",
629
+ number: 9,
630
+ action: "terminate",
631
+ description: "Forced termination",
632
+ standard: "posix",
633
+ forced: true
634
+ },
635
+ {
636
+ name: "SIGUSR1",
637
+ number: 10,
638
+ action: "terminate",
639
+ description: "Application-specific signal",
640
+ standard: "posix"
641
+ },
642
+ {
643
+ name: "SIGSEGV",
644
+ number: 11,
645
+ action: "core",
646
+ description: "Segmentation fault",
647
+ standard: "ansi"
648
+ },
649
+ {
650
+ name: "SIGUSR2",
651
+ number: 12,
652
+ action: "terminate",
653
+ description: "Application-specific signal",
654
+ standard: "posix"
655
+ },
656
+ {
657
+ name: "SIGPIPE",
658
+ number: 13,
659
+ action: "terminate",
660
+ description: "Broken pipe or socket",
661
+ standard: "posix"
662
+ },
663
+ {
664
+ name: "SIGALRM",
665
+ number: 14,
666
+ action: "terminate",
667
+ description: "Timeout or timer",
668
+ standard: "posix"
669
+ },
670
+ {
671
+ name: "SIGTERM",
672
+ number: 15,
673
+ action: "terminate",
674
+ description: "Termination",
675
+ standard: "ansi"
676
+ },
677
+ {
678
+ name: "SIGSTKFLT",
679
+ number: 16,
680
+ action: "terminate",
681
+ description: "Stack is empty or overflowed",
682
+ standard: "other"
683
+ },
684
+ {
685
+ name: "SIGCHLD",
686
+ number: 17,
687
+ action: "ignore",
688
+ description: "Child process terminated, paused or unpaused",
689
+ standard: "posix"
690
+ },
691
+ {
692
+ name: "SIGCLD",
693
+ number: 17,
694
+ action: "ignore",
695
+ description: "Child process terminated, paused or unpaused",
696
+ standard: "other"
697
+ },
698
+ {
699
+ name: "SIGCONT",
700
+ number: 18,
701
+ action: "unpause",
702
+ description: "Unpaused",
703
+ standard: "posix",
704
+ forced: true
705
+ },
706
+ {
707
+ name: "SIGSTOP",
708
+ number: 19,
709
+ action: "pause",
710
+ description: "Paused",
711
+ standard: "posix",
712
+ forced: true
713
+ },
714
+ {
715
+ name: "SIGTSTP",
716
+ number: 20,
717
+ action: "pause",
718
+ description: "Paused using CTRL-Z or \"suspend\"",
719
+ standard: "posix"
720
+ },
721
+ {
722
+ name: "SIGTTIN",
723
+ number: 21,
724
+ action: "pause",
725
+ description: "Background process cannot read terminal input",
726
+ standard: "posix"
727
+ },
728
+ {
729
+ name: "SIGBREAK",
730
+ number: 21,
731
+ action: "terminate",
732
+ description: "User interruption with CTRL-BREAK",
733
+ standard: "other"
734
+ },
735
+ {
736
+ name: "SIGTTOU",
737
+ number: 22,
738
+ action: "pause",
739
+ description: "Background process cannot write to terminal output",
740
+ standard: "posix"
741
+ },
742
+ {
743
+ name: "SIGURG",
744
+ number: 23,
745
+ action: "ignore",
746
+ description: "Socket received out-of-band data",
747
+ standard: "bsd"
748
+ },
749
+ {
750
+ name: "SIGXCPU",
751
+ number: 24,
752
+ action: "core",
753
+ description: "Process timed out",
754
+ standard: "bsd"
755
+ },
756
+ {
757
+ name: "SIGXFSZ",
758
+ number: 25,
759
+ action: "core",
760
+ description: "File too big",
761
+ standard: "bsd"
762
+ },
763
+ {
764
+ name: "SIGVTALRM",
765
+ number: 26,
766
+ action: "terminate",
767
+ description: "Timeout or timer",
768
+ standard: "bsd"
769
+ },
770
+ {
771
+ name: "SIGPROF",
772
+ number: 27,
773
+ action: "terminate",
774
+ description: "Timeout or timer",
775
+ standard: "bsd"
776
+ },
777
+ {
778
+ name: "SIGWINCH",
779
+ number: 28,
780
+ action: "ignore",
781
+ description: "Terminal window size changed",
782
+ standard: "bsd"
783
+ },
784
+ {
785
+ name: "SIGIO",
786
+ number: 29,
787
+ action: "terminate",
788
+ description: "I/O is available",
789
+ standard: "other"
790
+ },
791
+ {
792
+ name: "SIGPOLL",
793
+ number: 29,
794
+ action: "terminate",
795
+ description: "Watched event",
796
+ standard: "other"
797
+ },
798
+ {
799
+ name: "SIGINFO",
800
+ number: 29,
801
+ action: "ignore",
802
+ description: "Request for process information",
803
+ standard: "other"
804
+ },
805
+ {
806
+ name: "SIGPWR",
807
+ number: 30,
808
+ action: "terminate",
809
+ description: "Device running out of power",
810
+ standard: "systemv"
811
+ },
812
+ {
813
+ name: "SIGSYS",
814
+ number: 31,
815
+ action: "core",
816
+ description: "Invalid system call",
817
+ standard: "other"
818
+ },
819
+ {
820
+ name: "SIGUNUSED",
821
+ number: 31,
822
+ action: "terminate",
823
+ description: "Invalid system call",
824
+ standard: "other"
825
+ }
826
+ ];
827
+ const getRealtimeSignals = ()=>{
828
+ const length = SIGRTMAX - SIGRTMIN + 1;
829
+ return Array.from({
830
+ length
831
+ }, getRealtimeSignal);
832
+ };
833
+ const getRealtimeSignal = (value, index)=>({
834
+ name: `SIGRT${index + 1}`,
835
+ number: SIGRTMIN + index,
836
+ action: "terminate",
837
+ description: "Application-specific signal (realtime)",
838
+ standard: "posix"
839
+ });
840
+ const SIGRTMIN = 34;
841
+ const SIGRTMAX = 64;
842
+ const getSignals = ()=>{
843
+ const realtimeSignals = getRealtimeSignals();
844
+ const signals = [
845
+ ...SIGNALS,
846
+ ...realtimeSignals
847
+ ].map(normalizeSignal);
848
+ return signals;
849
+ };
850
+ const normalizeSignal = ({ name, number: defaultNumber, description, action, forced = false, standard })=>{
851
+ const { signals: { [name]: constantSignal } } = constants;
852
+ const supported = void 0 !== constantSignal;
853
+ const number = supported ? constantSignal : defaultNumber;
854
+ return {
855
+ name,
856
+ number,
857
+ description,
858
+ supported,
859
+ action,
860
+ forced,
861
+ standard
862
+ };
863
+ };
864
+ const getSignalsByName = ()=>{
865
+ const signals = getSignals();
866
+ return Object.fromEntries(signals.map(getSignalByName));
867
+ };
868
+ const getSignalByName = ({ name, number, description, supported, action, forced, standard })=>[
869
+ name,
870
+ {
871
+ name,
872
+ number,
873
+ description,
874
+ supported,
875
+ action,
876
+ forced,
877
+ standard
878
+ }
879
+ ];
880
+ const signalsByName = getSignalsByName();
881
+ const getSignalsByNumber = ()=>{
882
+ const signals = getSignals();
883
+ const length = 65;
884
+ const signalsA = Array.from({
885
+ length
886
+ }, (value, number)=>getSignalByNumber(number, signals));
887
+ return Object.assign({}, ...signalsA);
888
+ };
889
+ const getSignalByNumber = (number, signals)=>{
890
+ const signal = findSignalByNumber(number, signals);
891
+ if (void 0 === signal) return {};
892
+ const { name, description, supported, action, forced, standard } = signal;
893
+ return {
894
+ [number]: {
895
+ name,
896
+ number,
897
+ description,
898
+ supported,
899
+ action,
900
+ forced,
901
+ standard
902
+ }
903
+ };
904
+ };
905
+ const findSignalByNumber = (number, signals)=>{
906
+ const signal = signals.find(({ name })=>constants.signals[name] === number);
907
+ if (void 0 !== signal) return signal;
908
+ return signals.find((signalA)=>signalA.number === number);
909
+ };
910
+ getSignalsByNumber();
911
+ const getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled })=>{
912
+ if (timedOut) return `timed out after ${timeout} milliseconds`;
913
+ if (isCanceled) return 'was canceled';
914
+ if (void 0 !== errorCode) return `failed with ${errorCode}`;
915
+ if (void 0 !== signal) return `was killed with ${signal} (${signalDescription})`;
916
+ if (void 0 !== exitCode) return `failed with exit code ${exitCode}`;
917
+ return 'failed';
918
+ };
919
+ const makeError = ({ stdout, stderr, all, error, signal, exitCode, command, escapedCommand, timedOut, isCanceled, killed, parsed: { options: { timeout, cwd = node_process.cwd() } } })=>{
920
+ exitCode = null === exitCode ? void 0 : exitCode;
921
+ signal = null === signal ? void 0 : signal;
922
+ const signalDescription = void 0 === signal ? void 0 : signalsByName[signal].description;
923
+ const errorCode = error && error.code;
924
+ const prefix = getErrorPrefix({
925
+ timedOut,
926
+ timeout,
927
+ errorCode,
928
+ signal,
929
+ signalDescription,
930
+ exitCode,
931
+ isCanceled
932
+ });
933
+ const execaMessage = `Command ${prefix}: ${command}`;
934
+ const isError = '[object Error]' === Object.prototype.toString.call(error);
935
+ const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
936
+ const message = [
937
+ shortMessage,
938
+ stderr,
939
+ stdout
940
+ ].filter(Boolean).join('\n');
941
+ if (isError) {
942
+ error.originalMessage = error.message;
943
+ error.message = message;
944
+ } else error = new Error(message);
945
+ error.shortMessage = shortMessage;
946
+ error.command = command;
947
+ error.escapedCommand = escapedCommand;
948
+ error.exitCode = exitCode;
949
+ error.signal = signal;
950
+ error.signalDescription = signalDescription;
951
+ error.stdout = stdout;
952
+ error.stderr = stderr;
953
+ error.cwd = cwd;
954
+ if (void 0 !== all) error.all = all;
955
+ if ('bufferedData' in error) delete error.bufferedData;
956
+ error.failed = true;
957
+ error.timedOut = Boolean(timedOut);
958
+ error.isCanceled = isCanceled;
959
+ error.killed = killed && !timedOut;
960
+ return error;
961
+ };
962
+ const aliases = [
963
+ 'stdin',
964
+ 'stdout',
965
+ 'stderr'
966
+ ];
967
+ const hasAlias = (options)=>aliases.some((alias)=>void 0 !== options[alias]);
968
+ const normalizeStdio = (options)=>{
969
+ if (!options) return;
970
+ const { stdio } = options;
971
+ if (void 0 === stdio) return aliases.map((alias)=>options[alias]);
972
+ if (hasAlias(options)) throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias)=>`\`${alias}\``).join(', ')}`);
973
+ if ('string' == typeof stdio) return stdio;
974
+ if (!Array.isArray(stdio)) throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
975
+ const length = Math.max(stdio.length, aliases.length);
976
+ return Array.from({
977
+ length
978
+ }, (value, index)=>stdio[index]);
979
+ };
980
+ const signals_signals = [];
981
+ signals_signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
982
+ if ('win32' !== process.platform) signals_signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT');
983
+ if ('linux' === process.platform) signals_signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
984
+ const processOk = (process1)=>!!process1 && 'object' == typeof process1 && 'function' == typeof process1.removeListener && 'function' == typeof process1.emit && 'function' == typeof process1.reallyExit && 'function' == typeof process1.listeners && 'function' == typeof process1.kill && 'number' == typeof process1.pid && 'function' == typeof process1.on;
985
+ const kExitEmitter = Symbol.for('signal-exit emitter');
986
+ const global = globalThis;
987
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
988
+ class Emitter {
989
+ emitted = {
990
+ afterExit: false,
991
+ exit: false
992
+ };
993
+ listeners = {
994
+ afterExit: [],
995
+ exit: []
996
+ };
997
+ count = 0;
998
+ id = Math.random();
999
+ constructor(){
1000
+ if (global[kExitEmitter]) return global[kExitEmitter];
1001
+ ObjectDefineProperty(global, kExitEmitter, {
1002
+ value: this,
1003
+ writable: false,
1004
+ enumerable: false,
1005
+ configurable: false
1006
+ });
1007
+ }
1008
+ on(ev, fn) {
1009
+ this.listeners[ev].push(fn);
1010
+ }
1011
+ removeListener(ev, fn) {
1012
+ const list = this.listeners[ev];
1013
+ const i = list.indexOf(fn);
1014
+ if (-1 === i) return;
1015
+ if (0 === i && 1 === list.length) list.length = 0;
1016
+ else list.splice(i, 1);
1017
+ }
1018
+ emit(ev, code, signal) {
1019
+ if (this.emitted[ev]) return false;
1020
+ this.emitted[ev] = true;
1021
+ let ret = false;
1022
+ for (const fn of this.listeners[ev])ret = true === fn(code, signal) || ret;
1023
+ if ('exit' === ev) ret = this.emit('afterExit', code, signal) || ret;
1024
+ return ret;
1025
+ }
1026
+ }
1027
+ class SignalExitBase {
1028
+ }
1029
+ const signalExitWrap = (handler)=>({
1030
+ onExit (cb, opts) {
1031
+ return handler.onExit(cb, opts);
1032
+ },
1033
+ load () {
1034
+ return handler.load();
1035
+ },
1036
+ unload () {
1037
+ return handler.unload();
1038
+ }
1039
+ });
1040
+ class SignalExitFallback extends SignalExitBase {
1041
+ onExit() {
1042
+ return ()=>{};
1043
+ }
1044
+ load() {}
1045
+ unload() {}
1046
+ }
1047
+ class SignalExit extends SignalExitBase {
1048
+ #hupSig = 'win32' === mjs_process.platform ? 'SIGINT' : 'SIGHUP';
1049
+ #emitter = new Emitter();
1050
+ #process;
1051
+ #originalProcessEmit;
1052
+ #originalProcessReallyExit;
1053
+ #sigListeners = {};
1054
+ #loaded = false;
1055
+ constructor(process1){
1056
+ super();
1057
+ this.#process = process1;
1058
+ this.#sigListeners = {};
1059
+ for (const sig of signals_signals)this.#sigListeners[sig] = ()=>{
1060
+ const listeners = this.#process.listeners(sig);
1061
+ let { count } = this.#emitter;
1062
+ const p = process1;
1063
+ if ('object' == typeof p.__signal_exit_emitter__ && 'number' == typeof p.__signal_exit_emitter__.count) count += p.__signal_exit_emitter__.count;
1064
+ if (listeners.length === count) {
1065
+ this.unload();
1066
+ const ret = this.#emitter.emit('exit', null, sig);
1067
+ const s = 'SIGHUP' === sig ? this.#hupSig : sig;
1068
+ if (!ret) process1.kill(process1.pid, s);
1069
+ }
1070
+ };
1071
+ this.#originalProcessReallyExit = process1.reallyExit;
1072
+ this.#originalProcessEmit = process1.emit;
1073
+ }
1074
+ onExit(cb, opts) {
1075
+ if (!processOk(this.#process)) return ()=>{};
1076
+ if (false === this.#loaded) this.load();
1077
+ const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
1078
+ this.#emitter.on(ev, cb);
1079
+ return ()=>{
1080
+ this.#emitter.removeListener(ev, cb);
1081
+ if (0 === this.#emitter.listeners['exit'].length && 0 === this.#emitter.listeners['afterExit'].length) this.unload();
1082
+ };
1083
+ }
1084
+ load() {
1085
+ if (this.#loaded) return;
1086
+ this.#loaded = true;
1087
+ this.#emitter.count += 1;
1088
+ for (const sig of signals_signals)try {
1089
+ const fn = this.#sigListeners[sig];
1090
+ if (fn) this.#process.on(sig, fn);
1091
+ } catch (_) {}
1092
+ this.#process.emit = (ev, ...a)=>this.#processEmit(ev, ...a);
1093
+ this.#process.reallyExit = (code)=>this.#processReallyExit(code);
1094
+ }
1095
+ unload() {
1096
+ if (!this.#loaded) return;
1097
+ this.#loaded = false;
1098
+ signals_signals.forEach((sig)=>{
1099
+ const listener = this.#sigListeners[sig];
1100
+ if (!listener) throw new Error('Listener not defined for signal: ' + sig);
1101
+ try {
1102
+ this.#process.removeListener(sig, listener);
1103
+ } catch (_) {}
1104
+ });
1105
+ this.#process.emit = this.#originalProcessEmit;
1106
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1107
+ this.#emitter.count -= 1;
1108
+ }
1109
+ #processReallyExit(code) {
1110
+ if (!processOk(this.#process)) return 0;
1111
+ this.#process.exitCode = code || 0;
1112
+ this.#emitter.emit('exit', this.#process.exitCode, null);
1113
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1114
+ }
1115
+ #processEmit(ev, ...args) {
1116
+ const og = this.#originalProcessEmit;
1117
+ if (!('exit' === ev && processOk(this.#process))) return og.call(this.#process, ev, ...args);
1118
+ {
1119
+ if ('number' == typeof args[0]) this.#process.exitCode = args[0];
1120
+ const ret = og.call(this.#process, ev, ...args);
1121
+ this.#emitter.emit('exit', this.#process.exitCode, null);
1122
+ return ret;
1123
+ }
1124
+ }
1125
+ }
1126
+ const mjs_process = globalThis.process;
1127
+ const { onExit: onExit, load: load, unload: unload } = signalExitWrap(processOk(mjs_process) ? new SignalExit(mjs_process) : new SignalExitFallback());
1128
+ const DEFAULT_FORCE_KILL_TIMEOUT = 5000;
1129
+ const spawnedKill = (kill, signal = 'SIGTERM', options = {})=>{
1130
+ const killResult = kill(signal);
1131
+ setKillTimeout(kill, signal, options, killResult);
1132
+ return killResult;
1133
+ };
1134
+ const setKillTimeout = (kill, signal, options, killResult)=>{
1135
+ if (!shouldForceKill(signal, options, killResult)) return;
1136
+ const timeout = getForceKillAfterTimeout(options);
1137
+ const t = setTimeout(()=>{
1138
+ kill('SIGKILL');
1139
+ }, timeout);
1140
+ if (t.unref) t.unref();
1141
+ };
1142
+ const shouldForceKill = (signal, { forceKillAfterTimeout }, killResult)=>isSigterm(signal) && false !== forceKillAfterTimeout && killResult;
1143
+ const isSigterm = (signal)=>signal === node_os.constants.signals.SIGTERM || 'string' == typeof signal && 'SIGTERM' === signal.toUpperCase();
1144
+ const getForceKillAfterTimeout = ({ forceKillAfterTimeout = true })=>{
1145
+ if (true === forceKillAfterTimeout) return DEFAULT_FORCE_KILL_TIMEOUT;
1146
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1147
+ return forceKillAfterTimeout;
1148
+ };
1149
+ const spawnedCancel = (spawned, context)=>{
1150
+ const killResult = spawned.kill();
1151
+ if (killResult) context.isCanceled = true;
1152
+ };
1153
+ const timeoutKill = (spawned, signal, reject)=>{
1154
+ spawned.kill(signal);
1155
+ reject(Object.assign(new Error('Timed out'), {
1156
+ timedOut: true,
1157
+ signal
1158
+ }));
1159
+ };
1160
+ const setupTimeout = (spawned, { timeout, killSignal = 'SIGTERM' }, spawnedPromise)=>{
1161
+ if (0 === timeout || void 0 === timeout) return spawnedPromise;
1162
+ let timeoutId;
1163
+ const timeoutPromise = new Promise((resolve, reject)=>{
1164
+ timeoutId = setTimeout(()=>{
1165
+ timeoutKill(spawned, killSignal, reject);
1166
+ }, timeout);
1167
+ });
1168
+ const safeSpawnedPromise = spawnedPromise.finally(()=>{
1169
+ clearTimeout(timeoutId);
1170
+ });
1171
+ return Promise.race([
1172
+ timeoutPromise,
1173
+ safeSpawnedPromise
1174
+ ]);
1175
+ };
1176
+ const validateTimeout = ({ timeout })=>{
1177
+ if (void 0 !== timeout && (!Number.isFinite(timeout) || timeout < 0)) throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1178
+ };
1179
+ const setExitHandler = async (spawned, { cleanup, detached }, timedPromise)=>{
1180
+ if (!cleanup || detached) return timedPromise;
1181
+ const removeExitHandler = onExit(()=>{
1182
+ spawned.kill();
1183
+ });
1184
+ return timedPromise.finally(()=>{
1185
+ removeExitHandler();
1186
+ });
1187
+ };
1188
+ function isStream(stream) {
1189
+ return null !== stream && 'object' == typeof stream && 'function' == typeof stream.pipe;
1190
+ }
1191
+ function isWritableStream(stream) {
1192
+ return isStream(stream) && false !== stream.writable && 'function' == typeof stream._write && 'object' == typeof stream._writableState;
1193
+ }
1194
+ const isExecaChildProcess = (target)=>target instanceof ChildProcess && 'function' == typeof target.then;
1195
+ const pipeToTarget = (spawned, streamName, target)=>{
1196
+ if ('string' == typeof target) {
1197
+ spawned[streamName].pipe(createWriteStream(target));
1198
+ return spawned;
1199
+ }
1200
+ if (isWritableStream(target)) {
1201
+ spawned[streamName].pipe(target);
1202
+ return spawned;
1203
+ }
1204
+ if (!isExecaChildProcess(target)) throw new TypeError('The second argument must be a string, a stream or an Execa child process.');
1205
+ if (!isWritableStream(target.stdin)) throw new TypeError('The target child process\'s stdin must be available.');
1206
+ spawned[streamName].pipe(target.stdin);
1207
+ return target;
1208
+ };
1209
+ const addPipeMethods = (spawned)=>{
1210
+ if (null !== spawned.stdout) spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, 'stdout');
1211
+ if (null !== spawned.stderr) spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, 'stderr');
1212
+ if (void 0 !== spawned.all) spawned.pipeAll = pipeToTarget.bind(void 0, spawned, 'all');
1213
+ };
1214
+ const contents_getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = 1 / 0 } = {})=>{
1215
+ if (!isAsyncIterable(stream)) throw new Error('The first argument must be a Readable, a ReadableStream, or an async iterable.');
1216
+ const state = init();
1217
+ state.length = 0;
1218
+ try {
1219
+ for await (const chunk of stream){
1220
+ const chunkType = getChunkType(chunk);
1221
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1222
+ appendChunk({
1223
+ convertedChunk,
1224
+ state,
1225
+ getSize,
1226
+ truncateChunk,
1227
+ addChunk,
1228
+ maxBuffer
1229
+ });
1230
+ }
1231
+ appendFinalChunk({
1232
+ state,
1233
+ convertChunk,
1234
+ getSize,
1235
+ truncateChunk,
1236
+ addChunk,
1237
+ getFinalChunk,
1238
+ maxBuffer
1239
+ });
1240
+ return finalize(state);
1241
+ } catch (error) {
1242
+ error.bufferedData = finalize(state);
1243
+ throw error;
1244
+ }
1245
+ };
1246
+ const appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer })=>{
1247
+ const convertedChunk = getFinalChunk(state);
1248
+ if (void 0 !== convertedChunk) appendChunk({
1249
+ convertedChunk,
1250
+ state,
1251
+ getSize,
1252
+ truncateChunk,
1253
+ addChunk,
1254
+ maxBuffer
1255
+ });
1256
+ };
1257
+ const appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer })=>{
1258
+ const chunkSize = getSize(convertedChunk);
1259
+ const newLength = state.length + chunkSize;
1260
+ if (newLength <= maxBuffer) return void addNewChunk(convertedChunk, state, addChunk, newLength);
1261
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1262
+ if (void 0 !== truncatedChunk) addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1263
+ throw new MaxBufferError();
1264
+ };
1265
+ const addNewChunk = (convertedChunk, state, addChunk, newLength)=>{
1266
+ state.contents = addChunk(convertedChunk, state, newLength);
1267
+ state.length = newLength;
1268
+ };
1269
+ const isAsyncIterable = (stream)=>'object' == typeof stream && null !== stream && 'function' == typeof stream[Symbol.asyncIterator];
1270
+ const getChunkType = (chunk)=>{
1271
+ const typeOfChunk = typeof chunk;
1272
+ if ('string' === typeOfChunk) return 'string';
1273
+ if ('object' !== typeOfChunk || null === chunk) return 'others';
1274
+ if (globalThis.Buffer?.isBuffer(chunk)) return 'buffer';
1275
+ const prototypeName = objectToString.call(chunk);
1276
+ if ('[object ArrayBuffer]' === prototypeName) return 'arrayBuffer';
1277
+ if ('[object DataView]' === prototypeName) return 'dataView';
1278
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && '[object ArrayBuffer]' === objectToString.call(chunk.buffer)) return 'typedArray';
1279
+ return 'others';
1280
+ };
1281
+ const { toString: objectToString } = Object.prototype;
1282
+ class MaxBufferError extends Error {
1283
+ name = 'MaxBufferError';
1284
+ constructor(){
1285
+ super('maxBuffer exceeded');
1286
+ }
1287
+ }
1288
+ const utils_identity = (value)=>value;
1289
+ const utils_noop = ()=>void 0;
1290
+ const utils_getContentsProp = ({ contents })=>contents;
1291
+ const throwObjectStream = (chunk)=>{
1292
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1293
+ };
1294
+ const getLengthProp = (convertedChunk)=>convertedChunk.length;
1295
+ async function getStreamAsArrayBuffer(stream, options) {
1296
+ return contents_getStreamContents(stream, arrayBufferMethods, options);
1297
+ }
1298
+ const initArrayBuffer = ()=>({
1299
+ contents: new ArrayBuffer(0)
1300
+ });
1301
+ const useTextEncoder = (chunk)=>textEncoder.encode(chunk);
1302
+ const textEncoder = new TextEncoder();
1303
+ const useUint8Array = (chunk)=>new Uint8Array(chunk);
1304
+ const useUint8ArrayWithOffset = (chunk)=>new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1305
+ const truncateArrayBufferChunk = (convertedChunk, chunkSize)=>convertedChunk.slice(0, chunkSize);
1306
+ const addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length)=>{
1307
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1308
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1309
+ return newContents;
1310
+ };
1311
+ const resizeArrayBufferSlow = (contents, length)=>{
1312
+ if (length <= contents.byteLength) return contents;
1313
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1314
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1315
+ return arrayBuffer;
1316
+ };
1317
+ const resizeArrayBuffer = (contents, length)=>{
1318
+ if (length <= contents.maxByteLength) {
1319
+ contents.resize(length);
1320
+ return contents;
1321
+ }
1322
+ const arrayBuffer = new ArrayBuffer(length, {
1323
+ maxByteLength: getNewContentsLength(length)
1324
+ });
1325
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1326
+ return arrayBuffer;
1327
+ };
1328
+ const getNewContentsLength = (length)=>SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1329
+ const SCALE_FACTOR = 2;
1330
+ const finalizeArrayBuffer = ({ contents, length })=>hasArrayBufferResize() ? contents : contents.slice(0, length);
1331
+ const hasArrayBufferResize = ()=>'resize' in ArrayBuffer.prototype;
1332
+ const arrayBufferMethods = {
1333
+ init: initArrayBuffer,
1334
+ convertChunk: {
1335
+ string: useTextEncoder,
1336
+ buffer: useUint8Array,
1337
+ arrayBuffer: useUint8Array,
1338
+ dataView: useUint8ArrayWithOffset,
1339
+ typedArray: useUint8ArrayWithOffset,
1340
+ others: throwObjectStream
1341
+ },
1342
+ getSize: getLengthProp,
1343
+ truncateChunk: truncateArrayBufferChunk,
1344
+ addChunk: addArrayBufferChunk,
1345
+ getFinalChunk: utils_noop,
1346
+ finalize: finalizeArrayBuffer
1347
+ };
1348
+ async function getStreamAsBuffer(stream, options) {
1349
+ if (!('Buffer' in globalThis)) throw new Error('getStreamAsBuffer() is only supported in Node.js');
1350
+ try {
1351
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1352
+ } catch (error) {
1353
+ if (void 0 !== error.bufferedData) error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1354
+ throw error;
1355
+ }
1356
+ }
1357
+ const arrayBufferToNodeBuffer = (arrayBuffer)=>globalThis.Buffer.from(arrayBuffer);
1358
+ async function getStreamAsString(stream, options) {
1359
+ return contents_getStreamContents(stream, stringMethods, options);
1360
+ }
1361
+ const initString = ()=>({
1362
+ contents: '',
1363
+ textDecoder: new TextDecoder()
1364
+ });
1365
+ const useTextDecoder = (chunk, { textDecoder })=>textDecoder.decode(chunk, {
1366
+ stream: true
1367
+ });
1368
+ const addStringChunk = (convertedChunk, { contents })=>contents + convertedChunk;
1369
+ const truncateStringChunk = (convertedChunk, chunkSize)=>convertedChunk.slice(0, chunkSize);
1370
+ const getFinalStringChunk = ({ textDecoder })=>{
1371
+ const finalChunk = textDecoder.decode();
1372
+ return '' === finalChunk ? void 0 : finalChunk;
1373
+ };
1374
+ const stringMethods = {
1375
+ init: initString,
1376
+ convertChunk: {
1377
+ string: utils_identity,
1378
+ buffer: useTextDecoder,
1379
+ arrayBuffer: useTextDecoder,
1380
+ dataView: useTextDecoder,
1381
+ typedArray: useTextDecoder,
1382
+ others: throwObjectStream
1383
+ },
1384
+ getSize: getLengthProp,
1385
+ truncateChunk: truncateStringChunk,
1386
+ addChunk: addStringChunk,
1387
+ getFinalChunk: getFinalStringChunk,
1388
+ finalize: utils_getContentsProp
1389
+ };
1390
+ const merge_stream = __webpack_require__("../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js");
1391
+ const validateInputOptions = (input)=>{
1392
+ if (void 0 !== input) throw new TypeError('The `input` and `inputFile` options cannot be both set.');
1393
+ };
1394
+ const getInputSync = ({ input, inputFile })=>{
1395
+ if ('string' != typeof inputFile) return input;
1396
+ validateInputOptions(input);
1397
+ return readFileSync(inputFile);
1398
+ };
1399
+ const handleInputSync = (options)=>{
1400
+ const input = getInputSync(options);
1401
+ if (isStream(input)) throw new TypeError('The `input` option cannot be a stream in sync mode');
1402
+ return input;
1403
+ };
1404
+ const getInput = ({ input, inputFile })=>{
1405
+ if ('string' != typeof inputFile) return input;
1406
+ validateInputOptions(input);
1407
+ return createReadStream(inputFile);
1408
+ };
1409
+ const handleInput = (spawned, options)=>{
1410
+ const input = getInput(options);
1411
+ if (void 0 === input) return;
1412
+ if (isStream(input)) input.pipe(spawned.stdin);
1413
+ else spawned.stdin.end(input);
1414
+ };
1415
+ const makeAllStream = (spawned, { all })=>{
1416
+ if (!all || !spawned.stdout && !spawned.stderr) return;
1417
+ const mixed = merge_stream();
1418
+ if (spawned.stdout) mixed.add(spawned.stdout);
1419
+ if (spawned.stderr) mixed.add(spawned.stderr);
1420
+ return mixed;
1421
+ };
1422
+ const getBufferedData = async (stream, streamPromise)=>{
1423
+ if (!stream || void 0 === streamPromise) return;
1424
+ await promises_setTimeout(0);
1425
+ stream.destroy();
1426
+ try {
1427
+ return await streamPromise;
1428
+ } catch (error) {
1429
+ return error.bufferedData;
1430
+ }
1431
+ };
1432
+ const getStreamPromise = (stream, { encoding, buffer, maxBuffer })=>{
1433
+ if (!stream || !buffer) return;
1434
+ if ('utf8' === encoding || 'utf-8' === encoding) return getStreamAsString(stream, {
1435
+ maxBuffer
1436
+ });
1437
+ if (null === encoding || 'buffer' === encoding) return getStreamAsBuffer(stream, {
1438
+ maxBuffer
1439
+ });
1440
+ return applyEncoding(stream, maxBuffer, encoding);
1441
+ };
1442
+ const applyEncoding = async (stream, maxBuffer, encoding)=>{
1443
+ const buffer = await getStreamAsBuffer(stream, {
1444
+ maxBuffer
1445
+ });
1446
+ return buffer.toString(encoding);
1447
+ };
1448
+ const getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone)=>{
1449
+ const stdoutPromise = getStreamPromise(stdout, {
1450
+ encoding,
1451
+ buffer,
1452
+ maxBuffer
1453
+ });
1454
+ const stderrPromise = getStreamPromise(stderr, {
1455
+ encoding,
1456
+ buffer,
1457
+ maxBuffer
1458
+ });
1459
+ const allPromise = getStreamPromise(all, {
1460
+ encoding,
1461
+ buffer,
1462
+ maxBuffer: 2 * maxBuffer
1463
+ });
1464
+ try {
1465
+ return await Promise.all([
1466
+ processDone,
1467
+ stdoutPromise,
1468
+ stderrPromise,
1469
+ allPromise
1470
+ ]);
1471
+ } catch (error) {
1472
+ return Promise.all([
1473
+ {
1474
+ error,
1475
+ signal: error.signal,
1476
+ timedOut: error.timedOut
1477
+ },
1478
+ getBufferedData(stdout, stdoutPromise),
1479
+ getBufferedData(stderr, stderrPromise),
1480
+ getBufferedData(all, allPromise)
1481
+ ]);
1482
+ }
1483
+ };
1484
+ const nativePromisePrototype = (async ()=>{})().constructor.prototype;
1485
+ const descriptors = [
1486
+ 'then',
1487
+ 'catch',
1488
+ 'finally'
1489
+ ].map((property)=>[
1490
+ property,
1491
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1492
+ ]);
1493
+ const mergePromise = (spawned, promise)=>{
1494
+ for (const [property, descriptor] of descriptors){
1495
+ const value = 'function' == typeof promise ? (...args)=>Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1496
+ Reflect.defineProperty(spawned, property, {
1497
+ ...descriptor,
1498
+ value
1499
+ });
1500
+ }
1501
+ };
1502
+ const getSpawnedPromise = (spawned)=>new Promise((resolve, reject)=>{
1503
+ spawned.on('exit', (exitCode, signal)=>{
1504
+ resolve({
1505
+ exitCode,
1506
+ signal
1507
+ });
1508
+ });
1509
+ spawned.on('error', (error)=>{
1510
+ reject(error);
1511
+ });
1512
+ if (spawned.stdin) spawned.stdin.on('error', (error)=>{
1513
+ reject(error);
1514
+ });
1515
+ });
1516
+ const normalizeArgs = (file, args = [])=>{
1517
+ if (!Array.isArray(args)) return [
1518
+ file
1519
+ ];
1520
+ return [
1521
+ file,
1522
+ ...args
1523
+ ];
1524
+ };
1525
+ const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1526
+ const escapeArg = (arg)=>{
1527
+ if ('string' != typeof arg || NO_ESCAPE_REGEXP.test(arg)) return arg;
1528
+ return `"${arg.replaceAll('"', '\\"')}"`;
1529
+ };
1530
+ const joinCommand = (file, args)=>normalizeArgs(file, args).join(' ');
1531
+ const getEscapedCommand = (file, args)=>normalizeArgs(file, args).map((arg)=>escapeArg(arg)).join(' ');
1532
+ const SPACES_REGEXP = / +/g;
1533
+ const parseExpression = (expression)=>{
1534
+ const typeOfExpression = typeof expression;
1535
+ if ('string' === typeOfExpression) return expression;
1536
+ if ('number' === typeOfExpression) return String(expression);
1537
+ if ('object' === typeOfExpression && null !== expression && !(expression instanceof ChildProcess) && 'stdout' in expression) {
1538
+ const typeOfStdout = typeof expression.stdout;
1539
+ if ('string' === typeOfStdout) return expression.stdout;
1540
+ if (Buffer.isBuffer(expression.stdout)) return expression.stdout.toString();
1541
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1542
+ }
1543
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1544
+ };
1545
+ const concatTokens = (tokens, nextTokens, isNew)=>isNew || 0 === tokens.length || 0 === nextTokens.length ? [
1546
+ ...tokens,
1547
+ ...nextTokens
1548
+ ] : [
1549
+ ...tokens.slice(0, -1),
1550
+ `${tokens.at(-1)}${nextTokens[0]}`,
1551
+ ...nextTokens.slice(1)
1552
+ ];
1553
+ const parseTemplate = ({ templates, expressions, tokens, index, template })=>{
1554
+ const templateString = template ?? templates.raw[index];
1555
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1556
+ const newTokens = concatTokens(tokens, templateTokens, templateString.startsWith(' '));
1557
+ if (index === expressions.length) return newTokens;
1558
+ const expression = expressions[index];
1559
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression)=>parseExpression(expression)) : [
1560
+ parseExpression(expression)
1561
+ ];
1562
+ return concatTokens(newTokens, expressionTokens, templateString.endsWith(' '));
1563
+ };
1564
+ const parseTemplates = (templates, expressions)=>{
1565
+ let tokens = [];
1566
+ for (const [index, template] of templates.entries())tokens = parseTemplate({
1567
+ templates,
1568
+ expressions,
1569
+ tokens,
1570
+ index,
1571
+ template
1572
+ });
1573
+ return tokens;
1574
+ };
1575
+ const verboseDefault = debuglog('execa').enabled;
1576
+ const padField = (field, padding)=>String(field).padStart(padding, '0');
1577
+ const getTimestamp = ()=>{
1578
+ const date = new Date();
1579
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1580
+ };
1581
+ const logCommand = (escapedCommand, { verbose })=>{
1582
+ if (!verbose) return;
1583
+ node_process.stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
1584
+ };
1585
+ const cross_spawn = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
1586
+ const DEFAULT_MAX_BUFFER = 100000000;
1587
+ const getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath })=>{
1588
+ const env = extendEnv ? {
1589
+ ...node_process.env,
1590
+ ...envOption
1591
+ } : envOption;
1592
+ if (preferLocal) return npmRunPathEnv({
1593
+ env,
1594
+ cwd: localDir,
1595
+ execPath
1596
+ });
1597
+ return env;
1598
+ };
1599
+ const handleArguments = (file, args, options = {})=>{
1600
+ const parsed = cross_spawn._parse(file, args, options);
1601
+ file = parsed.command;
1602
+ args = parsed.args;
1603
+ options = parsed.options;
1604
+ options = {
1605
+ maxBuffer: DEFAULT_MAX_BUFFER,
1606
+ buffer: true,
1607
+ stripFinalNewline: true,
1608
+ extendEnv: true,
1609
+ preferLocal: false,
1610
+ localDir: options.cwd || node_process.cwd(),
1611
+ execPath: node_process.execPath,
1612
+ encoding: 'utf8',
1613
+ reject: true,
1614
+ cleanup: true,
1615
+ all: false,
1616
+ windowsHide: true,
1617
+ verbose: verboseDefault,
1618
+ ...options
1619
+ };
1620
+ options.env = getEnv(options);
1621
+ options.stdio = normalizeStdio(options);
1622
+ if ('win32' === node_process.platform && 'cmd' === node_path.basename(file, '.exe')) args.unshift('/q');
1623
+ return {
1624
+ file,
1625
+ args,
1626
+ options,
1627
+ parsed
1628
+ };
1629
+ };
1630
+ const handleOutput = (options, value, error)=>{
1631
+ if ('string' != typeof value && !Buffer.isBuffer(value)) return void 0 === error ? void 0 : '';
1632
+ if (options.stripFinalNewline) return stripFinalNewline(value);
1633
+ return value;
1634
+ };
1635
+ function execa(file, args, options) {
1636
+ const parsed = handleArguments(file, args, options);
1637
+ const command = joinCommand(file, args);
1638
+ const escapedCommand = getEscapedCommand(file, args);
1639
+ logCommand(escapedCommand, parsed.options);
1640
+ validateTimeout(parsed.options);
1641
+ let spawned;
1642
+ try {
1643
+ spawned = node_child_process.spawn(parsed.file, parsed.args, parsed.options);
1644
+ } catch (error) {
1645
+ const dummySpawned = new node_child_process.ChildProcess();
1646
+ const errorPromise = Promise.reject(makeError({
1647
+ error,
1648
+ stdout: '',
1649
+ stderr: '',
1650
+ all: '',
1651
+ command,
1652
+ escapedCommand,
1653
+ parsed,
1654
+ timedOut: false,
1655
+ isCanceled: false,
1656
+ killed: false
1657
+ }));
1658
+ mergePromise(dummySpawned, errorPromise);
1659
+ return dummySpawned;
1660
+ }
1661
+ const spawnedPromise = getSpawnedPromise(spawned);
1662
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1663
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1664
+ const context = {
1665
+ isCanceled: false
1666
+ };
1667
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1668
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
1669
+ const handlePromise = async ()=>{
1670
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1671
+ const stdout = handleOutput(parsed.options, stdoutResult);
1672
+ const stderr = handleOutput(parsed.options, stderrResult);
1673
+ const all = handleOutput(parsed.options, allResult);
1674
+ if (error || 0 !== exitCode || null !== signal) {
1675
+ const returnedError = makeError({
1676
+ error,
1677
+ exitCode,
1678
+ signal,
1679
+ stdout,
1680
+ stderr,
1681
+ all,
1682
+ command,
1683
+ escapedCommand,
1684
+ parsed,
1685
+ timedOut,
1686
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
1687
+ killed: spawned.killed
1688
+ });
1689
+ if (!parsed.options.reject) return returnedError;
1690
+ throw returnedError;
1691
+ }
1692
+ return {
1693
+ command,
1694
+ escapedCommand,
1695
+ exitCode: 0,
1696
+ stdout,
1697
+ stderr,
1698
+ all,
1699
+ failed: false,
1700
+ timedOut: false,
1701
+ isCanceled: false,
1702
+ killed: false
1703
+ };
1704
+ };
1705
+ const handlePromiseOnce = node_modules_onetime(handlePromise);
1706
+ handleInput(spawned, parsed.options);
1707
+ spawned.all = makeAllStream(spawned, parsed.options);
1708
+ addPipeMethods(spawned);
1709
+ mergePromise(spawned, handlePromiseOnce);
1710
+ return spawned;
1711
+ }
1712
+ function execaSync(file, args, options) {
1713
+ const parsed = handleArguments(file, args, options);
1714
+ const command = joinCommand(file, args);
1715
+ const escapedCommand = getEscapedCommand(file, args);
1716
+ logCommand(escapedCommand, parsed.options);
1717
+ const input = handleInputSync(parsed.options);
1718
+ let result;
1719
+ try {
1720
+ result = node_child_process.spawnSync(parsed.file, parsed.args, {
1721
+ ...parsed.options,
1722
+ input
1723
+ });
1724
+ } catch (error) {
1725
+ throw makeError({
1726
+ error,
1727
+ stdout: '',
1728
+ stderr: '',
1729
+ all: '',
1730
+ command,
1731
+ escapedCommand,
1732
+ parsed,
1733
+ timedOut: false,
1734
+ isCanceled: false,
1735
+ killed: false
1736
+ });
1737
+ }
1738
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
1739
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
1740
+ if (result.error || 0 !== result.status || null !== result.signal) {
1741
+ const error = makeError({
1742
+ stdout,
1743
+ stderr,
1744
+ error: result.error,
1745
+ signal: result.signal,
1746
+ exitCode: result.status,
1747
+ command,
1748
+ escapedCommand,
1749
+ parsed,
1750
+ timedOut: result.error && 'ETIMEDOUT' === result.error.code,
1751
+ isCanceled: false,
1752
+ killed: null !== result.signal
1753
+ });
1754
+ if (!parsed.options.reject) return error;
1755
+ throw error;
1756
+ }
1757
+ return {
1758
+ command,
1759
+ escapedCommand,
1760
+ exitCode: 0,
1761
+ stdout,
1762
+ stderr,
1763
+ failed: false,
1764
+ timedOut: false,
1765
+ isCanceled: false,
1766
+ killed: false
1767
+ };
1768
+ }
1769
+ const normalizeScriptStdin = ({ input, inputFile, stdio })=>void 0 === input && void 0 === inputFile && void 0 === stdio ? {
1770
+ stdin: 'inherit'
1771
+ } : {};
1772
+ const normalizeScriptOptions = (options = {})=>({
1773
+ preferLocal: true,
1774
+ ...normalizeScriptStdin(options),
1775
+ ...options
1776
+ });
1777
+ function create$(options) {
1778
+ function $(templatesOrOptions, ...expressions) {
1779
+ if (!Array.isArray(templatesOrOptions)) return create$({
1780
+ ...options,
1781
+ ...templatesOrOptions
1782
+ });
1783
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
1784
+ return execa(file, args, normalizeScriptOptions(options));
1785
+ }
1786
+ $.sync = (templates, ...expressions)=>{
1787
+ if (!Array.isArray(templates)) throw new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');
1788
+ const [file, ...args] = parseTemplates(templates, expressions);
1789
+ return execaSync(file, args, normalizeScriptOptions(options));
1790
+ };
1791
+ return $;
1792
+ }
1793
+ create$();
1794
+ export { execa };