mockaton 13.7.1 → 13.9.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 (284) hide show
  1. package/README.md +27 -8
  2. package/package.json +5 -3
  3. package/src/client/Filename.js +2 -2
  4. package/src/client/dir/groupByFolder.js +16 -14
  5. package/src/server/Mockaton.js +3 -3
  6. package/src/server/Mockaton.test.js +33 -0
  7. package/src/server/cli.js +9 -8
  8. package/src/server/importResolver.js +35 -0
  9. package/src/server/utils/logger.js +2 -4
  10. package/src/server/utils/openInBrowser.js +1 -1
  11. package/vite-plugin/README.md +29 -0
  12. package/vite-plugin/index.ts +21 -0
  13. package/vite-plugin/node_modules/.package-lock.json +356 -0
  14. package/vite-plugin/node_modules/@oxc-project/types/LICENSE +22 -0
  15. package/vite-plugin/node_modules/@oxc-project/types/README.md +3 -0
  16. package/vite-plugin/node_modules/@oxc-project/types/package.json +26 -0
  17. package/vite-plugin/node_modules/@oxc-project/types/types.d.ts +1912 -0
  18. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/README.md +3 -0
  19. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/package.json +37 -0
  20. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/rolldown-binding.darwin-arm64.node +0 -0
  21. package/vite-plugin/node_modules/@rolldown/pluginutils/LICENSE +25 -0
  22. package/vite-plugin/node_modules/@rolldown/pluginutils/README.md +83 -0
  23. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.d.ts +90 -0
  24. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +256 -0
  25. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.d.ts +28 -0
  26. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +75 -0
  27. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/index.d.ts +3 -0
  28. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/index.js +3 -0
  29. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.d.ts +71 -0
  30. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +70 -0
  31. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/index.d.ts +1 -0
  32. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/index.js +1 -0
  33. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/utils.d.ts +2 -0
  34. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/utils.js +17 -0
  35. package/vite-plugin/node_modules/@rolldown/pluginutils/package.json +37 -0
  36. package/vite-plugin/node_modules/detect-libc/LICENSE +201 -0
  37. package/vite-plugin/node_modules/detect-libc/README.md +163 -0
  38. package/vite-plugin/node_modules/detect-libc/index.d.ts +14 -0
  39. package/vite-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
  40. package/vite-plugin/node_modules/detect-libc/lib/elf.js +39 -0
  41. package/vite-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
  42. package/vite-plugin/node_modules/detect-libc/lib/process.js +24 -0
  43. package/vite-plugin/node_modules/detect-libc/package.json +44 -0
  44. package/vite-plugin/node_modules/fdir/LICENSE +7 -0
  45. package/vite-plugin/node_modules/fdir/README.md +91 -0
  46. package/vite-plugin/node_modules/fdir/dist/index.cjs +588 -0
  47. package/vite-plugin/node_modules/fdir/dist/index.d.cts +155 -0
  48. package/vite-plugin/node_modules/fdir/dist/index.d.mts +155 -0
  49. package/vite-plugin/node_modules/fdir/dist/index.mjs +570 -0
  50. package/vite-plugin/node_modules/fdir/package.json +103 -0
  51. package/vite-plugin/node_modules/fsevents/LICENSE +22 -0
  52. package/vite-plugin/node_modules/fsevents/README.md +89 -0
  53. package/vite-plugin/node_modules/fsevents/fsevents.d.ts +46 -0
  54. package/vite-plugin/node_modules/fsevents/fsevents.js +83 -0
  55. package/vite-plugin/node_modules/fsevents/fsevents.node +0 -0
  56. package/vite-plugin/node_modules/fsevents/package.json +62 -0
  57. package/vite-plugin/node_modules/lightningcss/LICENSE +373 -0
  58. package/vite-plugin/node_modules/lightningcss/README.md +105 -0
  59. package/vite-plugin/node_modules/lightningcss/node/ast.d.ts +9892 -0
  60. package/vite-plugin/node_modules/lightningcss/node/ast.js.flow +10539 -0
  61. package/vite-plugin/node_modules/lightningcss/node/browserslistToTargets.js +48 -0
  62. package/vite-plugin/node_modules/lightningcss/node/composeVisitors.js +450 -0
  63. package/vite-plugin/node_modules/lightningcss/node/flags.js +28 -0
  64. package/vite-plugin/node_modules/lightningcss/node/index.d.ts +494 -0
  65. package/vite-plugin/node_modules/lightningcss/node/index.js +59 -0
  66. package/vite-plugin/node_modules/lightningcss/node/index.js.flow +843 -0
  67. package/vite-plugin/node_modules/lightningcss/node/index.mjs +4 -0
  68. package/vite-plugin/node_modules/lightningcss/node/targets.d.ts +40 -0
  69. package/vite-plugin/node_modules/lightningcss/node/targets.js.flow +39 -0
  70. package/vite-plugin/node_modules/lightningcss/package.json +110 -0
  71. package/vite-plugin/node_modules/lightningcss-darwin-arm64/LICENSE +373 -0
  72. package/vite-plugin/node_modules/lightningcss-darwin-arm64/README.md +1 -0
  73. package/vite-plugin/node_modules/lightningcss-darwin-arm64/lightningcss.darwin-arm64.node +0 -0
  74. package/vite-plugin/node_modules/lightningcss-darwin-arm64/package.json +34 -0
  75. package/vite-plugin/node_modules/nanoid/LICENSE +20 -0
  76. package/vite-plugin/node_modules/nanoid/README.md +39 -0
  77. package/vite-plugin/node_modules/nanoid/async/index.browser.cjs +69 -0
  78. package/vite-plugin/node_modules/nanoid/async/index.browser.js +34 -0
  79. package/vite-plugin/node_modules/nanoid/async/index.cjs +71 -0
  80. package/vite-plugin/node_modules/nanoid/async/index.d.ts +56 -0
  81. package/vite-plugin/node_modules/nanoid/async/index.js +35 -0
  82. package/vite-plugin/node_modules/nanoid/async/index.native.js +26 -0
  83. package/vite-plugin/node_modules/nanoid/async/package.json +12 -0
  84. package/vite-plugin/node_modules/nanoid/bin/nanoid.cjs +55 -0
  85. package/vite-plugin/node_modules/nanoid/index.browser.cjs +72 -0
  86. package/vite-plugin/node_modules/nanoid/index.browser.js +34 -0
  87. package/vite-plugin/node_modules/nanoid/index.cjs +85 -0
  88. package/vite-plugin/node_modules/nanoid/index.d.cts +91 -0
  89. package/vite-plugin/node_modules/nanoid/index.d.ts +91 -0
  90. package/vite-plugin/node_modules/nanoid/index.js +45 -0
  91. package/vite-plugin/node_modules/nanoid/nanoid.js +1 -0
  92. package/vite-plugin/node_modules/nanoid/non-secure/index.cjs +34 -0
  93. package/vite-plugin/node_modules/nanoid/non-secure/index.d.ts +33 -0
  94. package/vite-plugin/node_modules/nanoid/non-secure/index.js +21 -0
  95. package/vite-plugin/node_modules/nanoid/non-secure/package.json +6 -0
  96. package/vite-plugin/node_modules/nanoid/package.json +89 -0
  97. package/vite-plugin/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  98. package/vite-plugin/node_modules/nanoid/url-alphabet/index.js +3 -0
  99. package/vite-plugin/node_modules/nanoid/url-alphabet/package.json +6 -0
  100. package/vite-plugin/node_modules/picocolors/LICENSE +15 -0
  101. package/vite-plugin/node_modules/picocolors/README.md +21 -0
  102. package/vite-plugin/node_modules/picocolors/package.json +25 -0
  103. package/vite-plugin/node_modules/picocolors/picocolors.browser.js +4 -0
  104. package/vite-plugin/node_modules/picocolors/picocolors.d.ts +5 -0
  105. package/vite-plugin/node_modules/picocolors/picocolors.js +75 -0
  106. package/vite-plugin/node_modules/picocolors/types.d.ts +51 -0
  107. package/vite-plugin/node_modules/picomatch/LICENSE +21 -0
  108. package/vite-plugin/node_modules/picomatch/README.md +749 -0
  109. package/vite-plugin/node_modules/picomatch/index.js +17 -0
  110. package/vite-plugin/node_modules/picomatch/lib/constants.js +184 -0
  111. package/vite-plugin/node_modules/picomatch/lib/parse.js +1386 -0
  112. package/vite-plugin/node_modules/picomatch/lib/picomatch.js +349 -0
  113. package/vite-plugin/node_modules/picomatch/lib/scan.js +391 -0
  114. package/vite-plugin/node_modules/picomatch/lib/utils.js +72 -0
  115. package/vite-plugin/node_modules/picomatch/package.json +82 -0
  116. package/vite-plugin/node_modules/picomatch/posix.js +3 -0
  117. package/vite-plugin/node_modules/postcss/LICENSE +20 -0
  118. package/vite-plugin/node_modules/postcss/README.md +28 -0
  119. package/vite-plugin/node_modules/postcss/lib/at-rule.d.ts +139 -0
  120. package/vite-plugin/node_modules/postcss/lib/at-rule.js +25 -0
  121. package/vite-plugin/node_modules/postcss/lib/comment.d.ts +67 -0
  122. package/vite-plugin/node_modules/postcss/lib/comment.js +13 -0
  123. package/vite-plugin/node_modules/postcss/lib/container.d.ts +478 -0
  124. package/vite-plugin/node_modules/postcss/lib/container.js +447 -0
  125. package/vite-plugin/node_modules/postcss/lib/css-syntax-error.d.ts +247 -0
  126. package/vite-plugin/node_modules/postcss/lib/css-syntax-error.js +133 -0
  127. package/vite-plugin/node_modules/postcss/lib/declaration.d.ts +150 -0
  128. package/vite-plugin/node_modules/postcss/lib/declaration.js +24 -0
  129. package/vite-plugin/node_modules/postcss/lib/document.d.ts +68 -0
  130. package/vite-plugin/node_modules/postcss/lib/document.js +33 -0
  131. package/vite-plugin/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  132. package/vite-plugin/node_modules/postcss/lib/fromJSON.js +54 -0
  133. package/vite-plugin/node_modules/postcss/lib/input.d.ts +226 -0
  134. package/vite-plugin/node_modules/postcss/lib/input.js +273 -0
  135. package/vite-plugin/node_modules/postcss/lib/lazy-result.d.ts +189 -0
  136. package/vite-plugin/node_modules/postcss/lib/lazy-result.js +550 -0
  137. package/vite-plugin/node_modules/postcss/lib/list.d.ts +60 -0
  138. package/vite-plugin/node_modules/postcss/lib/list.js +58 -0
  139. package/vite-plugin/node_modules/postcss/lib/map-generator.js +376 -0
  140. package/vite-plugin/node_modules/postcss/lib/no-work-result.d.ts +45 -0
  141. package/vite-plugin/node_modules/postcss/lib/no-work-result.js +137 -0
  142. package/vite-plugin/node_modules/postcss/lib/node.d.ts +555 -0
  143. package/vite-plugin/node_modules/postcss/lib/node.js +449 -0
  144. package/vite-plugin/node_modules/postcss/lib/parse.d.ts +9 -0
  145. package/vite-plugin/node_modules/postcss/lib/parse.js +42 -0
  146. package/vite-plugin/node_modules/postcss/lib/parser.js +611 -0
  147. package/vite-plugin/node_modules/postcss/lib/postcss.d.mts +66 -0
  148. package/vite-plugin/node_modules/postcss/lib/postcss.d.ts +456 -0
  149. package/vite-plugin/node_modules/postcss/lib/postcss.js +101 -0
  150. package/vite-plugin/node_modules/postcss/lib/postcss.mjs +30 -0
  151. package/vite-plugin/node_modules/postcss/lib/previous-map.d.ts +80 -0
  152. package/vite-plugin/node_modules/postcss/lib/previous-map.js +145 -0
  153. package/vite-plugin/node_modules/postcss/lib/processor.d.ts +114 -0
  154. package/vite-plugin/node_modules/postcss/lib/processor.js +67 -0
  155. package/vite-plugin/node_modules/postcss/lib/result.d.ts +204 -0
  156. package/vite-plugin/node_modules/postcss/lib/result.js +42 -0
  157. package/vite-plugin/node_modules/postcss/lib/root.d.ts +86 -0
  158. package/vite-plugin/node_modules/postcss/lib/root.js +61 -0
  159. package/vite-plugin/node_modules/postcss/lib/rule.d.ts +126 -0
  160. package/vite-plugin/node_modules/postcss/lib/rule.js +27 -0
  161. package/vite-plugin/node_modules/postcss/lib/stringifier.d.ts +45 -0
  162. package/vite-plugin/node_modules/postcss/lib/stringifier.js +370 -0
  163. package/vite-plugin/node_modules/postcss/lib/stringify.d.ts +9 -0
  164. package/vite-plugin/node_modules/postcss/lib/stringify.js +11 -0
  165. package/vite-plugin/node_modules/postcss/lib/symbols.js +5 -0
  166. package/vite-plugin/node_modules/postcss/lib/terminal-highlight.js +70 -0
  167. package/vite-plugin/node_modules/postcss/lib/tokenize.js +266 -0
  168. package/vite-plugin/node_modules/postcss/lib/warn-once.js +13 -0
  169. package/vite-plugin/node_modules/postcss/lib/warning.d.ts +146 -0
  170. package/vite-plugin/node_modules/postcss/lib/warning.js +37 -0
  171. package/vite-plugin/node_modules/postcss/package.json +88 -0
  172. package/vite-plugin/node_modules/rolldown/LICENSE +25 -0
  173. package/vite-plugin/node_modules/rolldown/README.md +11 -0
  174. package/vite-plugin/node_modules/rolldown/bin/cli.mjs +2 -0
  175. package/vite-plugin/node_modules/rolldown/dist/cli.d.mts +1 -0
  176. package/vite-plugin/node_modules/rolldown/dist/cli.mjs +1191 -0
  177. package/vite-plugin/node_modules/rolldown/dist/config.d.mts +14 -0
  178. package/vite-plugin/node_modules/rolldown/dist/config.mjs +4 -0
  179. package/vite-plugin/node_modules/rolldown/dist/experimental-index.d.mts +253 -0
  180. package/vite-plugin/node_modules/rolldown/dist/experimental-index.mjs +320 -0
  181. package/vite-plugin/node_modules/rolldown/dist/experimental-runtime-types.d.ts +98 -0
  182. package/vite-plugin/node_modules/rolldown/dist/filter-index.d.mts +196 -0
  183. package/vite-plugin/node_modules/rolldown/dist/filter-index.mjs +386 -0
  184. package/vite-plugin/node_modules/rolldown/dist/get-log-filter.d.mts +3 -0
  185. package/vite-plugin/node_modules/rolldown/dist/get-log-filter.mjs +68 -0
  186. package/vite-plugin/node_modules/rolldown/dist/index.d.mts +4 -0
  187. package/vite-plugin/node_modules/rolldown/dist/index.mjs +50 -0
  188. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin-worker.d.mts +1 -0
  189. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin-worker.mjs +28 -0
  190. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin.d.mts +13 -0
  191. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin.mjs +6 -0
  192. package/vite-plugin/node_modules/rolldown/dist/parse-ast-index.d.mts +32 -0
  193. package/vite-plugin/node_modules/rolldown/dist/parse-ast-index.mjs +60 -0
  194. package/vite-plugin/node_modules/rolldown/dist/plugins-index.d.mts +33 -0
  195. package/vite-plugin/node_modules/rolldown/dist/plugins-index.mjs +40 -0
  196. package/vite-plugin/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +582 -0
  197. package/vite-plugin/node_modules/rolldown/dist/shared/binding-zH1vcmbM.d.mts +1899 -0
  198. package/vite-plugin/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +2211 -0
  199. package/vite-plugin/node_modules/rolldown/dist/shared/constructors-C2EWPKW3.mjs +68 -0
  200. package/vite-plugin/node_modules/rolldown/dist/shared/constructors-D0W3rNfA.d.mts +37 -0
  201. package/vite-plugin/node_modules/rolldown/dist/shared/define-config-5HJ1b9vG.d.mts +3829 -0
  202. package/vite-plugin/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  203. package/vite-plugin/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +85 -0
  204. package/vite-plugin/node_modules/rolldown/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  205. package/vite-plugin/node_modules/rolldown/dist/shared/load-config-BoVO31Un.mjs +120 -0
  206. package/vite-plugin/node_modules/rolldown/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  207. package/vite-plugin/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +180 -0
  208. package/vite-plugin/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +21 -0
  209. package/vite-plugin/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +66 -0
  210. package/vite-plugin/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +74 -0
  211. package/vite-plugin/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +847 -0
  212. package/vite-plugin/node_modules/rolldown/dist/shared/resolve-tsconfig-CfYpGzid.mjs +113 -0
  213. package/vite-plugin/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +40 -0
  214. package/vite-plugin/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +3325 -0
  215. package/vite-plugin/node_modules/rolldown/dist/shared/transform-DgZ3paSD.d.mts +149 -0
  216. package/vite-plugin/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +374 -0
  217. package/vite-plugin/node_modules/rolldown/dist/utils-index.d.mts +376 -0
  218. package/vite-plugin/node_modules/rolldown/dist/utils-index.mjs +2414 -0
  219. package/vite-plugin/node_modules/rolldown/package.json +153 -0
  220. package/vite-plugin/node_modules/source-map-js/LICENSE +28 -0
  221. package/vite-plugin/node_modules/source-map-js/README.md +765 -0
  222. package/vite-plugin/node_modules/source-map-js/lib/array-set.js +121 -0
  223. package/vite-plugin/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  224. package/vite-plugin/node_modules/source-map-js/lib/base64.js +67 -0
  225. package/vite-plugin/node_modules/source-map-js/lib/binary-search.js +111 -0
  226. package/vite-plugin/node_modules/source-map-js/lib/mapping-list.js +79 -0
  227. package/vite-plugin/node_modules/source-map-js/lib/quick-sort.js +132 -0
  228. package/vite-plugin/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  229. package/vite-plugin/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  230. package/vite-plugin/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  231. package/vite-plugin/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  232. package/vite-plugin/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  233. package/vite-plugin/node_modules/source-map-js/lib/source-node.js +413 -0
  234. package/vite-plugin/node_modules/source-map-js/lib/util.js +594 -0
  235. package/vite-plugin/node_modules/source-map-js/package.json +71 -0
  236. package/vite-plugin/node_modules/source-map-js/source-map.d.ts +104 -0
  237. package/vite-plugin/node_modules/source-map-js/source-map.js +8 -0
  238. package/vite-plugin/node_modules/tinyglobby/LICENSE +21 -0
  239. package/vite-plugin/node_modules/tinyglobby/README.md +25 -0
  240. package/vite-plugin/node_modules/tinyglobby/dist/index.cjs +334 -0
  241. package/vite-plugin/node_modules/tinyglobby/dist/index.d.cts +148 -0
  242. package/vite-plugin/node_modules/tinyglobby/dist/index.d.mts +148 -0
  243. package/vite-plugin/node_modules/tinyglobby/dist/index.mjs +306 -0
  244. package/vite-plugin/node_modules/tinyglobby/package.json +73 -0
  245. package/vite-plugin/node_modules/vite/LICENSE.md +2230 -0
  246. package/vite-plugin/node_modules/vite/README.md +20 -0
  247. package/vite-plugin/node_modules/vite/bin/openChrome.js +68 -0
  248. package/vite-plugin/node_modules/vite/bin/vite.js +79 -0
  249. package/vite-plugin/node_modules/vite/client.d.ts +282 -0
  250. package/vite-plugin/node_modules/vite/dist/client/client.mjs +1237 -0
  251. package/vite-plugin/node_modules/vite/dist/client/env.mjs +18 -0
  252. package/vite-plugin/node_modules/vite/dist/node/chunks/build.js +5381 -0
  253. package/vite-plugin/node_modules/vite/dist/node/chunks/chunk.js +37 -0
  254. package/vite-plugin/node_modules/vite/dist/node/chunks/dist.js +6784 -0
  255. package/vite-plugin/node_modules/vite/dist/node/chunks/lib.js +371 -0
  256. package/vite-plugin/node_modules/vite/dist/node/chunks/logger.js +322 -0
  257. package/vite-plugin/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
  258. package/vite-plugin/node_modules/vite/dist/node/chunks/node.js +34874 -0
  259. package/vite-plugin/node_modules/vite/dist/node/chunks/postcss-import.js +467 -0
  260. package/vite-plugin/node_modules/vite/dist/node/cli.js +837 -0
  261. package/vite-plugin/node_modules/vite/dist/node/index.d.ts +3867 -0
  262. package/vite-plugin/node_modules/vite/dist/node/index.js +3 -0
  263. package/vite-plugin/node_modules/vite/dist/node/internal.d.ts +2 -0
  264. package/vite-plugin/node_modules/vite/dist/node/internal.js +2 -0
  265. package/vite-plugin/node_modules/vite/dist/node/module-runner.d.ts +315 -0
  266. package/vite-plugin/node_modules/vite/dist/node/module-runner.js +1262 -0
  267. package/vite-plugin/node_modules/vite/misc/false.js +1 -0
  268. package/vite-plugin/node_modules/vite/misc/true.js +1 -0
  269. package/vite-plugin/node_modules/vite/package.json +192 -0
  270. package/vite-plugin/node_modules/vite/types/customEvent.d.ts +79 -0
  271. package/vite-plugin/node_modules/vite/types/hmrPayload.d.ts +80 -0
  272. package/vite-plugin/node_modules/vite/types/hot.d.ts +39 -0
  273. package/vite-plugin/node_modules/vite/types/import-meta.d.ts +5 -0
  274. package/vite-plugin/node_modules/vite/types/importGlob.d.ts +89 -0
  275. package/vite-plugin/node_modules/vite/types/importMeta.d.ts +30 -0
  276. package/vite-plugin/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts +44 -0
  277. package/vite-plugin/node_modules/vite/types/internal/esbuildOptions.d.ts +28 -0
  278. package/vite-plugin/node_modules/vite/types/internal/lightningcssOptions.d.ts +18 -0
  279. package/vite-plugin/node_modules/vite/types/internal/rollupTypeCompat.d.ts +24 -0
  280. package/vite-plugin/node_modules/vite/types/internal/terserOptions.d.ts +11 -0
  281. package/vite-plugin/node_modules/vite/types/metadata.d.ts +47 -0
  282. package/vite-plugin/package.json +14 -0
  283. package/www/src/{assets → .well-known/agent-skills/mockaton}/SKILLS.md +21 -9
  284. package/src/server/cacheBustResolver.js +0 -19
@@ -0,0 +1,3867 @@
1
+ /// <reference types="node" />
2
+ import { t as ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
3
+ import { ConnectedPayload, CustomPayload, CustomPayload as hmrPayload_CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, HotPayload as hmrPayload_HotPayload, PrunePayload, Update, UpdatePayload } from "#types/hmrPayload";
4
+ import { CustomEventMap, InferCustomEventPayload, InferCustomEventPayload as hmrPayload_InferCustomEventPayload, InvalidatePayload } from "#types/customEvent";
5
+ import * as Rolldown from "rolldown";
6
+ import { CustomPluginOptions, ExistingRawSourceMap, FunctionPluginHooks, ImportKind, InputOption, InputOptions, LoadResult, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleType, ModuleTypeFilter, ObjectHook, OutputBundle, OutputChunk, OutputOptions, PartialResolvedId, PluginContext, PluginContextMeta, ResolveIdResult, RolldownOptions, RolldownOutput, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, TransformPluginContext, VERSION as rolldownVersion, WatcherOptions } from "rolldown";
7
+ import { parseAst as parseAst$1, parseAstAsync as parseAstAsync$1 } from "rolldown/parseAst";
8
+ import * as Rollup from "#types/internal/rollupTypeCompat";
9
+ import { esmExternalRequirePlugin } from "rolldown/plugins";
10
+ import { ESTree, MinifyOptions, MinifyResult, ParseResult, ParserOptions, TransformOptions as rolldown_utils_TransformOptions, TransformResult as rolldown_utils_TransformResult, Visitor, VisitorObject, minify, minifySync, parse, parseSync } from "rolldown/utils";
11
+ import * as http from "node:http";
12
+ import { Agent, ClientRequest, ClientRequestArgs, OutgoingHttpHeaders, ServerResponse } from "node:http";
13
+ import { Http2SecureServer } from "node:http2";
14
+ import * as fs from "node:fs";
15
+ import { EventEmitter } from "node:events";
16
+ import { Server as HttpsServer, ServerOptions as HttpsServerOptions } from "node:https";
17
+ import * as net from "node:net";
18
+ import { Duplex, DuplexOptions, Stream } from "node:stream";
19
+ import { FetchFunction, FetchFunctionOptions, FetchResult, FetchResult as moduleRunner_FetchResult, ModuleEvaluator, ModuleRunner, ModuleRunnerHmr, ModuleRunnerOptions } from "vite/module-runner";
20
+ import { DepsOptimizerEsbuildOptions, EsbuildTarget, EsbuildTransformOptions, EsbuildTransformOptions as esbuildOptions_EsbuildTransformOptions, EsbuildTransformResult } from "#types/internal/esbuildOptions";
21
+ import { SecureContextOptions } from "node:tls";
22
+ import { URL as url_URL } from "node:url";
23
+ import { ZlibOptions } from "node:zlib";
24
+ import { ChunkMetadata, CustomPluginOptionsVite } from "#types/metadata";
25
+ import { Terser, TerserMinifyOptions } from "#types/internal/terserOptions";
26
+ import * as PostCSS from "postcss";
27
+ import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions";
28
+ import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions";
29
+ import { withFilter } from "rolldown/filter";
30
+ import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from "#types/importGlob";
31
+
32
+ //#region \0rolldown/runtime.js
33
+ //#endregion
34
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.14_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
+ //#region src/node/cli-commands.d.ts
36
+ interface StartOptions {
37
+ root?: string;
38
+ config?: string;
39
+ host: string;
40
+ port?: string | number;
41
+ open?: boolean;
42
+ }
43
+ //#endregion
44
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.14_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
+ //#region src/node/config.d.ts
46
+ interface DevToolsConfig extends Partial<StartOptions> {
47
+ enabled: boolean;
48
+ /**
49
+ * Disable client authentication.
50
+ *
51
+ * Beware that if you disable client authentication,
52
+ * any browsers can connect to the devtools and access to your server and filesystem.
53
+ * (including other devices, if you open server `host` option to LAN or WAN)
54
+ *
55
+ * @default true
56
+ */
57
+ clientAuth?: boolean;
58
+ /**
59
+ * Pre-configured auth tokens that are automatically trusted.
60
+ *
61
+ * Clients connecting with an auth token matching one of these
62
+ * will be auto-approved without a terminal prompt.
63
+ */
64
+ clientAuthTokens?: string[];
65
+ }
66
+ interface ResolvedDevToolsConfig {
67
+ config: Omit<DevToolsConfig, 'enabled'> & {
68
+ host: string;
69
+ };
70
+ enabled: boolean;
71
+ }
72
+ //#endregion
73
+ //#region src/types/alias.d.ts
74
+ interface Alias {
75
+ find: string | RegExp;
76
+ replacement: string;
77
+ /**
78
+ * Instructs the plugin to use an alternative resolving algorithm,
79
+ * rather than the Rollup's resolver.
80
+ * @default null
81
+ * @deprecated Use a custom plugin with resolveId hook and `enforce: 'pre'` instead
82
+ */
83
+ customResolver?: ResolverFunction | ResolverObject | null;
84
+ }
85
+ type MapToFunction<T> = T extends Function ? T : never;
86
+ type ResolverFunction = MapToFunction<FunctionPluginHooks['resolveId']>;
87
+ interface ResolverObject {
88
+ buildStart?: FunctionPluginHooks['buildStart'];
89
+ resolveId: ResolverFunction;
90
+ }
91
+ /**
92
+ * Specifies an `Object`, or an `Array` of `Object`,
93
+ * which defines aliases used to replace values in `import` or `require` statements.
94
+ * With either format, the order of the entries is important,
95
+ * in that the first defined rules are applied first.
96
+ *
97
+ * This is passed to \@rollup/plugin-alias as the "entries" field
98
+ * https://github.com/rollup/plugins/tree/master/packages/alias#entries
99
+ */
100
+ type AliasOptions = readonly Alias[] | {
101
+ [find: string]: string;
102
+ };
103
+ //#endregion
104
+ //#region src/types/anymatch.d.ts
105
+ type AnymatchFn = (testString: string) => boolean;
106
+ type AnymatchPattern = string | RegExp | AnymatchFn;
107
+ type AnymatchMatcher = AnymatchPattern | AnymatchPattern[];
108
+ //#endregion
109
+ //#region src/types/chokidar.d.ts
110
+ declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
111
+ options: WatchOptions;
112
+ /**
113
+ * Constructs a new FSWatcher instance with optional WatchOptions parameter.
114
+ */
115
+ constructor(options?: WatchOptions);
116
+ /**
117
+ * When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
118
+ * Calling watcher.ref() multiple times will have no effect.
119
+ */
120
+ ref(): this;
121
+ /**
122
+ * When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
123
+ * If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
124
+ * Calling watcher.unref() multiple times will have no effect.
125
+ */
126
+ unref(): this;
127
+ /**
128
+ * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
129
+ * string.
130
+ */
131
+ add(paths: string | ReadonlyArray<string>): this;
132
+ /**
133
+ * Stop watching files, directories, or glob patterns. Takes an array of strings or just one
134
+ * string.
135
+ */
136
+ unwatch(paths: string | ReadonlyArray<string>): this;
137
+ /**
138
+ * Returns an object representing all the paths on the file system being watched by this
139
+ * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
140
+ * the `cwd` option was used), and the values are arrays of the names of the items contained in
141
+ * each directory.
142
+ */
143
+ getWatched(): {
144
+ [directory: string]: string[];
145
+ };
146
+ /**
147
+ * Removes all listeners from watched files.
148
+ */
149
+ close(): Promise<void>;
150
+ on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
151
+ on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
152
+ /**
153
+ * Error occurred
154
+ */
155
+ on(event: 'error', listener: (error: Error) => void): this;
156
+ /**
157
+ * Exposes the native Node `fs.FSWatcher events`
158
+ */
159
+ on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
160
+ /**
161
+ * Fires when the initial scan is complete
162
+ */
163
+ on(event: 'ready', listener: () => void): this;
164
+ on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
165
+ on(event: string, listener: (...args: any[]) => void): this;
166
+ }
167
+ interface WatchOptions {
168
+ /**
169
+ * Indicates whether the process should continue to run as long as files are being watched. If
170
+ * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
171
+ * even if the process continues to run.
172
+ */
173
+ persistent?: boolean;
174
+ /**
175
+ * ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
176
+ * be ignored. The whole relative or absolute path is tested, not just filename. If a function
177
+ * with two arguments is provided, it gets called twice per path - once with a single argument
178
+ * (the path), second time with two arguments (the path and the
179
+ * [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
180
+ */
181
+ ignored?: AnymatchMatcher;
182
+ /**
183
+ * If set to `false` then `add`/`addDir` events are also emitted for matching paths while
184
+ * instantiating the watching as chokidar discovers these file paths (before the `ready` event).
185
+ */
186
+ ignoreInitial?: boolean;
187
+ /**
188
+ * When `false`, only the symlinks themselves will be watched for changes instead of following
189
+ * the link references and bubbling events through the link's path.
190
+ */
191
+ followSymlinks?: boolean;
192
+ /**
193
+ * The base directory from which watch `paths` are to be derived. Paths emitted with events will
194
+ * be relative to this.
195
+ */
196
+ cwd?: string;
197
+ /**
198
+ * If set to true then the strings passed to .watch() and .add() are treated as literal path
199
+ * names, even if they look like globs.
200
+ *
201
+ * @default false
202
+ */
203
+ disableGlobbing?: boolean;
204
+ /**
205
+ * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
206
+ * utilization, consider setting this to `false`. It is typically necessary to **set this to
207
+ * `true` to successfully watch files over a network**, and it may be necessary to successfully
208
+ * watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
209
+ * the `useFsEvents` default.
210
+ */
211
+ usePolling?: boolean;
212
+ /**
213
+ * Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
214
+ * and `fsevents` is available this supersedes the `usePolling` setting. When set to `false` on
215
+ * OS X, `usePolling: true` becomes the default.
216
+ */
217
+ useFsEvents?: boolean;
218
+ /**
219
+ * If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
220
+ * may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
221
+ * provided even in cases where it wasn't already available from the underlying watch events.
222
+ */
223
+ alwaysStat?: boolean;
224
+ /**
225
+ * If set, limits how many levels of subdirectories will be traversed.
226
+ */
227
+ depth?: number;
228
+ /**
229
+ * Interval of file system polling.
230
+ */
231
+ interval?: number;
232
+ /**
233
+ * Interval of file system polling for binary files. ([see list of binary extensions](https://gi
234
+ * thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
235
+ */
236
+ binaryInterval?: number;
237
+ /**
238
+ * Indicates whether to watch files that don't have read permissions if possible. If watching
239
+ * fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
240
+ * silently.
241
+ */
242
+ ignorePermissionErrors?: boolean;
243
+ /**
244
+ * `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
245
+ * that occur when using editors that use "atomic writes" instead of writing directly to the
246
+ * source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
247
+ * event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
248
+ * you can override it by setting `atomic` to a custom value, in milliseconds.
249
+ */
250
+ atomic?: boolean | number;
251
+ /**
252
+ * can be set to an object in order to adjust timing params:
253
+ */
254
+ awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
255
+ }
256
+ interface AwaitWriteFinishOptions {
257
+ /**
258
+ * Amount of time in milliseconds for a file size to remain constant before emitting its event.
259
+ */
260
+ stabilityThreshold?: number;
261
+ /**
262
+ * File size polling interval.
263
+ */
264
+ pollInterval?: number;
265
+ }
266
+ //#endregion
267
+ //#region src/types/connect.d.ts
268
+ declare namespace Connect {
269
+ export type ServerHandle = HandleFunction | http.Server;
270
+ export class IncomingMessage extends http.IncomingMessage {
271
+ originalUrl?: http.IncomingMessage['url'] | undefined;
272
+ }
273
+ export type NextFunction = (err?: any) => void;
274
+ export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void;
275
+ export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
276
+ export type ErrorHandleFunction = (err: any, req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
277
+ export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
278
+ export interface ServerStackItem {
279
+ route: string;
280
+ handle: ServerHandle;
281
+ }
282
+ export interface Server extends NodeJS.EventEmitter {
283
+ (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
284
+ route: string;
285
+ stack: ServerStackItem[];
286
+ /**
287
+ * Utilize the given middleware `handle` to the given `route`,
288
+ * defaulting to _/_. This "route" is the mount-point for the
289
+ * middleware, when given a value other than _/_ the middleware
290
+ * is only effective when that segment is present in the request's
291
+ * pathname.
292
+ *
293
+ * For example if we were to mount a function at _/admin_, it would
294
+ * be invoked on _/admin_, and _/admin/settings_, however it would
295
+ * not be invoked for _/_, or _/posts_.
296
+ */
297
+ use(fn: NextHandleFunction): Server;
298
+ use(fn: HandleFunction): Server;
299
+ use(route: string, fn: NextHandleFunction): Server;
300
+ use(route: string, fn: HandleFunction): Server;
301
+ /**
302
+ * Handle server requests, punting them down
303
+ * the middleware stack.
304
+ */
305
+ handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
306
+ /**
307
+ * Listen for connections.
308
+ *
309
+ * This method takes the same arguments
310
+ * as node's `http.Server#listen()`.
311
+ *
312
+ * HTTP and HTTPS:
313
+ *
314
+ * If you run your application both as HTTP
315
+ * and HTTPS you may wrap them individually,
316
+ * since your Connect "server" is really just
317
+ * a JavaScript `Function`.
318
+ *
319
+ * var connect = require('connect')
320
+ * , http = require('http')
321
+ * , https = require('https');
322
+ *
323
+ * var app = connect();
324
+ *
325
+ * http.createServer(app).listen(80);
326
+ * https.createServer(options, app).listen(443);
327
+ */
328
+ listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
329
+ listen(port: number, hostname?: string, callback?: Function): http.Server;
330
+ listen(path: string, callback?: Function): http.Server;
331
+ listen(handle: any, listeningListener?: Function): http.Server;
332
+ }
333
+ }
334
+ //#endregion
335
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.23.2_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
336
+ interface ProxyTargetDetailed {
337
+ host: string;
338
+ port: number;
339
+ protocol?: string;
340
+ hostname?: string;
341
+ socketPath?: string;
342
+ key?: string;
343
+ passphrase?: string;
344
+ pfx?: Buffer | string;
345
+ cert?: string;
346
+ ca?: string;
347
+ ciphers?: string;
348
+ secureProtocol?: string;
349
+ }
350
+ type ProxyType = "ws" | "web";
351
+ type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed;
352
+ type ProxyTargetUrl = URL | string | {
353
+ port: number;
354
+ host: string;
355
+ protocol?: string;
356
+ };
357
+ type NormalizeProxyTarget<T extends ProxyTargetUrl> = Exclude<T, string> | URL;
358
+ interface ServerOptions$3 {
359
+ /** URL string to be parsed with the url module. */
360
+ target?: ProxyTarget;
361
+ /** URL string to be parsed with the url module or a URL object. */
362
+ forward?: ProxyTargetUrl;
363
+ /** Object to be passed to http(s).request. */
364
+ agent?: any;
365
+ /** Object to be passed to https.createServer(). */
366
+ ssl?: any;
367
+ /** If you want to proxy websockets. */
368
+ ws?: boolean;
369
+ /** Adds x- forward headers. */
370
+ xfwd?: boolean;
371
+ /** Verify SSL certificate. */
372
+ secure?: boolean;
373
+ /** Explicitly specify if we are proxying to another proxy. */
374
+ toProxy?: boolean;
375
+ /** Specify whether you want to prepend the target's path to the proxy path. */
376
+ prependPath?: boolean;
377
+ /** Specify whether you want to ignore the proxy path of the incoming request. */
378
+ ignorePath?: boolean;
379
+ /** Local interface string to bind for outgoing connections. */
380
+ localAddress?: string;
381
+ /** Changes the origin of the host header to the target URL. */
382
+ changeOrigin?: boolean;
383
+ /** specify whether you want to keep letter case of response header key */
384
+ preserveHeaderKeyCase?: boolean;
385
+ /** Basic authentication i.e. 'user:password' to compute an Authorization header. */
386
+ auth?: string;
387
+ /** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
388
+ hostRewrite?: string;
389
+ /** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
390
+ autoRewrite?: boolean;
391
+ /** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
392
+ protocolRewrite?: string;
393
+ /** rewrites domain of set-cookie headers. */
394
+ cookieDomainRewrite?: false | string | {
395
+ [oldDomain: string]: string;
396
+ };
397
+ /** rewrites path of set-cookie headers. Default: false */
398
+ cookiePathRewrite?: false | string | {
399
+ [oldPath: string]: string;
400
+ };
401
+ /** object with extra headers to be added to target requests. */
402
+ headers?: {
403
+ [header: string]: string | string[] | undefined;
404
+ };
405
+ /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
406
+ proxyTimeout?: number;
407
+ /** Timeout (in milliseconds) for incoming requests */
408
+ timeout?: number;
409
+ /** Specify whether you want to follow redirects. Default: false */
410
+ followRedirects?: boolean;
411
+ /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
412
+ selfHandleResponse?: boolean;
413
+ /** Buffer */
414
+ buffer?: Stream;
415
+ /** Explicitly set the method type of the ProxyReq */
416
+ method?: string;
417
+ /**
418
+ * Optionally override the trusted CA certificates.
419
+ * This is passed to https.request.
420
+ */
421
+ ca?: string;
422
+ /** Optional fetch implementation to use instead of global fetch, use this to activate fetch-based proxying,
423
+ * for example to proxy HTTP/2 requests
424
+ */
425
+ fetch?: typeof fetch;
426
+ /** Optional configuration object for fetch-based proxy requests.
427
+ * Use this to customize fetch request and response handling.
428
+ * For custom fetch implementations, use the `fetch` property.*/
429
+ fetchOptions?: FetchOptions;
430
+ }
431
+ interface FetchOptions {
432
+ /** Fetch request options */
433
+ requestOptions?: RequestInit;
434
+ /** Called before making the fetch request */
435
+ onBeforeRequest?: (requestOptions: RequestInit, req: http.IncomingMessage, res: http.ServerResponse, options: NormalizedServerOptions) => void | Promise<void>;
436
+ /** Called after receiving the fetch response */
437
+ onAfterResponse?: (response: Response, req: http.IncomingMessage, res: http.ServerResponse, options: NormalizedServerOptions) => void | Promise<void>;
438
+ }
439
+ interface NormalizedServerOptions extends ServerOptions$3 {
440
+ target?: NormalizeProxyTarget<ProxyTarget>;
441
+ forward?: NormalizeProxyTarget<ProxyTargetUrl>;
442
+ }
443
+ type ErrorCallback<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = (err: TError, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse> | net.Socket, target?: ProxyTargetUrl) => void;
444
+ type ProxyServerEventMap<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
445
+ error: Parameters<ErrorCallback<TIncomingMessage, TServerResponse, TError>>;
446
+ start: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl];
447
+ open: [socket: net.Socket];
448
+ proxyReq: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: ServerOptions$3, socket: net.Socket];
449
+ proxyRes: [proxyRes: InstanceType<TIncomingMessage>, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>];
450
+ proxyReqWs: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, socket: net.Socket, options: ServerOptions$3, head: any];
451
+ econnreset: [err: Error, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl];
452
+ end: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, proxyRes: InstanceType<TIncomingMessage>];
453
+ close: [proxyRes: InstanceType<TIncomingMessage>, proxySocket: net.Socket, proxyHead: any];
454
+ };
455
+ type ProxyMethodArgs<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
456
+ ws: [req: InstanceType<TIncomingMessage>, socket: any, head: any, ...args: [options?: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]];
457
+ web: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, ...args: [options: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]];
458
+ };
459
+ type PassFunctions<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
460
+ ws: (req: InstanceType<TIncomingMessage>, socket: net.Socket, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown;
461
+ web: (req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown;
462
+ };
463
+ declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> extends EventEmitter<ProxyServerEventMap<TIncomingMessage, TServerResponse, TError>> {
464
+ /**
465
+ * Used for proxying WS(S) requests
466
+ * @param req - Client request.
467
+ * @param socket - Client socket.
468
+ * @param head - Client head.
469
+ * @param options - Additional options.
470
+ */
471
+ readonly ws: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["ws"]) => void;
472
+ /**
473
+ * Used for proxying regular HTTP(S) requests
474
+ * @param req - Client request.
475
+ * @param res - Client response.
476
+ * @param options - Additional options.
477
+ */
478
+ readonly web: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["web"]) => void;
479
+ private options;
480
+ private webPasses;
481
+ private wsPasses;
482
+ private _server?;
483
+ /**
484
+ * Creates the proxy server with specified options.
485
+ * @param options - Config object passed to the proxy
486
+ */
487
+ constructor(options?: ServerOptions$3);
488
+ /**
489
+ * Creates the proxy server with specified options.
490
+ * @param options Config object passed to the proxy
491
+ * @returns Proxy object with handlers for `ws` and `web` requests
492
+ */
493
+ static createProxyServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
494
+ /**
495
+ * Creates the proxy server with specified options.
496
+ * @param options Config object passed to the proxy
497
+ * @returns Proxy object with handlers for `ws` and `web` requests
498
+ */
499
+ static createServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
500
+ /**
501
+ * Creates the proxy server with specified options.
502
+ * @param options Config object passed to the proxy
503
+ * @returns Proxy object with handlers for `ws` and `web` requests
504
+ */
505
+ static createProxy<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
506
+ createRightProxy: <PT extends ProxyType>(type: PT) => Function;
507
+ onError: (err: TError) => void;
508
+ /**
509
+ * A function that wraps the object in a webserver, for your convenience
510
+ * @param port - Port to listen on
511
+ * @param hostname - The hostname to listen on
512
+ */
513
+ listen: (port: number, hostname?: string) => this;
514
+ address: () => string | net.AddressInfo | null | undefined;
515
+ /**
516
+ * A function that closes the inner webserver and stops listening on given port
517
+ */
518
+ close: (cb?: Function) => void;
519
+ before: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
520
+ after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
521
+ }
522
+ //#endregion
523
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.23.2_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
524
+ declare function numOpenSockets(): number;
525
+ declare namespace index_d_exports {
526
+ export { ErrorCallback, ProxyServer, ProxyTarget, ProxyTargetUrl, ServerOptions$3 as ServerOptions, createProxyServer as createProxy, createProxyServer, createProxyServer as createServer, ProxyServer as default, numOpenSockets };
527
+ }
528
+ /**
529
+ * Creates the proxy server.
530
+ *
531
+ * Examples:
532
+ *
533
+ * httpProxy.createProxyServer({ .. }, 8000)
534
+ * // => '{ web: [Function], ws: [Function] ... }'
535
+ *
536
+ * @param {Object} Options Config object passed to the proxy
537
+ *
538
+ * @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
539
+ *
540
+ * @api public
541
+ */
542
+ declare function createProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
543
+ //#endregion
544
+ //#region src/node/server/middlewares/proxy.d.ts
545
+ interface ProxyOptions extends ServerOptions$3 {
546
+ /**
547
+ * rewrite path
548
+ */
549
+ rewrite?: (path: string) => string;
550
+ /**
551
+ * configure the proxy server (e.g. listen to events)
552
+ */
553
+ configure?: (proxy: ProxyServer, options: ProxyOptions) => void;
554
+ /**
555
+ * webpack-dev-server style bypass function
556
+ */
557
+ bypass?: (req: http.IncomingMessage, res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>;
558
+ /**
559
+ * rewrite the Origin header of a WebSocket request to match the target
560
+ *
561
+ * **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
562
+ */
563
+ rewriteWsOrigin?: boolean | undefined;
564
+ }
565
+ //#endregion
566
+ //#region src/node/logger.d.ts
567
+ type LogType = "error" | "warn" | "info";
568
+ type LogLevel = LogType | "silent";
569
+ interface Logger {
570
+ info(msg: string, options?: LogOptions): void;
571
+ warn(msg: string, options?: LogOptions): void;
572
+ warnOnce(msg: string, options?: LogOptions): void;
573
+ error(msg: string, options?: LogErrorOptions): void;
574
+ clearScreen(type: LogType): void;
575
+ hasErrorLogged(error: Error | RollupError): boolean;
576
+ hasWarned: boolean;
577
+ }
578
+ interface LogOptions {
579
+ clear?: boolean;
580
+ timestamp?: boolean;
581
+ environment?: string;
582
+ }
583
+ interface LogErrorOptions extends LogOptions {
584
+ error?: Error | RollupError | null;
585
+ }
586
+ interface LoggerOptions {
587
+ prefix?: string;
588
+ allowClearScreen?: boolean;
589
+ customLogger?: Logger;
590
+ console?: Console;
591
+ }
592
+ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
593
+ //#endregion
594
+ //#region src/node/http.d.ts
595
+ interface CommonServerOptions {
596
+ /**
597
+ * Specify server port. Note if the port is already being used, Vite will
598
+ * automatically try the next available port so this may not be the actual
599
+ * port the server ends up listening on.
600
+ */
601
+ port?: number;
602
+ /**
603
+ * If enabled, vite will exit if specified port is already in use
604
+ */
605
+ strictPort?: boolean;
606
+ /**
607
+ * Specify which IP addresses the server should listen on.
608
+ * Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
609
+ */
610
+ host?: string | boolean;
611
+ /**
612
+ * The hostnames that Vite is allowed to respond to.
613
+ * `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
614
+ * When using HTTPS, this check is skipped.
615
+ *
616
+ * If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
617
+ * For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
618
+ *
619
+ * If set to `true`, the server is allowed to respond to requests for any hosts.
620
+ * This is not recommended as it will be vulnerable to DNS rebinding attacks.
621
+ */
622
+ allowedHosts?: string[] | true;
623
+ /**
624
+ * Enable TLS + HTTP/2.
625
+ * Note: this downgrades to TLS only when the proxy option is also used.
626
+ */
627
+ https?: HttpsServerOptions;
628
+ /**
629
+ * Open browser window on startup
630
+ */
631
+ open?: boolean | string;
632
+ /**
633
+ * Configure custom proxy rules for the dev server. Expects an object
634
+ * of `{ key: options }` pairs.
635
+ * Uses [`http-proxy-3`](https://github.com/sagemathinc/http-proxy-3).
636
+ * Full options [here](https://github.com/sagemathinc/http-proxy-3#options).
637
+ *
638
+ * Example `vite.config.js`:
639
+ * ``` js
640
+ * module.exports = {
641
+ * proxy: {
642
+ * // string shorthand: /foo -> http://localhost:4567/foo
643
+ * '/foo': 'http://localhost:4567',
644
+ * // with options
645
+ * '/api': {
646
+ * target: 'http://jsonplaceholder.typicode.com',
647
+ * changeOrigin: true,
648
+ * rewrite: path => path.replace(/^\/api/, '')
649
+ * }
650
+ * }
651
+ * }
652
+ * ```
653
+ */
654
+ proxy?: Record<string, string | ProxyOptions>;
655
+ /**
656
+ * Configure CORS for the dev server.
657
+ * Uses https://github.com/expressjs/cors.
658
+ *
659
+ * When enabling this option, **we recommend setting a specific value
660
+ * rather than `true`** to avoid exposing the source code to untrusted origins.
661
+ *
662
+ * Set to `true` to allow all methods from any origin, or configure separately
663
+ * using an object.
664
+ *
665
+ * @default false
666
+ */
667
+ cors?: CorsOptions | boolean;
668
+ /**
669
+ * Specify server response headers.
670
+ */
671
+ headers?: OutgoingHttpHeaders;
672
+ }
673
+ /**
674
+ * https://github.com/expressjs/cors#configuration-options
675
+ */
676
+ interface CorsOptions {
677
+ /**
678
+ * Configures the Access-Control-Allow-Origin CORS header.
679
+ *
680
+ * **We recommend setting a specific value rather than
681
+ * `true`** to avoid exposing the source code to untrusted origins.
682
+ */
683
+ origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
684
+ methods?: string | string[];
685
+ allowedHeaders?: string | string[];
686
+ exposedHeaders?: string | string[];
687
+ credentials?: boolean;
688
+ maxAge?: number;
689
+ preflightContinue?: boolean;
690
+ optionsSuccessStatus?: number;
691
+ }
692
+ type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
693
+ //#endregion
694
+ //#region src/shared/forwardConsole.d.ts
695
+ type ForwardConsoleLogLevel = "error" | "warn" | "info" | "log" | "debug" | (string & {});
696
+ interface ForwardConsoleOptions {
697
+ unhandledErrors?: boolean;
698
+ logLevels?: ForwardConsoleLogLevel[];
699
+ }
700
+ interface ResolvedForwardConsoleOptions {
701
+ enabled: boolean;
702
+ unhandledErrors: boolean;
703
+ logLevels: ForwardConsoleLogLevel[];
704
+ }
705
+ //#endregion
706
+ //#region src/node/typeUtils.d.ts
707
+ type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
708
+ //#endregion
709
+ //#region src/node/preview.d.ts
710
+ interface PreviewOptions extends CommonServerOptions {}
711
+ interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
712
+ interface PreviewServer {
713
+ /**
714
+ * The resolved vite config object
715
+ */
716
+ config: ResolvedConfig;
717
+ /**
718
+ * Stop the server.
719
+ */
720
+ close(): Promise<void>;
721
+ /**
722
+ * A connect app instance.
723
+ * - Can be used to attach custom middlewares to the preview server.
724
+ * - Can also be used as the handler function of a custom http server
725
+ * or as a middleware in any connect-style Node.js frameworks
726
+ *
727
+ * https://github.com/senchalabs/connect#use-middleware
728
+ */
729
+ middlewares: Connect.Server;
730
+ /**
731
+ * native Node http server instance
732
+ */
733
+ httpServer: HttpServer;
734
+ /**
735
+ * The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
736
+ * if the server is not listening on any port.
737
+ */
738
+ resolvedUrls: ResolvedServerUrls | null;
739
+ /**
740
+ * Print server urls
741
+ */
742
+ printUrls(): void;
743
+ /**
744
+ * Bind CLI shortcuts
745
+ */
746
+ bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
747
+ }
748
+ type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
749
+ /**
750
+ * Starts the Vite server in preview mode, to simulate a production deployment
751
+ */
752
+ declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
753
+ //#endregion
754
+ //#region src/node/shortcuts.d.ts
755
+ type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
756
+ /**
757
+ * Print a one-line shortcuts "help" hint to the terminal
758
+ */
759
+ print?: boolean;
760
+ /**
761
+ * Custom shortcuts to run when a key is pressed. These shortcuts take priority
762
+ * over the default shortcuts if they have the same keys (except the `h` key).
763
+ * To disable a default shortcut, define the same key but with `action: undefined`.
764
+ */
765
+ customShortcuts?: CLIShortcut<Server>[];
766
+ };
767
+ type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
768
+ key: string;
769
+ description: string;
770
+ action?(server: Server): void | Promise<void>;
771
+ };
772
+ //#endregion
773
+ //#region src/node/baseEnvironment.d.ts
774
+ declare class PartialEnvironment {
775
+ name: string;
776
+ getTopLevelConfig(): ResolvedConfig;
777
+ config: ResolvedConfig & ResolvedEnvironmentOptions;
778
+ logger: Logger;
779
+ constructor(name: string, topLevelConfig: ResolvedConfig, options?: ResolvedEnvironmentOptions);
780
+ }
781
+ declare class BaseEnvironment extends PartialEnvironment {
782
+ get plugins(): readonly Plugin[];
783
+ constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
784
+ }
785
+ /**
786
+ * This class discourages users from inversely checking the `mode`
787
+ * to determine the type of environment, e.g.
788
+ *
789
+ * ```js
790
+ * const isDev = environment.mode !== 'build' // bad
791
+ * const isDev = environment.mode === 'dev' // good
792
+ * ```
793
+ *
794
+ * You should also not check against `"unknown"` specifically. It's
795
+ * a placeholder for more possible environment types.
796
+ */
797
+ declare class UnknownEnvironment extends BaseEnvironment {
798
+ mode: "unknown";
799
+ }
800
+ //#endregion
801
+ //#region src/node/optimizer/scan.d.ts
802
+ declare class ScanEnvironment extends BaseEnvironment {
803
+ mode: "scan";
804
+ get pluginContainer(): EnvironmentPluginContainer;
805
+ init(): Promise<void>;
806
+ }
807
+ //#endregion
808
+ //#region src/node/optimizer/index.d.ts
809
+ type ExportsData = {
810
+ hasModuleSyntax: boolean;
811
+ exports: readonly string[];
812
+ jsxLoader?: boolean;
813
+ };
814
+ interface DepsOptimizer {
815
+ init: () => Promise<void>;
816
+ metadata: DepOptimizationMetadata;
817
+ scanProcessing?: Promise<void>;
818
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
819
+ run: () => void;
820
+ isOptimizedDepFile: (id: string) => boolean;
821
+ isOptimizedDepUrl: (url: string) => boolean;
822
+ getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
823
+ close: () => Promise<void>;
824
+ options: DepOptimizationOptions;
825
+ }
826
+ interface DepOptimizationConfig {
827
+ /**
828
+ * Force optimize listed dependencies (must be resolvable import paths,
829
+ * cannot be globs).
830
+ */
831
+ include?: string[];
832
+ /**
833
+ * Do not optimize these dependencies (must be resolvable import paths,
834
+ * cannot be globs).
835
+ */
836
+ exclude?: string[];
837
+ /**
838
+ * Forces ESM interop when importing these dependencies. Some legacy
839
+ * packages advertise themselves as ESM but use `require` internally
840
+ * @experimental
841
+ */
842
+ needsInterop?: string[];
843
+ /**
844
+ * Options to pass to esbuild during the dep scanning and optimization
845
+ *
846
+ * Certain options are omitted since changing them would not be compatible
847
+ * with Vite's dep optimization.
848
+ *
849
+ * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
850
+ * - `plugins` are merged with Vite's dep plugin
851
+ *
852
+ * https://esbuild.github.io/api
853
+ *
854
+ * @deprecated Use `rolldownOptions` instead.
855
+ */
856
+ esbuildOptions?: DepsOptimizerEsbuildOptions;
857
+ /**
858
+ * @deprecated Use `rolldownOptions` instead.
859
+ */
860
+ rollupOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
861
+ output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
862
+ };
863
+ /**
864
+ * Options to pass to rolldown during the dep scanning and optimization
865
+ *
866
+ * Certain options are omitted since changing them would not be compatible
867
+ * with Vite's dep optimization.
868
+ *
869
+ * - `plugins` are merged with Vite's dep plugin
870
+ */
871
+ rolldownOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
872
+ output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
873
+ };
874
+ /**
875
+ * List of file extensions that can be optimized. A corresponding esbuild
876
+ * plugin must exist to handle the specific extension.
877
+ *
878
+ * By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
879
+ * allows specifying additional extensions.
880
+ *
881
+ * @experimental
882
+ */
883
+ extensions?: string[];
884
+ /**
885
+ * Deps optimization during build was removed in Vite 5.1. This option is
886
+ * now redundant and will be removed in a future version. Switch to using
887
+ * `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
888
+ * true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
889
+ * @default 'build'
890
+ * @deprecated
891
+ * @experimental
892
+ */
893
+ disabled?: boolean | "build" | "dev";
894
+ /**
895
+ * Automatic dependency discovery. When `noDiscovery` is true, only dependencies
896
+ * listed in `include` will be optimized. The scanner isn't run for cold start
897
+ * in this case. CJS-only dependencies must be present in `include` during dev.
898
+ * @default false
899
+ */
900
+ noDiscovery?: boolean;
901
+ /**
902
+ * When enabled, it will hold the first optimized deps results until all static
903
+ * imports are crawled on cold start. This avoids the need for full-page reloads
904
+ * when new dependencies are discovered and they trigger the generation of new
905
+ * common chunks. If all dependencies are found by the scanner plus the explicitly
906
+ * defined ones in `include`, it is better to disable this option to let the
907
+ * browser process more requests in parallel.
908
+ * @default true
909
+ * @experimental
910
+ */
911
+ holdUntilCrawlEnd?: boolean;
912
+ /**
913
+ * When enabled, Vite will not throw an error when an outdated optimized
914
+ * dependency is requested. Enabling this option may cause a single module
915
+ * to have a multiple reference.
916
+ * @default false
917
+ * @experimental
918
+ */
919
+ ignoreOutdatedRequests?: boolean;
920
+ }
921
+ type DepOptimizationOptions = DepOptimizationConfig & {
922
+ /**
923
+ * By default, Vite will crawl your `index.html` to detect dependencies that
924
+ * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
925
+ * will crawl those entry points instead.
926
+ *
927
+ * If neither of these fit your needs, you can specify custom entries using
928
+ * this option - the value should be a tinyglobby pattern or array of patterns
929
+ * (https://github.com/SuperchupuDev/tinyglobby) that are relative from
930
+ * vite project root. This will overwrite default entries inference.
931
+ */
932
+ entries?: string | string[];
933
+ /**
934
+ * Force dep pre-optimization regardless of whether deps have changed.
935
+ * @experimental
936
+ */
937
+ force?: boolean;
938
+ };
939
+ interface OptimizedDepInfo {
940
+ id: string;
941
+ file: string;
942
+ src?: string;
943
+ needsInterop?: boolean;
944
+ browserHash?: string;
945
+ fileHash?: string;
946
+ /**
947
+ * During optimization, ids can still be resolved to their final location
948
+ * but the bundles may not yet be saved to disk
949
+ */
950
+ processing?: Promise<void>;
951
+ /**
952
+ * ExportData cache, discovered deps will parse the src entry to get exports
953
+ * data used both to define if interop is needed and when pre-bundling
954
+ */
955
+ exportsData?: Promise<ExportsData>;
956
+ isDynamicEntry?: boolean;
957
+ }
958
+ interface DepOptimizationMetadata {
959
+ /**
960
+ * The main hash is determined by user config and dependency lockfiles.
961
+ * This is checked on server startup to avoid unnecessary re-bundles.
962
+ */
963
+ hash: string;
964
+ /**
965
+ * This hash is determined by dependency lockfiles.
966
+ * This is checked on server startup to avoid unnecessary re-bundles.
967
+ */
968
+ lockfileHash: string;
969
+ /**
970
+ * This hash is determined by user config.
971
+ * This is checked on server startup to avoid unnecessary re-bundles.
972
+ */
973
+ configHash: string;
974
+ /**
975
+ * The browser hash is determined by the main hash plus additional dependencies
976
+ * discovered at runtime. This is used to invalidate browser requests to
977
+ * optimized deps.
978
+ */
979
+ browserHash: string;
980
+ /**
981
+ * Metadata for each already optimized dependency
982
+ */
983
+ optimized: Record<string, OptimizedDepInfo>;
984
+ /**
985
+ * Metadata for non-entry optimized chunks and dynamic imports
986
+ */
987
+ chunks: Record<string, OptimizedDepInfo>;
988
+ /**
989
+ * Metadata for each newly discovered dependency after processing
990
+ */
991
+ discovered: Record<string, OptimizedDepInfo>;
992
+ /**
993
+ * OptimizedDepInfo list
994
+ */
995
+ depInfoList: OptimizedDepInfo[];
996
+ }
997
+ /**
998
+ * Scan and optimize dependencies within a project.
999
+ * Used by Vite CLI when running `vite optimize`.
1000
+ *
1001
+ * @deprecated the optimization process runs automatically and does not need to be called
1002
+ */
1003
+ declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
1004
+ //#endregion
1005
+ //#region src/node/server/transformRequest.d.ts
1006
+ interface TransformResult {
1007
+ code: string;
1008
+ map: SourceMap | {
1009
+ mappings: "";
1010
+ } | null;
1011
+ ssr?: boolean;
1012
+ etag?: string;
1013
+ deps?: string[];
1014
+ dynamicDeps?: string[];
1015
+ }
1016
+ interface TransformOptions {
1017
+ /**
1018
+ * @deprecated inferred from environment
1019
+ */
1020
+ ssr?: boolean;
1021
+ }
1022
+ //#endregion
1023
+ //#region src/node/server/moduleGraph.d.ts
1024
+ declare class EnvironmentModuleNode {
1025
+ environment: string;
1026
+ /**
1027
+ * Public served url path, starts with /
1028
+ */
1029
+ url: string;
1030
+ /**
1031
+ * Resolved file system path + query
1032
+ */
1033
+ id: string | null;
1034
+ file: string | null;
1035
+ type: "js" | "css" | "asset";
1036
+ info?: ModuleInfo;
1037
+ meta?: Record<string, any>;
1038
+ importers: Set<EnvironmentModuleNode>;
1039
+ importedModules: Set<EnvironmentModuleNode>;
1040
+ acceptedHmrDeps: Set<EnvironmentModuleNode>;
1041
+ acceptedHmrExports: Set<string> | null;
1042
+ importedBindings: Map<string, Set<string>> | null;
1043
+ isSelfAccepting?: boolean;
1044
+ transformResult: TransformResult | null;
1045
+ ssrModule: Record<string, any> | null;
1046
+ ssrError: Error | null;
1047
+ lastHMRTimestamp: number;
1048
+ lastInvalidationTimestamp: number;
1049
+ /**
1050
+ * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
1051
+ */
1052
+ constructor(url: string, environment: string, setIsSelfAccepting?: boolean);
1053
+ }
1054
+ type ResolvedUrl = [url: string, resolvedId: string, meta: object | null | undefined];
1055
+ declare class EnvironmentModuleGraph {
1056
+ environment: string;
1057
+ urlToModuleMap: Map<string, EnvironmentModuleNode>;
1058
+ idToModuleMap: Map<string, EnvironmentModuleNode>;
1059
+ etagToModuleMap: Map<string, EnvironmentModuleNode>;
1060
+ fileToModulesMap: Map<string, Set<EnvironmentModuleNode>>;
1061
+ constructor(environment: string, resolveId: (url: string) => Promise<PartialResolvedId | null>);
1062
+ getModuleByUrl(rawUrl: string): Promise<EnvironmentModuleNode | undefined>;
1063
+ getModuleById(id: string): EnvironmentModuleNode | undefined;
1064
+ getModulesByFile(file: string): Set<EnvironmentModuleNode> | undefined;
1065
+ onFileChange(file: string): void;
1066
+ onFileDelete(file: string): void;
1067
+ invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
1068
+ invalidateAll(): void;
1069
+ /**
1070
+ * Update the module graph based on a module's updated imports information
1071
+ * If there are dependencies that no longer have any importers, they are
1072
+ * returned as a Set.
1073
+ *
1074
+ * @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
1075
+ * This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
1076
+ */
1077
+ updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, staticImportedUrls?: Set<string>): Promise<Set<EnvironmentModuleNode> | undefined>;
1078
+ ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>;
1079
+ createFileOnlyEntry(file: string): EnvironmentModuleNode;
1080
+ resolveUrl(url: string): Promise<ResolvedUrl>;
1081
+ updateModuleTransformResult(mod: EnvironmentModuleNode, result: TransformResult | null): void;
1082
+ getModuleByEtag(etag: string): EnvironmentModuleNode | undefined;
1083
+ }
1084
+ //#endregion
1085
+ //#region src/node/server/mixedModuleGraph.d.ts
1086
+ declare class ModuleNode {
1087
+ _moduleGraph: ModuleGraph;
1088
+ _clientModule: EnvironmentModuleNode | undefined;
1089
+ _ssrModule: EnvironmentModuleNode | undefined;
1090
+ constructor(moduleGraph: ModuleGraph, clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode);
1091
+ _get<T extends keyof EnvironmentModuleNode>(prop: T): EnvironmentModuleNode[T];
1092
+ _set<T extends keyof EnvironmentModuleNode>(prop: T, value: EnvironmentModuleNode[T]): void;
1093
+ _wrapModuleSet(prop: ModuleSetNames, module: EnvironmentModuleNode | undefined): Set<ModuleNode>;
1094
+ _getModuleSetUnion(prop: "importedModules" | "importers"): Set<ModuleNode>;
1095
+ _getModuleInfoUnion(prop: "info"): ModuleInfo | undefined;
1096
+ _getModuleObjectUnion(prop: "meta"): Record<string, any> | undefined;
1097
+ get url(): string;
1098
+ set url(value: string);
1099
+ get id(): string | null;
1100
+ set id(value: string | null);
1101
+ get file(): string | null;
1102
+ set file(value: string | null);
1103
+ get type(): "js" | "css" | "asset";
1104
+ get info(): ModuleInfo | undefined;
1105
+ get meta(): Record<string, any> | undefined;
1106
+ get importers(): Set<ModuleNode>;
1107
+ get clientImportedModules(): Set<ModuleNode>;
1108
+ get ssrImportedModules(): Set<ModuleNode>;
1109
+ get importedModules(): Set<ModuleNode>;
1110
+ get acceptedHmrDeps(): Set<ModuleNode>;
1111
+ get acceptedHmrExports(): Set<string> | null;
1112
+ get importedBindings(): Map<string, Set<string>> | null;
1113
+ get isSelfAccepting(): boolean | undefined;
1114
+ get transformResult(): TransformResult | null;
1115
+ set transformResult(value: TransformResult | null);
1116
+ get ssrTransformResult(): TransformResult | null;
1117
+ set ssrTransformResult(value: TransformResult | null);
1118
+ get ssrModule(): Record<string, any> | null;
1119
+ get ssrError(): Error | null;
1120
+ get lastHMRTimestamp(): number;
1121
+ set lastHMRTimestamp(value: number);
1122
+ get lastInvalidationTimestamp(): number;
1123
+ get invalidationState(): TransformResult | "HARD_INVALIDATED" | undefined;
1124
+ get ssrInvalidationState(): TransformResult | "HARD_INVALIDATED" | undefined;
1125
+ }
1126
+ declare class ModuleGraph {
1127
+ urlToModuleMap: Map<string, ModuleNode>;
1128
+ idToModuleMap: Map<string, ModuleNode>;
1129
+ etagToModuleMap: Map<string, ModuleNode>;
1130
+ fileToModulesMap: Map<string, Set<ModuleNode>>;
1131
+ private moduleNodeCache;
1132
+ constructor(moduleGraphs: {
1133
+ client: () => EnvironmentModuleGraph;
1134
+ ssr: () => EnvironmentModuleGraph;
1135
+ });
1136
+ getModuleById(id: string): ModuleNode | undefined;
1137
+ getModuleByUrl(url: string, _ssr?: boolean): Promise<ModuleNode | undefined>;
1138
+ getModulesByFile(file: string): Set<ModuleNode> | undefined;
1139
+ onFileChange(file: string): void;
1140
+ onFileDelete(file: string): void;
1141
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
1142
+ invalidateAll(): void;
1143
+ ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
1144
+ createFileOnlyEntry(file: string): ModuleNode;
1145
+ resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
1146
+ updateModuleTransformResult(mod: ModuleNode, result: TransformResult | null, ssr?: boolean): void;
1147
+ getModuleByEtag(etag: string): ModuleNode | undefined;
1148
+ getBackwardCompatibleBrowserModuleNode(clientModule: EnvironmentModuleNode): ModuleNode;
1149
+ getBackwardCompatibleServerModuleNode(ssrModule: EnvironmentModuleNode): ModuleNode;
1150
+ getBackwardCompatibleModuleNode(mod: EnvironmentModuleNode): ModuleNode;
1151
+ getBackwardCompatibleModuleNodeDual(clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode): ModuleNode;
1152
+ }
1153
+ type ModuleSetNames = "acceptedHmrDeps" | "importedModules";
1154
+ //#endregion
1155
+ //#region src/node/server/hmr.d.ts
1156
+ interface HmrOptions {
1157
+ protocol?: string;
1158
+ host?: string;
1159
+ port?: number;
1160
+ clientPort?: number;
1161
+ path?: string;
1162
+ timeout?: number;
1163
+ overlay?: boolean;
1164
+ server?: HttpServer;
1165
+ }
1166
+ interface HotUpdateOptions {
1167
+ type: "create" | "update" | "delete";
1168
+ file: string;
1169
+ timestamp: number;
1170
+ modules: Array<EnvironmentModuleNode>;
1171
+ read: () => string | Promise<string>;
1172
+ server: ViteDevServer;
1173
+ }
1174
+ interface HmrContext {
1175
+ file: string;
1176
+ timestamp: number;
1177
+ modules: Array<ModuleNode>;
1178
+ read: () => string | Promise<string>;
1179
+ server: ViteDevServer;
1180
+ }
1181
+ interface HotChannelClient {
1182
+ send(payload: hmrPayload_HotPayload): void;
1183
+ }
1184
+ type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
1185
+ interface HotChannel<Api = any> {
1186
+ /**
1187
+ * When true, the fs access check is skipped in fetchModule.
1188
+ * Set this for transports that is not exposed over the network.
1189
+ */
1190
+ skipFsCheck?: boolean;
1191
+ /**
1192
+ * Broadcast events to all clients
1193
+ */
1194
+ send?(payload: hmrPayload_HotPayload): void;
1195
+ /**
1196
+ * Handle custom event emitted by `import.meta.hot.send`
1197
+ */
1198
+ on?<T extends string>(event: T, listener: HotChannelListener<T>): void;
1199
+ on?(event: "connection", listener: () => void): void;
1200
+ /**
1201
+ * Unregister event listener
1202
+ */
1203
+ off?(event: string, listener: Function): void;
1204
+ /**
1205
+ * Start listening for messages
1206
+ */
1207
+ listen?(): void;
1208
+ /**
1209
+ * Disconnect all clients, called when server is closed or restarted.
1210
+ */
1211
+ close?(): Promise<unknown> | void;
1212
+ api?: Api;
1213
+ }
1214
+ interface NormalizedHotChannelClient {
1215
+ /**
1216
+ * Send event to the client
1217
+ */
1218
+ send(payload: hmrPayload_HotPayload): void;
1219
+ /**
1220
+ * Send custom event
1221
+ */
1222
+ send(event: string, payload?: hmrPayload_CustomPayload["data"]): void;
1223
+ }
1224
+ interface NormalizedHotChannel<Api = any> {
1225
+ /**
1226
+ * Broadcast events to all clients
1227
+ */
1228
+ send(payload: hmrPayload_HotPayload): void;
1229
+ /**
1230
+ * Send custom event
1231
+ */
1232
+ send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
1233
+ /**
1234
+ * Handle custom event emitted by `import.meta.hot.send`
1235
+ */
1236
+ on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: NormalizedHotChannelClient) => void): void;
1237
+ /**
1238
+ * @deprecated use `vite:client:connect` event instead
1239
+ */
1240
+ on(event: "connection", listener: () => void): void;
1241
+ /**
1242
+ * Unregister event listener
1243
+ */
1244
+ off(event: string, listener: Function): void;
1245
+ handleInvoke(payload: hmrPayload_HotPayload): Promise<{
1246
+ result: any;
1247
+ } | {
1248
+ error: any;
1249
+ }>;
1250
+ /**
1251
+ * Start listening for messages
1252
+ */
1253
+ listen(): void;
1254
+ /**
1255
+ * Disconnect all clients, called when server is closed or restarted.
1256
+ */
1257
+ close(): Promise<unknown> | void;
1258
+ api?: Api;
1259
+ }
1260
+ type ServerHotChannelApi = {
1261
+ innerEmitter: EventEmitter;
1262
+ outsideEmitter: EventEmitter;
1263
+ };
1264
+ type ServerHotChannel = HotChannel<ServerHotChannelApi>;
1265
+ type NormalizedServerHotChannel = NormalizedHotChannel<ServerHotChannelApi>;
1266
+ declare function createServerHotChannel(): ServerHotChannel;
1267
+ //#endregion
1268
+ //#region src/types/ws.d.ts
1269
+ // WebSocket socket.
1270
+ declare class WebSocket extends EventEmitter {
1271
+ /** The connection is not yet open. */
1272
+ static readonly CONNECTING: 0;
1273
+ /** The connection is open and ready to communicate. */
1274
+ static readonly OPEN: 1;
1275
+ /** The connection is in the process of closing. */
1276
+ static readonly CLOSING: 2;
1277
+ /** The connection is closed. */
1278
+ static readonly CLOSED: 3;
1279
+ binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments';
1280
+ readonly bufferedAmount: number;
1281
+ readonly extensions: string;
1282
+ /** Indicates whether the websocket is paused */
1283
+ readonly isPaused: boolean;
1284
+ readonly protocol: string;
1285
+ /** The current state of the connection */
1286
+ readonly readyState: typeof WebSocket.CONNECTING | typeof WebSocket.OPEN | typeof WebSocket.CLOSING | typeof WebSocket.CLOSED;
1287
+ readonly url: string;
1288
+ /** The connection is not yet open. */
1289
+ readonly CONNECTING: 0;
1290
+ /** The connection is open and ready to communicate. */
1291
+ readonly OPEN: 1;
1292
+ /** The connection is in the process of closing. */
1293
+ readonly CLOSING: 2;
1294
+ /** The connection is closed. */
1295
+ readonly CLOSED: 3;
1296
+ onopen: ((event: WebSocket.Event) => void) | null;
1297
+ onerror: ((event: WebSocket.ErrorEvent) => void) | null;
1298
+ onclose: ((event: WebSocket.CloseEvent) => void) | null;
1299
+ onmessage: ((event: WebSocket.MessageEvent) => void) | null;
1300
+ constructor(address: null);
1301
+ constructor(address: string | url_URL, options?: WebSocket.ClientOptions | ClientRequestArgs);
1302
+ constructor(address: string | url_URL, protocols?: string | string[], options?: WebSocket.ClientOptions | ClientRequestArgs);
1303
+ close(code?: number, data?: string | Buffer): void;
1304
+ ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
1305
+ pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
1306
+ send(data: any, cb?: (err?: Error) => void): void;
1307
+ send(data: any, options: {
1308
+ mask?: boolean | undefined;
1309
+ binary?: boolean | undefined;
1310
+ compress?: boolean | undefined;
1311
+ fin?: boolean | undefined;
1312
+ }, cb?: (err?: Error) => void): void;
1313
+ terminate(): void;
1314
+ /**
1315
+ * Pause the websocket causing it to stop emitting events. Some events can still be
1316
+ * emitted after this is called, until all buffered data is consumed. This method
1317
+ * is a noop if the ready state is `CONNECTING` or `CLOSED`.
1318
+ */
1319
+ pause(): void;
1320
+ /**
1321
+ * Make a paused socket resume emitting events. This method is a noop if the ready
1322
+ * state is `CONNECTING` or `CLOSED`.
1323
+ */
1324
+ resume(): void; // HTML5 WebSocket events
1325
+ addEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void, options?: WebSocket.EventListenerOptions): void;
1326
+ addEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void, options?: WebSocket.EventListenerOptions): void;
1327
+ addEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void, options?: WebSocket.EventListenerOptions): void;
1328
+ addEventListener(method: 'open', cb: (event: WebSocket.Event) => void, options?: WebSocket.EventListenerOptions): void;
1329
+ removeEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void): void;
1330
+ removeEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void): void;
1331
+ removeEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void): void;
1332
+ removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void; // Events
1333
+ on(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
1334
+ on(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
1335
+ on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
1336
+ on(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
1337
+ on(event: 'open', listener: (this: WebSocket) => void): this;
1338
+ on(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this;
1339
+ on(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this;
1340
+ on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
1341
+ once(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
1342
+ once(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
1343
+ once(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
1344
+ once(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
1345
+ once(event: 'open', listener: (this: WebSocket) => void): this;
1346
+ once(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this;
1347
+ once(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this;
1348
+ once(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
1349
+ off(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
1350
+ off(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
1351
+ off(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
1352
+ off(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
1353
+ off(event: 'open', listener: (this: WebSocket) => void): this;
1354
+ off(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this;
1355
+ off(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this;
1356
+ off(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
1357
+ addListener(event: 'close', listener: (code: number, reason: Buffer) => void): this;
1358
+ addListener(event: 'error', listener: (err: Error) => void): this;
1359
+ addListener(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this;
1360
+ addListener(event: 'message', listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
1361
+ addListener(event: 'open', listener: () => void): this;
1362
+ addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this;
1363
+ addListener(event: 'unexpected-response', listener: (request: ClientRequest, response: http.IncomingMessage) => void): this;
1364
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1365
+ removeListener(event: 'close', listener: (code: number, reason: Buffer) => void): this;
1366
+ removeListener(event: 'error', listener: (err: Error) => void): this;
1367
+ removeListener(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this;
1368
+ removeListener(event: 'message', listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
1369
+ removeListener(event: 'open', listener: () => void): this;
1370
+ removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this;
1371
+ removeListener(event: 'unexpected-response', listener: (request: ClientRequest, response: http.IncomingMessage) => void): this;
1372
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1373
+ }
1374
+ declare const WebSocketAlias: typeof WebSocket;
1375
+ interface WebSocketAlias extends WebSocket {}
1376
+ declare namespace WebSocket {
1377
+ /**
1378
+ * Data represents the raw message payload received over the WebSocket.
1379
+ */
1380
+ type RawData = Buffer | ArrayBuffer | Buffer[];
1381
+ /**
1382
+ * Data represents the message payload received over the WebSocket.
1383
+ */
1384
+ type Data = string | Buffer | ArrayBuffer | Buffer[];
1385
+ /**
1386
+ * CertMeta represents the accepted types for certificate & key data.
1387
+ */
1388
+ type CertMeta = string | string[] | Buffer | Buffer[];
1389
+ /**
1390
+ * VerifyClientCallbackSync is a synchronous callback used to inspect the
1391
+ * incoming message. The return value (boolean) of the function determines
1392
+ * whether or not to accept the handshake.
1393
+ */
1394
+ type VerifyClientCallbackSync = (info: {
1395
+ origin: string;
1396
+ secure: boolean;
1397
+ req: http.IncomingMessage;
1398
+ }) => boolean;
1399
+ /**
1400
+ * VerifyClientCallbackAsync is an asynchronous callback used to inspect the
1401
+ * incoming message. The return value (boolean) of the function determines
1402
+ * whether or not to accept the handshake.
1403
+ */
1404
+ type VerifyClientCallbackAsync = (info: {
1405
+ origin: string;
1406
+ secure: boolean;
1407
+ req: http.IncomingMessage;
1408
+ }, callback: (res: boolean, code?: number, message?: string, headers?: OutgoingHttpHeaders) => void) => void;
1409
+ interface ClientOptions extends SecureContextOptions {
1410
+ protocol?: string | undefined;
1411
+ followRedirects?: boolean | undefined;
1412
+ generateMask?(mask: Buffer): void;
1413
+ handshakeTimeout?: number | undefined;
1414
+ maxRedirects?: number | undefined;
1415
+ perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
1416
+ localAddress?: string | undefined;
1417
+ protocolVersion?: number | undefined;
1418
+ headers?: {
1419
+ [key: string]: string;
1420
+ } | undefined;
1421
+ origin?: string | undefined;
1422
+ agent?: Agent | undefined;
1423
+ host?: string | undefined;
1424
+ family?: number | undefined;
1425
+ checkServerIdentity?(servername: string, cert: CertMeta): boolean;
1426
+ rejectUnauthorized?: boolean | undefined;
1427
+ maxPayload?: number | undefined;
1428
+ skipUTF8Validation?: boolean | undefined;
1429
+ }
1430
+ interface PerMessageDeflateOptions {
1431
+ serverNoContextTakeover?: boolean | undefined;
1432
+ clientNoContextTakeover?: boolean | undefined;
1433
+ serverMaxWindowBits?: number | undefined;
1434
+ clientMaxWindowBits?: number | undefined;
1435
+ zlibDeflateOptions?: {
1436
+ flush?: number | undefined;
1437
+ finishFlush?: number | undefined;
1438
+ chunkSize?: number | undefined;
1439
+ windowBits?: number | undefined;
1440
+ level?: number | undefined;
1441
+ memLevel?: number | undefined;
1442
+ strategy?: number | undefined;
1443
+ dictionary?: Buffer | Buffer[] | DataView | undefined;
1444
+ info?: boolean | undefined;
1445
+ } | undefined;
1446
+ zlibInflateOptions?: ZlibOptions | undefined;
1447
+ threshold?: number | undefined;
1448
+ concurrencyLimit?: number | undefined;
1449
+ }
1450
+ interface Event {
1451
+ type: string;
1452
+ target: WebSocket;
1453
+ }
1454
+ interface ErrorEvent {
1455
+ error: any;
1456
+ message: string;
1457
+ type: string;
1458
+ target: WebSocket;
1459
+ }
1460
+ interface CloseEvent {
1461
+ wasClean: boolean;
1462
+ code: number;
1463
+ reason: string;
1464
+ type: string;
1465
+ target: WebSocket;
1466
+ }
1467
+ interface MessageEvent {
1468
+ data: Data;
1469
+ type: string;
1470
+ target: WebSocket;
1471
+ }
1472
+ interface EventListenerOptions {
1473
+ once?: boolean | undefined;
1474
+ }
1475
+ interface ServerOptions {
1476
+ host?: string | undefined;
1477
+ port?: number | undefined;
1478
+ backlog?: number | undefined;
1479
+ server?: http.Server | HttpsServer | undefined;
1480
+ verifyClient?: VerifyClientCallbackAsync | VerifyClientCallbackSync | undefined;
1481
+ handleProtocols?: (protocols: Set<string>, request: http.IncomingMessage) => string | false;
1482
+ path?: string | undefined;
1483
+ noServer?: boolean | undefined;
1484
+ clientTracking?: boolean | undefined;
1485
+ perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
1486
+ maxPayload?: number | undefined;
1487
+ skipUTF8Validation?: boolean | undefined;
1488
+ WebSocket?: typeof WebSocket.WebSocket | undefined;
1489
+ }
1490
+ interface AddressInfo {
1491
+ address: string;
1492
+ family: string;
1493
+ port: number;
1494
+ } // WebSocket Server
1495
+ class Server<T extends WebSocket = WebSocket> extends EventEmitter {
1496
+ options: ServerOptions;
1497
+ path: string;
1498
+ clients: Set<T>;
1499
+ constructor(options?: ServerOptions, callback?: () => void);
1500
+ address(): AddressInfo | string;
1501
+ close(cb?: (err?: Error) => void): void;
1502
+ handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T, request: http.IncomingMessage) => void): void;
1503
+ shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>; // Events
1504
+ on(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
1505
+ on(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
1506
+ on(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
1507
+ on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
1508
+ on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
1509
+ once(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
1510
+ once(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
1511
+ once(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
1512
+ once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
1513
+ once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
1514
+ off(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
1515
+ off(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
1516
+ off(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
1517
+ off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
1518
+ off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
1519
+ addListener(event: 'connection', cb: (client: T, request: http.IncomingMessage) => void): this;
1520
+ addListener(event: 'error', cb: (err: Error) => void): this;
1521
+ addListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this;
1522
+ addListener(event: 'close' | 'listening', cb: () => void): this;
1523
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1524
+ removeListener(event: 'connection', cb: (client: T) => void): this;
1525
+ removeListener(event: 'error', cb: (err: Error) => void): this;
1526
+ removeListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this;
1527
+ removeListener(event: 'close' | 'listening', cb: () => void): this;
1528
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1529
+ }
1530
+ const WebSocketServer: typeof Server;
1531
+ interface WebSocketServer extends Server {}
1532
+ const WebSocket: typeof WebSocketAlias;
1533
+ interface WebSocket extends WebSocketAlias {} // WebSocket stream
1534
+ function createWebSocketStream(websocket: WebSocket, options?: DuplexOptions): Duplex;
1535
+ } // export = WebSocket
1536
+ //#endregion
1537
+ //#region src/node/server/ws.d.ts
1538
+ type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
1539
+ declare const isWebSocketServer: unique symbol;
1540
+ interface WebSocketServer extends NormalizedHotChannel {
1541
+ /**
1542
+ * Handle custom event emitted by `import.meta.hot.send`
1543
+ */
1544
+ on: WebSocket.Server["on"] & {
1545
+ <T extends string>(event: T, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T>>): void;
1546
+ };
1547
+ /**
1548
+ * Unregister event listener.
1549
+ */
1550
+ off: WebSocket.Server["off"] & {
1551
+ (event: string, listener: Function): void;
1552
+ };
1553
+ /**
1554
+ * Listen on port and host
1555
+ */
1556
+ listen(): void;
1557
+ /**
1558
+ * Disconnect all clients and terminate the server.
1559
+ */
1560
+ close(): Promise<void>;
1561
+ [isWebSocketServer]: true;
1562
+ /**
1563
+ * Get all connected clients.
1564
+ */
1565
+ clients: Set<WebSocketClient>;
1566
+ }
1567
+ interface WebSocketClient extends NormalizedHotChannelClient {
1568
+ /**
1569
+ * The raw WebSocket instance
1570
+ * @advanced
1571
+ */
1572
+ socket: WebSocket;
1573
+ }
1574
+ //#endregion
1575
+ //#region src/node/server/environment.d.ts
1576
+ interface DevEnvironmentContext {
1577
+ hot: boolean;
1578
+ transport?: HotChannel | WebSocketServer;
1579
+ options?: EnvironmentOptions;
1580
+ remoteRunner?: {
1581
+ inlineSourceMap?: boolean;
1582
+ };
1583
+ depsOptimizer?: DepsOptimizer;
1584
+ }
1585
+ declare class DevEnvironment extends BaseEnvironment {
1586
+ mode: "dev";
1587
+ moduleGraph: EnvironmentModuleGraph;
1588
+ depsOptimizer?: DepsOptimizer;
1589
+ get pluginContainer(): EnvironmentPluginContainer<DevEnvironment>;
1590
+ /**
1591
+ * Hot channel for this environment. If not provided or disabled,
1592
+ * it will be a noop channel that does nothing.
1593
+ *
1594
+ * @example
1595
+ * environment.hot.send({ type: 'full-reload' })
1596
+ */
1597
+ hot: NormalizedHotChannel;
1598
+ constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
1599
+ init(options?: {
1600
+ watcher?: FSWatcher;
1601
+ /**
1602
+ * the previous instance used for the environment with the same name
1603
+ *
1604
+ * when using, the consumer should check if it's an instance generated from the same class or factory function
1605
+ */
1606
+ previousInstance?: DevEnvironment;
1607
+ }): Promise<void>;
1608
+ /**
1609
+ * When the dev server is restarted, the methods are called in the following order:
1610
+ * - new instance `init`
1611
+ * - previous instance `close`
1612
+ * - new instance `listen`
1613
+ */
1614
+ listen(server: ViteDevServer): Promise<void>;
1615
+ /**
1616
+ * Called by the module runner to retrieve information about the specified
1617
+ * module. Internally calls `transformRequest` and wraps the result in the
1618
+ * format that the module runner understands.
1619
+ * This method is not meant to be called manually.
1620
+ */
1621
+ fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>;
1622
+ reloadModule(module: EnvironmentModuleNode): Promise<void>;
1623
+ transformRequest(url: string): Promise<TransformResult | null>;
1624
+ warmupRequest(url: string): Promise<void>;
1625
+ protected invalidateModule(m: {
1626
+ path: string;
1627
+ message?: string;
1628
+ firstInvalidatedBy: string;
1629
+ }, _client: NormalizedHotChannelClient): void;
1630
+ close(): Promise<void>;
1631
+ /**
1632
+ * Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports
1633
+ * are processed after the first transformRequest call. If called from a load or transform
1634
+ * plugin hook, the id needs to be passed as a parameter to avoid deadlocks.
1635
+ * Calling this function after the first static imports section of the module graph has been
1636
+ * processed will resolve immediately.
1637
+ * @experimental
1638
+ */
1639
+ waitForRequestsIdle(ignoredId?: string): Promise<void>;
1640
+ }
1641
+ //#endregion
1642
+ //#region src/types/commonjs.d.ts
1643
+
1644
+ interface RollupCommonJSOptions {
1645
+ /**
1646
+ * A minimatch pattern, or array of patterns, which specifies the files in
1647
+ * the build the plugin should operate on. By default, all files with
1648
+ * extension `".cjs"` or those in `extensions` are included, but you can
1649
+ * narrow this list by only including specific files. These files will be
1650
+ * analyzed and transpiled if either the analysis does not find ES module
1651
+ * specific statements or `transformMixedEsModules` is `true`.
1652
+ * @default undefined
1653
+ */
1654
+ include?: string | RegExp | readonly (string | RegExp)[];
1655
+ /**
1656
+ * A minimatch pattern, or array of patterns, which specifies the files in
1657
+ * the build the plugin should _ignore_. By default, all files with
1658
+ * extensions other than those in `extensions` or `".cjs"` are ignored, but you
1659
+ * can exclude additional files. See also the `include` option.
1660
+ * @default undefined
1661
+ */
1662
+ exclude?: string | RegExp | readonly (string | RegExp)[];
1663
+ /**
1664
+ * For extensionless imports, search for extensions other than .js in the
1665
+ * order specified. Note that you need to make sure that non-JavaScript files
1666
+ * are transpiled by another plugin first.
1667
+ * @default [ '.js' ]
1668
+ */
1669
+ extensions?: ReadonlyArray<string>;
1670
+ /**
1671
+ * If true then uses of `global` won't be dealt with by this plugin
1672
+ * @default false
1673
+ */
1674
+ ignoreGlobal?: boolean;
1675
+ /**
1676
+ * If false, skips source map generation for CommonJS modules. This will
1677
+ * improve performance.
1678
+ * @default true
1679
+ */
1680
+ sourceMap?: boolean;
1681
+ /**
1682
+ * Some `require` calls cannot be resolved statically to be translated to
1683
+ * imports.
1684
+ * When this option is set to `false`, the generated code will either
1685
+ * directly throw an error when such a call is encountered or, when
1686
+ * `dynamicRequireTargets` is used, when such a call cannot be resolved with a
1687
+ * configured dynamic require target.
1688
+ * Setting this option to `true` will instead leave the `require` call in the
1689
+ * code or use it as a fallback for `dynamicRequireTargets`.
1690
+ * @default false
1691
+ */
1692
+ ignoreDynamicRequires?: boolean;
1693
+ /**
1694
+ * Instructs the plugin whether to enable mixed module transformations. This
1695
+ * is useful in scenarios with modules that contain a mix of ES `import`
1696
+ * statements and CommonJS `require` expressions. Set to `true` if `require`
1697
+ * calls should be transformed to imports in mixed modules, or `false` if the
1698
+ * `require` expressions should survive the transformation. The latter can be
1699
+ * important if the code contains environment detection, or you are coding
1700
+ * for an environment with special treatment for `require` calls such as
1701
+ * ElectronJS. See also the `ignore` option.
1702
+ * @default false
1703
+ */
1704
+ transformMixedEsModules?: boolean;
1705
+ /**
1706
+ * By default, this plugin will try to hoist `require` statements as imports
1707
+ * to the top of each file. While this works well for many code bases and
1708
+ * allows for very efficient ESM output, it does not perfectly capture
1709
+ * CommonJS semantics as the order of side effects like log statements may
1710
+ * change. But it is especially problematic when there are circular `require`
1711
+ * calls between CommonJS modules as those often rely on the lazy execution of
1712
+ * nested `require` calls.
1713
+ *
1714
+ * Setting this option to `true` will wrap all CommonJS files in functions
1715
+ * which are executed when they are required for the first time, preserving
1716
+ * NodeJS semantics. Note that this can have an impact on the size and
1717
+ * performance of the generated code.
1718
+ *
1719
+ * The default value of `"auto"` will only wrap CommonJS files when they are
1720
+ * part of a CommonJS dependency cycle, e.g. an index file that is required by
1721
+ * many of its dependencies. All other CommonJS files are hoisted. This is the
1722
+ * recommended setting for most code bases.
1723
+ *
1724
+ * `false` will entirely prevent wrapping and hoist all files. This may still
1725
+ * work depending on the nature of cyclic dependencies but will often cause
1726
+ * problems.
1727
+ *
1728
+ * You can also provide a minimatch pattern, or array of patterns, to only
1729
+ * specify a subset of files which should be wrapped in functions for proper
1730
+ * `require` semantics.
1731
+ *
1732
+ * `"debug"` works like `"auto"` but after bundling, it will display a warning
1733
+ * containing a list of ids that have been wrapped which can be used as
1734
+ * minimatch pattern for fine-tuning.
1735
+ * @default "auto"
1736
+ */
1737
+ strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[];
1738
+ /**
1739
+ * Sometimes you have to leave require statements unconverted. Pass an array
1740
+ * containing the IDs or a `id => boolean` function.
1741
+ * @default []
1742
+ */
1743
+ ignore?: ReadonlyArray<string> | ((id: string) => boolean);
1744
+ /**
1745
+ * In most cases, where `require` calls are inside a `try-catch` clause,
1746
+ * they should be left unconverted as it requires an optional dependency
1747
+ * that may or may not be installed beside the rolled up package.
1748
+ * Due to the conversion of `require` to a static `import` - the call is
1749
+ * hoisted to the top of the file, outside the `try-catch` clause.
1750
+ *
1751
+ * - `true`: Default. All `require` calls inside a `try` will be left unconverted.
1752
+ * - `false`: All `require` calls inside a `try` will be converted as if the
1753
+ * `try-catch` clause is not there.
1754
+ * - `remove`: Remove all `require` calls from inside any `try` block.
1755
+ * - `string[]`: Pass an array containing the IDs to left unconverted.
1756
+ * - `((id: string) => boolean|'remove')`: Pass a function that controls
1757
+ * individual IDs.
1758
+ *
1759
+ * @default true
1760
+ */
1761
+ ignoreTryCatch?: boolean | 'remove' | ReadonlyArray<string> | ((id: string) => boolean | 'remove');
1762
+ /**
1763
+ * Controls how to render imports from external dependencies. By default,
1764
+ * this plugin assumes that all external dependencies are CommonJS. This
1765
+ * means they are rendered as default imports to be compatible with e.g.
1766
+ * NodeJS where ES modules can only import a default export from a CommonJS
1767
+ * dependency.
1768
+ *
1769
+ * If you set `esmExternals` to `true`, this plugin assumes that all
1770
+ * external dependencies are ES modules and respect the
1771
+ * `requireReturnsDefault` option. If that option is not set, they will be
1772
+ * rendered as namespace imports.
1773
+ *
1774
+ * You can also supply an array of ids to be treated as ES modules, or a
1775
+ * function that will be passed each external id to determine whether it is
1776
+ * an ES module.
1777
+ * @default false
1778
+ */
1779
+ esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean);
1780
+ /**
1781
+ * Controls what is returned when requiring an ES module from a CommonJS file.
1782
+ * When using the `esmExternals` option, this will also apply to external
1783
+ * modules. By default, this plugin will render those imports as namespace
1784
+ * imports i.e.
1785
+ *
1786
+ * ```js
1787
+ * // input
1788
+ * const foo = require('foo');
1789
+ *
1790
+ * // output
1791
+ * import * as foo from 'foo';
1792
+ * ```
1793
+ *
1794
+ * However, there are some situations where this may not be desired.
1795
+ * For these situations, you can change Rollup's behaviour either globally or
1796
+ * per module. To change it globally, set the `requireReturnsDefault` option
1797
+ * to one of the following values:
1798
+ *
1799
+ * - `false`: This is the default, requiring an ES module returns its
1800
+ * namespace. This is the only option that will also add a marker
1801
+ * `__esModule: true` to the namespace to support interop patterns in
1802
+ * CommonJS modules that are transpiled ES modules.
1803
+ * - `"namespace"`: Like `false`, requiring an ES module returns its
1804
+ * namespace, but the plugin does not add the `__esModule` marker and thus
1805
+ * creates more efficient code. For external dependencies when using
1806
+ * `esmExternals: true`, no additional interop code is generated.
1807
+ * - `"auto"`: This is complementary to how `output.exports: "auto"` works in
1808
+ * Rollup: If a module has a default export and no named exports, requiring
1809
+ * that module returns the default export. In all other cases, the namespace
1810
+ * is returned. For external dependencies when using `esmExternals: true`, a
1811
+ * corresponding interop helper is added.
1812
+ * - `"preferred"`: If a module has a default export, requiring that module
1813
+ * always returns the default export, no matter whether additional named
1814
+ * exports exist. This is similar to how previous versions of this plugin
1815
+ * worked. Again for external dependencies when using `esmExternals: true`,
1816
+ * an interop helper is added.
1817
+ * - `true`: This will always try to return the default export on require
1818
+ * without checking if it actually exists. This can throw at build time if
1819
+ * there is no default export. This is how external dependencies are handled
1820
+ * when `esmExternals` is not used. The advantage over the other options is
1821
+ * that, like `false`, this does not add an interop helper for external
1822
+ * dependencies, keeping the code lean.
1823
+ *
1824
+ * To change this for individual modules, you can supply a function for
1825
+ * `requireReturnsDefault` instead. This function will then be called once for
1826
+ * each required ES module or external dependency with the corresponding id
1827
+ * and allows you to return different values for different modules.
1828
+ * @default false
1829
+ */
1830
+ requireReturnsDefault?: boolean | 'auto' | 'preferred' | 'namespace' | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace');
1831
+ /**
1832
+ * @default "auto"
1833
+ */
1834
+ defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto');
1835
+ /**
1836
+ * Some modules contain dynamic `require` calls, or require modules that
1837
+ * contain circular dependencies, which are not handled well by static
1838
+ * imports. Including those modules as `dynamicRequireTargets` will simulate a
1839
+ * CommonJS (NodeJS-like) environment for them with support for dynamic
1840
+ * dependencies. It also enables `strictRequires` for those modules.
1841
+ *
1842
+ * Note: In extreme cases, this feature may result in some paths being
1843
+ * rendered as absolute in the final bundle. The plugin tries to avoid
1844
+ * exposing paths from the local machine, but if you are `dynamicRequirePaths`
1845
+ * with paths that are far away from your project's folder, that may require
1846
+ * replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
1847
+ */
1848
+ dynamicRequireTargets?: string | ReadonlyArray<string>;
1849
+ /**
1850
+ * To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
1851
+ * that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
1852
+ * may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
1853
+ * home directory name. By default, it uses the current working directory.
1854
+ */
1855
+ dynamicRequireRoot?: string;
1856
+ }
1857
+ //#endregion
1858
+ //#region src/types/dynamicImportVars.d.ts
1859
+ interface RollupDynamicImportVarsOptions {
1860
+ /**
1861
+ * Files to include in this plugin (default all).
1862
+ * @default []
1863
+ */
1864
+ include?: string | RegExp | (string | RegExp)[];
1865
+ /**
1866
+ * Files to exclude in this plugin (default none).
1867
+ * @default []
1868
+ */
1869
+ exclude?: string | RegExp | (string | RegExp)[];
1870
+ /**
1871
+ * @deprecated This option is no-op and will be removed in future versions.
1872
+ */
1873
+ warnOnError?: boolean;
1874
+ }
1875
+ //#endregion
1876
+ //#region src/node/plugins/terser.d.ts
1877
+ interface TerserOptions extends TerserMinifyOptions {
1878
+ /**
1879
+ * Vite-specific option to specify the max number of workers to spawn
1880
+ * when minifying files with terser.
1881
+ *
1882
+ * @default number of CPUs minus 1
1883
+ */
1884
+ maxWorkers?: number;
1885
+ }
1886
+ //#endregion
1887
+ //#region src/node/plugins/resolve.d.ts
1888
+ interface EnvironmentResolveOptions {
1889
+ /**
1890
+ * @default ['browser', 'module', 'jsnext:main', 'jsnext']
1891
+ */
1892
+ mainFields?: string[];
1893
+ conditions?: string[];
1894
+ externalConditions?: string[];
1895
+ /**
1896
+ * @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
1897
+ */
1898
+ extensions?: string[];
1899
+ dedupe?: string[];
1900
+ /**
1901
+ * Prevent listed dependencies from being externalized and will get bundled in build.
1902
+ * Only works in server environments for now. Previously this was `ssr.noExternal`.
1903
+ * @experimental
1904
+ */
1905
+ noExternal?: string | RegExp | (string | RegExp)[] | true;
1906
+ /**
1907
+ * Externalize the given dependencies and their transitive dependencies.
1908
+ * Only works in server environments for now. Previously this was `ssr.external`.
1909
+ * @experimental
1910
+ */
1911
+ external?: string[] | true;
1912
+ /**
1913
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
1914
+ */
1915
+ builtins?: (string | RegExp)[];
1916
+ }
1917
+ interface ResolveOptions extends EnvironmentResolveOptions {
1918
+ /**
1919
+ * @default false
1920
+ */
1921
+ preserveSymlinks?: boolean;
1922
+ /**
1923
+ * Enable tsconfig paths resolution
1924
+ *
1925
+ * @default false
1926
+ * @experimental
1927
+ */
1928
+ tsconfigPaths?: boolean;
1929
+ }
1930
+ interface ResolvePluginOptions {
1931
+ root: string;
1932
+ isBuild: boolean;
1933
+ isProduction: boolean;
1934
+ packageCache?: PackageCache;
1935
+ /**
1936
+ * src code mode also attempts the following:
1937
+ * - resolving /xxx as URLs
1938
+ * - resolving bare imports from optimized deps
1939
+ */
1940
+ asSrc?: boolean;
1941
+ tryIndex?: boolean;
1942
+ tryPrefix?: string;
1943
+ preferRelative?: boolean;
1944
+ isRequire?: boolean;
1945
+ scan?: boolean;
1946
+ /**
1947
+ * Enable when `legacy.inconsistentCjsInterop` is true. See that option for more details.
1948
+ */
1949
+ legacyInconsistentCjsInterop?: boolean;
1950
+ }
1951
+ interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {}
1952
+ //#endregion
1953
+ //#region src/node/packages.d.ts
1954
+ /** Cache for package.json resolution and package.json contents */
1955
+ type PackageCache = Map<string, PackageData>;
1956
+ interface PackageData {
1957
+ dir: string;
1958
+ hasSideEffects: (id: string) => boolean | "no-treeshake" | null;
1959
+ setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void;
1960
+ getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined;
1961
+ data: {
1962
+ [field: string]: any;
1963
+ name: string;
1964
+ type: string;
1965
+ version: string;
1966
+ main: string;
1967
+ module: string;
1968
+ browser: string | Record<string, string | false>;
1969
+ exports: string | Record<string, any> | string[];
1970
+ imports: Record<string, any>;
1971
+ dependencies: Record<string, string>;
1972
+ };
1973
+ }
1974
+ //#endregion
1975
+ //#region src/node/plugins/license.d.ts
1976
+ interface LicenseOptions {
1977
+ /**
1978
+ * The output file name of the license file relative to the output directory.
1979
+ * Specify a path that ends with `.json` to output the raw JSON metadata.
1980
+ *
1981
+ * @default '.vite/license.md'
1982
+ */
1983
+ fileName: string;
1984
+ }
1985
+ //#endregion
1986
+ //#region src/node/build.d.ts
1987
+ interface BuildEnvironmentOptions {
1988
+ /**
1989
+ * Compatibility transform target. The transform is performed with esbuild
1990
+ * and the lowest supported target is es2015. Note this only handles
1991
+ * syntax transformation and does not cover polyfills
1992
+ *
1993
+ * Default: 'baseline-widely-available' - transpile targeting browsers that
1994
+ * are included in the Baseline Widely Available on 2026-01-01.
1995
+ * (Chrome 111+, Edge 111+, Firefox 114+, Safari 16.4+).
1996
+ *
1997
+ * Another special value is 'esnext' - which only performs minimal transpiling
1998
+ * (for minification compat).
1999
+ *
2000
+ * For custom targets, see https://esbuild.github.io/api/#target and
2001
+ * https://esbuild.github.io/content-types/#javascript for more details.
2002
+ * @default 'baseline-widely-available'
2003
+ */
2004
+ target?: "baseline-widely-available" | EsbuildTarget | false;
2005
+ /**
2006
+ * whether to inject module preload polyfill.
2007
+ * Note: does not apply to library mode.
2008
+ * @default true
2009
+ * @deprecated use `modulePreload.polyfill` instead
2010
+ */
2011
+ polyfillModulePreload?: boolean;
2012
+ /**
2013
+ * Configure module preload
2014
+ * Note: does not apply to library mode.
2015
+ * @default true
2016
+ */
2017
+ modulePreload?: boolean | ModulePreloadOptions;
2018
+ /**
2019
+ * Directory relative from `root` where build output will be placed. If the
2020
+ * directory exists, it will be removed before the build.
2021
+ * @default 'dist'
2022
+ */
2023
+ outDir?: string;
2024
+ /**
2025
+ * Directory relative from `outDir` where the built js/css/image assets will
2026
+ * be placed.
2027
+ * @default 'assets'
2028
+ */
2029
+ assetsDir?: string;
2030
+ /**
2031
+ * Static asset files smaller than this number (in bytes) will be inlined as
2032
+ * base64 strings. If a callback is passed, a boolean can be returned to opt-in
2033
+ * or opt-out of inlining. If nothing is returned the default logic applies.
2034
+ *
2035
+ * Default limit is `4096` (4 KiB). Set to `0` to disable.
2036
+ * @default 4096
2037
+ */
2038
+ assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined);
2039
+ /**
2040
+ * Whether to code-split CSS. When enabled, CSS in async chunks will be
2041
+ * inlined as strings in the chunk and inserted via dynamically created
2042
+ * style tags when the chunk is loaded.
2043
+ * @default true
2044
+ */
2045
+ cssCodeSplit?: boolean;
2046
+ /**
2047
+ * An optional separate target for CSS minification.
2048
+ * As esbuild only supports configuring targets to mainstream
2049
+ * browsers, users may need this option when they are targeting
2050
+ * a niche browser that comes with most modern JavaScript features
2051
+ * but has poor CSS support, e.g. Android WeChat WebView, which
2052
+ * doesn't support the #RGBA syntax.
2053
+ * @default target
2054
+ */
2055
+ cssTarget?: EsbuildTarget | false;
2056
+ /**
2057
+ * Override CSS minification specifically instead of defaulting to `build.minify`,
2058
+ * so you can configure minification for JS and CSS separately.
2059
+ * @default 'lightningcss'
2060
+ */
2061
+ cssMinify?: boolean | "lightningcss" | "esbuild";
2062
+ /**
2063
+ * If `true`, a separate sourcemap file will be created. If 'inline', the
2064
+ * sourcemap will be appended to the resulting output file as data URI.
2065
+ * 'hidden' works like `true` except that the corresponding sourcemap
2066
+ * comments in the bundled files are suppressed.
2067
+ * @default false
2068
+ */
2069
+ sourcemap?: boolean | "inline" | "hidden";
2070
+ /**
2071
+ * Set to `false` to disable minification, or specify the minifier to use.
2072
+ * Available options are 'oxc' or 'terser' or 'esbuild'.
2073
+ * @default 'oxc'
2074
+ */
2075
+ minify?: boolean | "oxc" | "terser" | "esbuild";
2076
+ /**
2077
+ * Options for terser
2078
+ * https://terser.org/docs/api-reference#minify-options
2079
+ *
2080
+ * In addition, you can also pass a `maxWorkers: number` option to specify the
2081
+ * max number of workers to spawn. Defaults to the number of CPUs minus 1.
2082
+ */
2083
+ terserOptions?: TerserOptions;
2084
+ /**
2085
+ * Alias to `rolldownOptions`
2086
+ * @deprecated Use `rolldownOptions` instead.
2087
+ */
2088
+ rollupOptions?: RolldownOptions;
2089
+ /**
2090
+ * Will be merged with internal rolldown options.
2091
+ * https://rolldown.rs/reference/config-options
2092
+ */
2093
+ rolldownOptions?: RolldownOptions;
2094
+ /**
2095
+ * Options to pass on to `@rollup/plugin-commonjs`
2096
+ * @deprecated This option is no-op and will be removed in future versions.
2097
+ */
2098
+ commonjsOptions?: RollupCommonJSOptions;
2099
+ /**
2100
+ * Options to pass on to `@rollup/plugin-dynamic-import-vars`
2101
+ */
2102
+ dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
2103
+ /**
2104
+ * Whether to write bundle to disk
2105
+ * @default true
2106
+ */
2107
+ write?: boolean;
2108
+ /**
2109
+ * Empty outDir on write.
2110
+ * @default true when outDir is a sub directory of project root
2111
+ */
2112
+ emptyOutDir?: boolean | null;
2113
+ /**
2114
+ * Copy the public directory to outDir on write.
2115
+ * @default true
2116
+ */
2117
+ copyPublicDir?: boolean;
2118
+ /**
2119
+ * Whether to emit a `.vite/license.md` file that includes all bundled dependencies'
2120
+ * licenses. Pass an object to customize the output file name.
2121
+ * @default false
2122
+ */
2123
+ license?: boolean | LicenseOptions;
2124
+ /**
2125
+ * Whether to emit a .vite/manifest.json in the output dir to map hash-less filenames
2126
+ * to their hashed versions. Useful when you want to generate your own HTML
2127
+ * instead of using the one generated by Vite.
2128
+ *
2129
+ * Example:
2130
+ *
2131
+ * ```json
2132
+ * {
2133
+ * "main.js": {
2134
+ * "file": "main.68fe3fad.js",
2135
+ * "css": "main.e6b63442.css",
2136
+ * "imports": [...],
2137
+ * "dynamicImports": [...]
2138
+ * }
2139
+ * }
2140
+ * ```
2141
+ * @default false
2142
+ */
2143
+ manifest?: boolean | string;
2144
+ /**
2145
+ * Build in library mode. The value should be the global name of the lib in
2146
+ * UMD mode. This will produce esm + cjs + umd bundle formats with default
2147
+ * configurations that are suitable for distributing libraries.
2148
+ * @default false
2149
+ */
2150
+ lib?: LibraryOptions | false;
2151
+ /**
2152
+ * Produce SSR oriented build. Note this requires specifying SSR entry via
2153
+ * `rollupOptions.input`.
2154
+ * @default false
2155
+ */
2156
+ ssr?: boolean | string;
2157
+ /**
2158
+ * Generate SSR manifest for determining style links and asset preload
2159
+ * directives in production.
2160
+ * @default false
2161
+ */
2162
+ ssrManifest?: boolean | string;
2163
+ /**
2164
+ * Emit assets during SSR.
2165
+ * @default false
2166
+ */
2167
+ ssrEmitAssets?: boolean;
2168
+ /**
2169
+ * Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
2170
+ * By default, it is true for the client and false for other environments.
2171
+ */
2172
+ emitAssets?: boolean;
2173
+ /**
2174
+ * Set to false to disable reporting compressed chunk sizes.
2175
+ * Can slightly improve build speed.
2176
+ * @default true
2177
+ */
2178
+ reportCompressedSize?: boolean;
2179
+ /**
2180
+ * Adjust chunk size warning limit (in kB).
2181
+ * @default 500
2182
+ */
2183
+ chunkSizeWarningLimit?: number;
2184
+ /**
2185
+ * Rollup watch options
2186
+ * https://rollupjs.org/configuration-options/#watch
2187
+ * @default null
2188
+ */
2189
+ watch?: WatcherOptions | null;
2190
+ /**
2191
+ * create the Build Environment instance
2192
+ */
2193
+ createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
2194
+ }
2195
+ type BuildOptions = BuildEnvironmentOptions;
2196
+ interface LibraryOptions {
2197
+ /**
2198
+ * Path of library entry
2199
+ */
2200
+ entry: InputOption;
2201
+ /**
2202
+ * The name of the exposed global variable. Required when the `formats` option includes
2203
+ * `umd` or `iife`
2204
+ */
2205
+ name?: string;
2206
+ /**
2207
+ * Output bundle formats
2208
+ * @default ['es', 'umd']
2209
+ */
2210
+ formats?: LibraryFormats[];
2211
+ /**
2212
+ * The name of the package file output. The default file name is the name option
2213
+ * of the project package.json. It can also be defined as a function taking the
2214
+ * format as an argument.
2215
+ */
2216
+ fileName?: string | ((format: ModuleFormat, entryName: string) => string);
2217
+ /**
2218
+ * The name of the CSS file output if the library imports CSS. Defaults to the
2219
+ * same value as `build.lib.fileName` if it's set a string, otherwise it falls
2220
+ * back to the name option of the project package.json.
2221
+ */
2222
+ cssFileName?: string;
2223
+ }
2224
+ type LibraryFormats = "es" | "cjs" | "umd" | "iife";
2225
+ interface ModulePreloadOptions {
2226
+ /**
2227
+ * Whether to inject a module preload polyfill.
2228
+ * Note: does not apply to library mode.
2229
+ * @default true
2230
+ */
2231
+ polyfill?: boolean;
2232
+ /**
2233
+ * Resolve the list of dependencies to preload for a given dynamic import
2234
+ * @experimental
2235
+ */
2236
+ resolveDependencies?: ResolveModulePreloadDependenciesFn;
2237
+ }
2238
+ interface ResolvedModulePreloadOptions {
2239
+ polyfill: boolean;
2240
+ resolveDependencies?: ResolveModulePreloadDependenciesFn;
2241
+ }
2242
+ type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
2243
+ hostId: string;
2244
+ hostType: "html" | "js";
2245
+ }) => string[];
2246
+ interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions, "polyfillModulePreload">> {
2247
+ modulePreload: false | ResolvedModulePreloadOptions;
2248
+ }
2249
+ interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModulePreload">> {
2250
+ modulePreload: false | ResolvedModulePreloadOptions;
2251
+ }
2252
+ /**
2253
+ * Bundles a single environment for production.
2254
+ * Returns a Promise containing the build result.
2255
+ */
2256
+ declare function build(inlineConfig?: InlineConfig): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
2257
+ type RenderBuiltAssetUrl = (filename: string, type: {
2258
+ type: "asset" | "public";
2259
+ hostId: string;
2260
+ hostType: "js" | "css" | "html";
2261
+ ssr: boolean;
2262
+ }) => string | {
2263
+ relative?: boolean;
2264
+ runtime?: string;
2265
+ } | undefined;
2266
+ declare class BuildEnvironment extends BaseEnvironment {
2267
+ mode: "build";
2268
+ isBuilt: boolean;
2269
+ constructor(name: string, config: ResolvedConfig, setup?: {
2270
+ options?: EnvironmentOptions;
2271
+ });
2272
+ init(): Promise<void>;
2273
+ }
2274
+ interface ViteBuilder {
2275
+ environments: Record<string, BuildEnvironment>;
2276
+ config: ResolvedConfig;
2277
+ buildApp(): Promise<void>;
2278
+ build(environment: BuildEnvironment): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
2279
+ runDevTools(): Promise<void>;
2280
+ }
2281
+ interface BuilderOptions {
2282
+ /**
2283
+ * Whether to share the config instance among environments to align with the behavior of dev server.
2284
+ *
2285
+ * @default false
2286
+ * @experimental
2287
+ */
2288
+ sharedConfigBuild?: boolean;
2289
+ /**
2290
+ * Whether to share the plugin instances among environments to align with the behavior of dev server.
2291
+ *
2292
+ * @default false
2293
+ * @experimental
2294
+ */
2295
+ sharedPlugins?: boolean;
2296
+ buildApp?: (builder: ViteBuilder) => Promise<void>;
2297
+ }
2298
+ type ResolvedBuilderOptions = Required<BuilderOptions>;
2299
+ /**
2300
+ * Creates a ViteBuilder to orchestrate building multiple environments.
2301
+ * @experimental
2302
+ */
2303
+ declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>;
2304
+ type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>;
2305
+ //#endregion
2306
+ //#region src/node/environment.d.ts
2307
+ type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment;
2308
+ /**
2309
+ * Creates a function that hides the complexities of a WeakMap with an initial value
2310
+ * to implement object metadata. Used by plugins to implement cross hooks per
2311
+ * environment metadata
2312
+ *
2313
+ * @experimental
2314
+ */
2315
+ declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State;
2316
+ //#endregion
2317
+ //#region src/node/server/pluginContainer.d.ts
2318
+ type SkipInformation = {
2319
+ id: string;
2320
+ importer: string | undefined;
2321
+ plugin: Plugin;
2322
+ called?: boolean;
2323
+ };
2324
+ declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
2325
+ private _pluginContextMap;
2326
+ private _resolvedRollupOptions?;
2327
+ private _processesing;
2328
+ private _seenResolves;
2329
+ private _moduleNodeToLoadAddedImports;
2330
+ getSortedPluginHooks: PluginHookUtils["getSortedPluginHooks"];
2331
+ getSortedPlugins: PluginHookUtils["getSortedPlugins"];
2332
+ moduleGraph: EnvironmentModuleGraph | undefined;
2333
+ watchFiles: Set<string>;
2334
+ minimalContext: MinimalPluginContext$1<Env>;
2335
+ private _started;
2336
+ private _buildStartPromise;
2337
+ private _closed;
2338
+ private _updateModuleLoadAddedImports;
2339
+ private _getAddedImports;
2340
+ getModuleInfo(id: string): ModuleInfo | null;
2341
+ private handleHookPromise;
2342
+ get options(): InputOptions;
2343
+ resolveRollupOptions(): Promise<InputOptions>;
2344
+ private _getPluginContext;
2345
+ private hookParallel;
2346
+ buildStart(_options?: InputOptions): Promise<void>;
2347
+ resolveId(rawId: string, importer?: string | undefined, options?: {
2348
+ kind?: ImportKind;
2349
+ attributes?: Record<string, string>;
2350
+ custom?: CustomPluginOptions; /** @deprecated use `skipCalls` instead */
2351
+ skip?: Set<Plugin>;
2352
+ skipCalls?: readonly SkipInformation[];
2353
+
2354
+ isEntry?: boolean;
2355
+ }): Promise<PartialResolvedId | null>;
2356
+ load(id: string): Promise<LoadResult | null>;
2357
+ transform(code: string, id: string, options?: {
2358
+ inMap?: SourceDescription["map"];
2359
+ moduleType?: string;
2360
+ }): Promise<{
2361
+ code: string;
2362
+ map: SourceMap | {
2363
+ mappings: "";
2364
+ } | null;
2365
+ moduleType?: ModuleType;
2366
+ }>;
2367
+ watchChange(id: string, change: {
2368
+ event: "create" | "update" | "delete";
2369
+ }): Promise<void>;
2370
+ close(): Promise<void>;
2371
+ }
2372
+ declare class BasicMinimalPluginContext<Meta = PluginContextMeta> {
2373
+ meta: Meta;
2374
+ private _logger;
2375
+ constructor(meta: Meta, _logger: Logger);
2376
+ get pluginName(): string;
2377
+ debug(rawLog: string | RollupLog | (() => string | RollupLog)): void;
2378
+ info(rawLog: string | RollupLog | (() => string | RollupLog)): void;
2379
+ warn(rawLog: string | RollupLog | (() => string | RollupLog)): void;
2380
+ error(e: string | RollupError): never;
2381
+ private _normalizeRawLog;
2382
+ }
2383
+ declare class MinimalPluginContext$1<T extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext {
2384
+ environment: T;
2385
+ constructor(meta: PluginContextMeta, environment: T);
2386
+ }
2387
+ declare class PluginContainer {
2388
+ private environments;
2389
+ constructor(environments: Record<string, Environment>);
2390
+ private _getEnvironment;
2391
+ private _getPluginContainer;
2392
+ getModuleInfo(id: string): ModuleInfo | null;
2393
+ get options(): InputOptions;
2394
+ buildStart(_options?: InputOptions): Promise<void>;
2395
+ watchChange(id: string, change: {
2396
+ event: "create" | "update" | "delete";
2397
+ }): Promise<void>;
2398
+ resolveId(rawId: string, importer?: string, options?: {
2399
+ attributes?: Record<string, string>;
2400
+ custom?: CustomPluginOptions; /** @deprecated use `skipCalls` instead */
2401
+ skip?: Set<Plugin>;
2402
+ skipCalls?: readonly SkipInformation[];
2403
+ ssr?: boolean;
2404
+
2405
+ isEntry?: boolean;
2406
+ }): Promise<PartialResolvedId | null>;
2407
+ load(id: string, options?: {
2408
+ ssr?: boolean;
2409
+ }): Promise<LoadResult | null>;
2410
+ transform(code: string, id: string, options?: {
2411
+ ssr?: boolean;
2412
+ environment?: Environment;
2413
+ inMap?: SourceDescription["map"];
2414
+ }): Promise<{
2415
+ code: string;
2416
+ map: SourceMap | {
2417
+ mappings: "";
2418
+ } | null;
2419
+ }>;
2420
+ close(): Promise<void>;
2421
+ }
2422
+ /**
2423
+ * server.pluginContainer compatibility
2424
+ *
2425
+ * The default environment is in buildStart, buildEnd, watchChange, and closeBundle hooks,
2426
+ * which are called once for all environments, or when no environment is passed in other hooks.
2427
+ * The ssrEnvironment is needed for backward compatibility when the ssr flag is passed without
2428
+ * an environment. The defaultEnvironment in the main pluginContainer in the server should be
2429
+ * the client environment for backward compatibility.
2430
+ **/
2431
+ //#endregion
2432
+ //#region src/node/server/index.d.ts
2433
+ interface ServerOptions$1 extends CommonServerOptions {
2434
+ /**
2435
+ * Configure HMR-specific options (port, host, path & protocol)
2436
+ */
2437
+ hmr?: HmrOptions | boolean;
2438
+ /**
2439
+ * Do not start the websocket connection.
2440
+ * @experimental
2441
+ */
2442
+ ws?: false;
2443
+ /**
2444
+ * Warm-up files to transform and cache the results in advance. This improves the
2445
+ * initial page load during server starts and prevents transform waterfalls.
2446
+ */
2447
+ warmup?: {
2448
+ /**
2449
+ * The files to be transformed and used on the client-side. Supports glob patterns.
2450
+ */
2451
+ clientFiles?: string[];
2452
+ /**
2453
+ * The files to be transformed and used in SSR. Supports glob patterns.
2454
+ */
2455
+ ssrFiles?: string[];
2456
+ };
2457
+ /**
2458
+ * chokidar watch options or null to disable FS watching
2459
+ * https://github.com/paulmillr/chokidar/tree/3.6.0#api
2460
+ */
2461
+ watch?: WatchOptions | null;
2462
+ /**
2463
+ * Create Vite dev server to be used as a middleware in an existing server
2464
+ * @default false
2465
+ */
2466
+ middlewareMode?: boolean | {
2467
+ /**
2468
+ * Parent server instance to attach to
2469
+ *
2470
+ * This is needed to proxy WebSocket connections to the parent server.
2471
+ */
2472
+ server: HttpServer;
2473
+ };
2474
+ /**
2475
+ * Options for files served via '/\@fs/'.
2476
+ */
2477
+ fs?: FileSystemServeOptions;
2478
+ /**
2479
+ * Origin for the generated asset URLs.
2480
+ *
2481
+ * @example `http://127.0.0.1:8080`
2482
+ */
2483
+ origin?: string;
2484
+ /**
2485
+ * Pre-transform known direct imports
2486
+ * @default true
2487
+ */
2488
+ preTransformRequests?: boolean;
2489
+ /**
2490
+ * Whether or not to ignore-list source files in the dev server sourcemap, used to populate
2491
+ * the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
2492
+ *
2493
+ * By default, it excludes all paths containing `node_modules`. You can pass `false` to
2494
+ * disable this behavior, or, for full control, a function that takes the source path and
2495
+ * sourcemap path and returns whether to ignore the source path.
2496
+ */
2497
+ sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
2498
+ /**
2499
+ * Backward compatibility. The buildStart and buildEnd hooks were called only once for
2500
+ * the client environment. This option enables per-environment buildStart and buildEnd hooks.
2501
+ * @default false
2502
+ * @experimental
2503
+ */
2504
+ perEnvironmentStartEndDuringDev?: boolean;
2505
+ /**
2506
+ * Backward compatibility. The watchChange hook was called only once for the client environment.
2507
+ * This option enables per-environment watchChange hooks.
2508
+ * @default false
2509
+ * @experimental
2510
+ */
2511
+ perEnvironmentWatchChangeDuringDev?: boolean;
2512
+ /**
2513
+ * Run HMR tasks, by default the HMR propagation is done in parallel for all environments
2514
+ * @experimental
2515
+ */
2516
+ hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
2517
+ forwardConsole?: boolean | ForwardConsoleOptions;
2518
+ }
2519
+ interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList" | "forwardConsole"> {
2520
+ fs: Required<FileSystemServeOptions>;
2521
+ middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>;
2522
+ sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>;
2523
+ forwardConsole: ResolvedForwardConsoleOptions;
2524
+ }
2525
+ interface FileSystemServeOptions {
2526
+ /**
2527
+ * Strictly restrict file accessing outside of allowing paths.
2528
+ *
2529
+ * Set to `false` to disable the warning
2530
+ *
2531
+ * @default true
2532
+ */
2533
+ strict?: boolean;
2534
+ /**
2535
+ * Restrict accessing files outside the allowed directories.
2536
+ *
2537
+ * Accepts absolute path or a path relative to project root.
2538
+ * Will try to search up for workspace root by default.
2539
+ */
2540
+ allow?: string[];
2541
+ /**
2542
+ * Restrict accessing files that matches the patterns.
2543
+ *
2544
+ * This will have higher priority than `allow`.
2545
+ * picomatch patterns are supported.
2546
+ *
2547
+ * @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
2548
+ */
2549
+ deny?: string[];
2550
+ }
2551
+ type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
2552
+ type HttpServer = http.Server | Http2SecureServer;
2553
+ interface ViteDevServer {
2554
+ /**
2555
+ * The resolved vite config object
2556
+ */
2557
+ config: ResolvedConfig;
2558
+ /**
2559
+ * A connect app instance.
2560
+ * - Can be used to attach custom middlewares to the dev server.
2561
+ * - Can also be used as the handler function of a custom http server
2562
+ * or as a middleware in any connect-style Node.js frameworks
2563
+ *
2564
+ * https://github.com/senchalabs/connect#use-middleware
2565
+ */
2566
+ middlewares: Connect.Server;
2567
+ /**
2568
+ * native Node http server instance
2569
+ * will be null in middleware mode
2570
+ */
2571
+ httpServer: HttpServer | null;
2572
+ /**
2573
+ * Chokidar watcher instance. If `config.server.watch` is set to `null`,
2574
+ * it will not watch any files and calling `add` or `unwatch` will have no effect.
2575
+ * https://github.com/paulmillr/chokidar/tree/3.6.0#api
2576
+ */
2577
+ watcher: FSWatcher;
2578
+ /**
2579
+ * WebSocket server with `send(payload)` method
2580
+ */
2581
+ ws: WebSocketServer;
2582
+ /**
2583
+ * An alias to `server.environments.client.hot`.
2584
+ * If you want to interact with all environments, loop over `server.environments`.
2585
+ */
2586
+ hot: NormalizedHotChannel;
2587
+ /**
2588
+ * Rollup plugin container that can run plugin hooks on a given file
2589
+ */
2590
+ pluginContainer: PluginContainer;
2591
+ /**
2592
+ * Module execution environments attached to the Vite server.
2593
+ */
2594
+ environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>;
2595
+ /**
2596
+ * Module graph that tracks the import relationships, url to file mapping
2597
+ * and hmr state.
2598
+ */
2599
+ moduleGraph: ModuleGraph;
2600
+ /**
2601
+ * The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
2602
+ * in middleware mode or if the server is not listening on any port.
2603
+ */
2604
+ resolvedUrls: ResolvedServerUrls | null;
2605
+ /**
2606
+ * Programmatically resolve, load and transform a URL and get the result
2607
+ * without going through the http request pipeline.
2608
+ */
2609
+ transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
2610
+ /**
2611
+ * Same as `transformRequest` but only warm up the URLs so the next request
2612
+ * will already be cached. The function will never throw as it handles and
2613
+ * reports errors internally.
2614
+ */
2615
+ warmupRequest(url: string, options?: TransformOptions): Promise<void>;
2616
+ /**
2617
+ * Apply vite built-in HTML transforms and any plugin HTML transforms.
2618
+ */
2619
+ transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
2620
+ /**
2621
+ * Transform module code into SSR format.
2622
+ */
2623
+ ssrTransform(code: string, inMap: SourceMap | {
2624
+ mappings: "";
2625
+ } | null, url: string, originalCode?: string): Promise<TransformResult | null>;
2626
+ /**
2627
+ * Load a given URL as an instantiated module for SSR.
2628
+ */
2629
+ ssrLoadModule(url: string, opts?: {
2630
+ fixStacktrace?: boolean;
2631
+ }): Promise<Record<string, any>>;
2632
+ /**
2633
+ * Returns a fixed version of the given stack
2634
+ */
2635
+ ssrRewriteStacktrace(stack: string): string;
2636
+ /**
2637
+ * Mutates the given SSR error by rewriting the stacktrace
2638
+ */
2639
+ ssrFixStacktrace(e: Error): void;
2640
+ /**
2641
+ * Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
2642
+ * API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
2643
+ */
2644
+ reloadModule(module: ModuleNode): Promise<void>;
2645
+ /**
2646
+ * Start the server.
2647
+ */
2648
+ listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
2649
+ /**
2650
+ * Stop the server.
2651
+ */
2652
+ close(): Promise<void>;
2653
+ /**
2654
+ * Print server urls
2655
+ */
2656
+ printUrls(): void;
2657
+ /**
2658
+ * Bind CLI shortcuts
2659
+ */
2660
+ bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
2661
+ /**
2662
+ * Restart the server.
2663
+ *
2664
+ * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
2665
+ */
2666
+ restart(forceOptimize?: boolean): Promise<void>;
2667
+ /**
2668
+ * Open browser
2669
+ */
2670
+ openBrowser(): void;
2671
+ /**
2672
+ * Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
2673
+ * are processed. If called from a load or transform plugin hook, the id needs to be
2674
+ * passed as a parameter to avoid deadlocks. Calling this function after the first
2675
+ * static imports section of the module graph has been processed will resolve immediately.
2676
+ */
2677
+ waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
2678
+ }
2679
+ interface ResolvedServerUrls {
2680
+ local: string[];
2681
+ network: string[];
2682
+ }
2683
+ declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Promise<ViteDevServer>;
2684
+ //#endregion
2685
+ //#region src/node/plugins/html.d.ts
2686
+ interface HtmlTagDescriptor {
2687
+ tag: string;
2688
+ /**
2689
+ * attribute values will be escaped automatically if needed
2690
+ */
2691
+ attrs?: Record<string, string | boolean | undefined>;
2692
+ children?: string | HtmlTagDescriptor[];
2693
+ /**
2694
+ * default: 'head-prepend'
2695
+ */
2696
+ injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
2697
+ }
2698
+ type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
2699
+ html: string;
2700
+ tags: HtmlTagDescriptor[];
2701
+ };
2702
+ interface IndexHtmlTransformContext {
2703
+ /**
2704
+ * public path when served
2705
+ */
2706
+ path: string;
2707
+ /**
2708
+ * filename on disk
2709
+ */
2710
+ filename: string;
2711
+ server?: ViteDevServer;
2712
+ bundle?: OutputBundle;
2713
+ chunk?: OutputChunk;
2714
+ originalUrl?: string;
2715
+ }
2716
+ type IndexHtmlTransformHook = (this: MinimalPluginContextWithoutEnvironment, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
2717
+ type IndexHtmlTransform = IndexHtmlTransformHook | {
2718
+ order?: "pre" | "post" | null;
2719
+ handler: IndexHtmlTransformHook;
2720
+ };
2721
+ //#endregion
2722
+ //#region src/node/plugins/pluginFilter.d.ts
2723
+ type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
2724
+ include?: Value | Array<Value>;
2725
+ exclude?: Value | Array<Value>;
2726
+ };
2727
+ //#endregion
2728
+ //#region src/node/plugin.d.ts
2729
+ /**
2730
+ * Vite plugins extends the Rollup plugin interface with a few extra
2731
+ * vite-specific options. A valid vite plugin is also a valid Rollup plugin.
2732
+ * On the contrary, a Rollup plugin may or may NOT be a valid vite universal
2733
+ * plugin, since some Rollup features do not make sense in an unbundled
2734
+ * dev server context. That said, as long as a rollup plugin doesn't have strong
2735
+ * coupling between its bundle phase and output phase hooks then it should
2736
+ * just work (that means, most of them).
2737
+ *
2738
+ * By default, the plugins are run during both serve and build. When a plugin
2739
+ * is applied during serve, it will only run **non output plugin hooks** (see
2740
+ * rollup type definition of {@link rollup#PluginHooks}). You can think of the
2741
+ * dev server as only running `const bundle = rollup.rollup()` but never calling
2742
+ * `bundle.generate()`.
2743
+ *
2744
+ * A plugin that expects to have different behavior depending on serve/build can
2745
+ * export a factory function that receives the command being run via options.
2746
+ *
2747
+ * If a plugin should be applied only for server or build, a function format
2748
+ * config file can be used to conditional determine the plugins to use.
2749
+ *
2750
+ * The current environment can be accessed from the context for the all non-global
2751
+ * hooks (it is not available in config, configResolved, configureServer, etc).
2752
+ * It can be a dev, build, or scan environment.
2753
+ * Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
2754
+ */
2755
+ interface PluginContextExtension {
2756
+ /**
2757
+ * Vite-specific environment instance
2758
+ */
2759
+ environment: Environment;
2760
+ }
2761
+ interface PluginContextMetaExtension {
2762
+ viteVersion: string;
2763
+ }
2764
+ interface ConfigPluginContext extends Omit<MinimalPluginContext, "meta" | "environment"> {
2765
+ meta: Omit<PluginContextMeta, "watchMode">;
2766
+ }
2767
+ interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext, "environment"> {}
2768
+ declare module "rolldown" {
2769
+ interface MinimalPluginContext extends PluginContextExtension {}
2770
+ interface PluginContextMeta extends PluginContextMetaExtension {}
2771
+ }
2772
+ /**
2773
+ * There are two types of plugins in Vite. App plugins and environment plugins.
2774
+ * Environment Plugins are defined by a constructor function that will be called
2775
+ * once per each environment allowing users to have completely different plugins
2776
+ * for each of them. The constructor gets the resolved environment after the server
2777
+ * and builder has already been created simplifying config access and cache
2778
+ * management for environment specific plugins.
2779
+ * Environment Plugins are closer to regular rollup plugins. They can't define
2780
+ * app level hooks (like config, configResolved, configureServer, etc).
2781
+ */
2782
+ interface Plugin<A = any> extends Rolldown.Plugin<A> {
2783
+ /**
2784
+ * Perform custom handling of HMR updates.
2785
+ * The handler receives an options containing changed filename, timestamp, a
2786
+ * list of modules affected by the file change, and the dev server instance.
2787
+ *
2788
+ * - The hook can return a filtered list of modules to narrow down the update.
2789
+ * e.g. for a Vue SFC, we can narrow down the part to update by comparing
2790
+ * the descriptors.
2791
+ *
2792
+ * - The hook can also return an empty array and then perform custom updates
2793
+ * by sending a custom hmr payload via environment.hot.send().
2794
+ *
2795
+ * - If the hook doesn't return a value, the hmr update will be performed as
2796
+ * normal.
2797
+ */
2798
+ hotUpdate?: ObjectHook<(this: MinimalPluginContext & {
2799
+ environment: DevEnvironment;
2800
+ }, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
2801
+ /**
2802
+ * extend hooks with ssr flag
2803
+ */
2804
+ resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
2805
+ kind?: ImportKind;
2806
+ custom?: CustomPluginOptions;
2807
+ ssr?: boolean | undefined;
2808
+
2809
+ isEntry: boolean;
2810
+ }) => Promise<ResolveIdResult> | ResolveIdResult, {
2811
+ filter?: {
2812
+ id?: StringFilter<RegExp>;
2813
+ };
2814
+ }>;
2815
+ load?: ObjectHook<(this: PluginContext, id: string, options?: {
2816
+ ssr?: boolean | undefined;
2817
+ }) => Promise<LoadResult> | LoadResult, {
2818
+ filter?: {
2819
+ id?: StringFilter;
2820
+ };
2821
+ }>;
2822
+ transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
2823
+ moduleType: ModuleType;
2824
+ ssr?: boolean | undefined;
2825
+ }) => Promise<Rolldown.TransformResult> | Rolldown.TransformResult, {
2826
+ filter?: {
2827
+ id?: StringFilter;
2828
+ code?: StringFilter;
2829
+ moduleType?: ModuleTypeFilter;
2830
+ };
2831
+ }>;
2832
+ /**
2833
+ * Opt-in this plugin into the shared plugins pipeline.
2834
+ * For backward-compatibility, plugins are re-recreated for each environment
2835
+ * during `vite build --app`
2836
+ * We have an opt-in per plugin, and a general `builder.sharedPlugins`
2837
+ * In a future major, we'll flip the default to be shared by default
2838
+ * @experimental
2839
+ */
2840
+ sharedDuringBuild?: boolean;
2841
+ /**
2842
+ * Opt-in this plugin into per-environment buildStart and buildEnd during dev.
2843
+ * For backward-compatibility, the buildStart hook is called only once during
2844
+ * dev, for the client environment. Plugins can opt-in to be called
2845
+ * per-environment, aligning with the build hook behavior.
2846
+ * @experimental
2847
+ */
2848
+ perEnvironmentStartEndDuringDev?: boolean;
2849
+ /**
2850
+ * Opt-in this plugin into per-environment watchChange during dev.
2851
+ * For backward-compatibility, the watchChange hook is called only once during
2852
+ * dev, for the client environment. Plugins can opt-in to be called
2853
+ * per-environment, aligning with the watchChange hook behavior.
2854
+ * @experimental
2855
+ */
2856
+ perEnvironmentWatchChangeDuringDev?: boolean;
2857
+ /**
2858
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
2859
+ * is still subject to the `order` property in the hook object.
2860
+ *
2861
+ * Plugin invocation order:
2862
+ * - alias resolution
2863
+ * - `enforce: 'pre'` plugins
2864
+ * - vite core plugins
2865
+ * - normal plugins
2866
+ * - vite build plugins
2867
+ * - `enforce: 'post'` plugins
2868
+ * - vite build post plugins
2869
+ */
2870
+ enforce?: "pre" | "post";
2871
+ /**
2872
+ * Apply the plugin only for serve or build, or on certain conditions.
2873
+ */
2874
+ apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
2875
+ /**
2876
+ * Define environments where this plugin should be active
2877
+ * By default, the plugin is active in all environments
2878
+ * @experimental
2879
+ */
2880
+ applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption;
2881
+ /**
2882
+ * Modify vite config before it's resolved. The hook can either mutate the
2883
+ * passed-in config directly, or return a partial config object that will be
2884
+ * deeply merged into existing config.
2885
+ *
2886
+ * Note: User plugins are resolved before running this hook so injecting other
2887
+ * plugins inside the `config` hook will have no effect.
2888
+ */
2889
+ config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>;
2890
+ /**
2891
+ * Modify environment configs before it's resolved. The hook can either mutate the
2892
+ * passed-in environment config directly, or return a partial config object that will be
2893
+ * deeply merged into existing config.
2894
+ * This hook is called for each environment with a partially resolved environment config
2895
+ * that already accounts for the default environment config values set at the root level.
2896
+ * If plugins need to modify the config of a given environment, they should do it in this
2897
+ * hook instead of the config hook. Leaving the config hook only for modifying the root
2898
+ * default environment config.
2899
+ */
2900
+ configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & {
2901
+ /**
2902
+ * Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
2903
+ * Only intended to be used for backward compatibility.
2904
+ */
2905
+ isSsrTargetWebworker?: boolean;
2906
+ }) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
2907
+ /**
2908
+ * Use this hook to read and store the final resolved vite config.
2909
+ */
2910
+ configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>;
2911
+ /**
2912
+ * Configure the vite server. The hook receives the {@link ViteDevServer}
2913
+ * instance. This can also be used to store a reference to the server
2914
+ * for use in other hooks.
2915
+ *
2916
+ * The hooks will be called before internal middlewares are applied. A hook
2917
+ * can return a post hook that will be called after internal middlewares
2918
+ * are applied. Hook can be async functions and will be called in series.
2919
+ */
2920
+ configureServer?: ObjectHook<ServerHook>;
2921
+ /**
2922
+ * Configure the preview server. The hook receives the {@link PreviewServer}
2923
+ * instance. This can also be used to store a reference to the server
2924
+ * for use in other hooks.
2925
+ *
2926
+ * The hooks are called before other middlewares are applied. A hook can
2927
+ * return a post hook that will be called after other middlewares are
2928
+ * applied. Hooks can be async functions and will be called in series.
2929
+ */
2930
+ configurePreviewServer?: ObjectHook<PreviewServerHook>;
2931
+ /**
2932
+ * Transform index.html.
2933
+ * The hook receives the following arguments:
2934
+ *
2935
+ * - html: string
2936
+ * - ctx: IndexHtmlTransformContext, which contains:
2937
+ * - path: public path when served
2938
+ * - filename: filename on disk
2939
+ * - server?: ViteDevServer (only present during serve)
2940
+ * - bundle?: rollup.OutputBundle (only present during build)
2941
+ * - chunk?: rollup.OutputChunk
2942
+ * - originalUrl?: string
2943
+ *
2944
+ * It can either return a transformed string, or a list of html tag
2945
+ * descriptors that will be injected into the `<head>` or `<body>`.
2946
+ *
2947
+ * By default the transform is applied **after** vite's internal html
2948
+ * transform. If you need to apply the transform before vite, use an object:
2949
+ * `{ order: 'pre', handler: hook }`
2950
+ */
2951
+ transformIndexHtml?: IndexHtmlTransform;
2952
+ /**
2953
+ * Build Environments
2954
+ *
2955
+ * @experimental
2956
+ */
2957
+ buildApp?: ObjectHook<BuildAppHook>;
2958
+ /**
2959
+ * Perform custom handling of HMR updates.
2960
+ * The handler receives a context containing changed filename, timestamp, a
2961
+ * list of modules affected by the file change, and the dev server instance.
2962
+ *
2963
+ * - The hook can return a filtered list of modules to narrow down the update.
2964
+ * e.g. for a Vue SFC, we can narrow down the part to update by comparing
2965
+ * the descriptors.
2966
+ *
2967
+ * - The hook can also return an empty array and then perform custom updates
2968
+ * by sending a custom hmr payload via server.ws.send().
2969
+ *
2970
+ * - If the hook doesn't return a value, the hmr update will be performed as
2971
+ * normal.
2972
+ */
2973
+ handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
2974
+ /**
2975
+ * This hook is not supported by Rolldown yet. But the type is declared for compatibility.
2976
+ *
2977
+ * @deprecated This hook is **not** deprecated. It is marked as deprecated just to make it clear that this hook is currently a no-op.
2978
+ */
2979
+ shouldTransformCachedModule?: ObjectHook<(this: PluginContext, options: {
2980
+ code: string;
2981
+ id: string;
2982
+ meta: CustomPluginOptions;
2983
+ moduleSideEffects: boolean | "no-treeshake";
2984
+ }) => boolean | null | void>;
2985
+ }
2986
+ type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
2987
+ type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]> };
2988
+ type Thenable<T> = T | Promise<T>;
2989
+ type FalsyPlugin = false | null | undefined;
2990
+ type PluginOption = Thenable<Plugin | {
2991
+ name: string;
2992
+ } | FalsyPlugin | PluginOption[]>;
2993
+ /**
2994
+ * @experimental
2995
+ */
2996
+ declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin;
2997
+ //#endregion
2998
+ //#region src/node/plugins/css.d.ts
2999
+ interface CSSOptions {
3000
+ /**
3001
+ * Using lightningcss is an experimental option to handle CSS modules,
3002
+ * assets and imports via Lightning CSS. It requires to install it as a
3003
+ * peer dependency.
3004
+ *
3005
+ * @default 'postcss'
3006
+ * @experimental
3007
+ */
3008
+ transformer?: "postcss" | "lightningcss";
3009
+ /**
3010
+ * https://github.com/css-modules/postcss-modules
3011
+ */
3012
+ modules?: CSSModulesOptions | false;
3013
+ /**
3014
+ * Options for preprocessors.
3015
+ *
3016
+ * In addition to options specific to each processors, Vite supports `additionalData` option.
3017
+ * The `additionalData` option can be used to inject extra code for each style content.
3018
+ */
3019
+ preprocessorOptions?: {
3020
+ scss?: SassPreprocessorOptions;
3021
+ sass?: SassPreprocessorOptions;
3022
+ less?: LessPreprocessorOptions;
3023
+ styl?: StylusPreprocessorOptions;
3024
+ stylus?: StylusPreprocessorOptions;
3025
+ };
3026
+ /**
3027
+ * If this option is set, preprocessors will run in workers when possible.
3028
+ * `true` means the number of CPUs minus 1.
3029
+ *
3030
+ * @default true
3031
+ */
3032
+ preprocessorMaxWorkers?: number | true;
3033
+ postcss?: string | (PostCSS.ProcessOptions & {
3034
+ plugins?: PostCSS.AcceptedPlugin[];
3035
+ });
3036
+ /**
3037
+ * Enables css sourcemaps during dev
3038
+ * @default false
3039
+ * @experimental
3040
+ */
3041
+ devSourcemap?: boolean;
3042
+ /**
3043
+ * @experimental
3044
+ */
3045
+ lightningcss?: lightningcssOptions_LightningCSSOptions;
3046
+ }
3047
+ interface CSSModulesOptions {
3048
+ getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
3049
+ scopeBehaviour?: "global" | "local";
3050
+ globalModulePaths?: RegExp[];
3051
+ exportGlobals?: boolean;
3052
+ generateScopedName?: string | ((name: string, filename: string, css: string) => string);
3053
+ hashPrefix?: string;
3054
+ /**
3055
+ * default: undefined
3056
+ */
3057
+ localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
3058
+ }
3059
+ type ResolvedCSSOptions = Omit<CSSOptions, "lightningcss"> & Required<Pick<CSSOptions, "transformer" | "devSourcemap">> & {
3060
+ lightningcss?: lightningcssOptions_LightningCSSOptions;
3061
+ };
3062
+ interface PreprocessCSSResult {
3063
+ code: string;
3064
+ map?: SourceMapInput;
3065
+ modules?: Record<string, string>;
3066
+ deps?: Set<string>;
3067
+ }
3068
+ /**
3069
+ * @experimental
3070
+ */
3071
+ declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
3072
+ declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
3073
+ type PreprocessorAdditionalDataResult = string | {
3074
+ content: string;
3075
+ map?: ExistingRawSourceMap;
3076
+ };
3077
+ type PreprocessorAdditionalData = string | ((source: string, filename: string) => PreprocessorAdditionalDataResult | Promise<PreprocessorAdditionalDataResult>);
3078
+ type SassPreprocessorOptions = {
3079
+ additionalData?: PreprocessorAdditionalData;
3080
+ } & SassModernPreprocessBaseOptions;
3081
+ type LessPreprocessorOptions = {
3082
+ additionalData?: PreprocessorAdditionalData;
3083
+ } & LessPreprocessorBaseOptions;
3084
+ type StylusPreprocessorOptions = {
3085
+ additionalData?: PreprocessorAdditionalData;
3086
+ } & StylusPreprocessorBaseOptions;
3087
+ //#endregion
3088
+ //#region src/node/plugins/esbuild.d.ts
3089
+ interface ESBuildOptions extends esbuildOptions_EsbuildTransformOptions {
3090
+ include?: string | RegExp | ReadonlyArray<string | RegExp>;
3091
+ exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
3092
+ jsxInject?: string;
3093
+ /**
3094
+ * This option is not respected. Use `build.minify` instead.
3095
+ */
3096
+ minify?: never;
3097
+ }
3098
+ type ESBuildTransformResult = Omit<EsbuildTransformResult, "map"> & {
3099
+ map: SourceMap;
3100
+ };
3101
+ declare function transformWithEsbuild(code: string, filename: string, options?: esbuildOptions_EsbuildTransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher, ignoreEsbuildWarning?: boolean): Promise<ESBuildTransformResult>;
3102
+ //#endregion
3103
+ //#region src/node/plugins/json.d.ts
3104
+ interface JsonOptions {
3105
+ /**
3106
+ * Generate a named export for every property of the JSON object
3107
+ * @default true
3108
+ */
3109
+ namedExports?: boolean;
3110
+ /**
3111
+ * Generate performant output as JSON.parse("stringified").
3112
+ *
3113
+ * When set to 'auto', the data will be stringified only if the data is bigger than 10kB.
3114
+ * @default 'auto'
3115
+ */
3116
+ stringify?: boolean | "auto";
3117
+ }
3118
+ //#endregion
3119
+ //#region src/node/ssr/index.d.ts
3120
+ type SSRTarget = "node" | "webworker";
3121
+ type SsrDepOptimizationConfig = DepOptimizationConfig;
3122
+ interface SSROptions {
3123
+ noExternal?: string | RegExp | (string | RegExp)[] | true;
3124
+ external?: string[] | true;
3125
+ /**
3126
+ * Define the target for the ssr build. The browser field in package.json
3127
+ * is ignored for node but used if webworker is the target
3128
+ * This option will be removed in a future major version
3129
+ * @default 'node'
3130
+ */
3131
+ target?: SSRTarget;
3132
+ /**
3133
+ * Control over which dependencies are optimized during SSR and esbuild options
3134
+ * During build:
3135
+ * no external CJS dependencies are optimized by default
3136
+ * During dev:
3137
+ * explicit no external CJS dependencies are optimized by default
3138
+ * @experimental
3139
+ */
3140
+ optimizeDeps?: SsrDepOptimizationConfig;
3141
+ resolve?: {
3142
+ /**
3143
+ * Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
3144
+ *
3145
+ * Use this to override the default ssr conditions for the ssr build.
3146
+ *
3147
+ * @default rootConfig.resolve.conditions
3148
+ */
3149
+ conditions?: string[];
3150
+ /**
3151
+ * Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
3152
+ *
3153
+ * @default ['node', 'module-sync']
3154
+ */
3155
+ externalConditions?: string[];
3156
+ mainFields?: string[];
3157
+ };
3158
+ }
3159
+ interface ResolvedSSROptions extends SSROptions {
3160
+ target: SSRTarget;
3161
+ optimizeDeps: SsrDepOptimizationConfig;
3162
+ }
3163
+ //#endregion
3164
+ //#region src/node/plugins/oxc.d.ts
3165
+ interface OxcOptions extends Omit<rolldown_utils_TransformOptions, "cwd" | "sourceType" | "lang" | "sourcemap" | "helpers" | "inject" | "tsconfig" | "inputMap"> {
3166
+ include?: string | RegExp | ReadonlyArray<string | RegExp>;
3167
+ exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
3168
+ jsxInject?: string;
3169
+ jsxRefreshInclude?: string | RegExp | ReadonlyArray<string | RegExp>;
3170
+ jsxRefreshExclude?: string | RegExp | ReadonlyArray<string | RegExp>;
3171
+ }
3172
+ declare function transformWithOxc(code: string, filename: string, options?: rolldown_utils_TransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher): Promise<Omit<rolldown_utils_TransformResult, "errors">>;
3173
+ //#endregion
3174
+ //#region src/node/config.d.ts
3175
+ interface ConfigEnv {
3176
+ /**
3177
+ * 'serve': during dev (`vite` command)
3178
+ * 'build': when building for production (`vite build` command)
3179
+ */
3180
+ command: "build" | "serve";
3181
+ mode: string;
3182
+ isSsrBuild?: boolean;
3183
+ isPreview?: boolean;
3184
+ }
3185
+ /**
3186
+ * spa: include SPA fallback middleware and configure sirv with `single: true` in preview
3187
+ *
3188
+ * mpa: only include non-SPA HTML middlewares
3189
+ *
3190
+ * custom: don't include HTML middlewares
3191
+ */
3192
+ type AppType = "spa" | "mpa" | "custom";
3193
+ type UserConfigFnObject = (env: ConfigEnv) => UserConfig;
3194
+ type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
3195
+ type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
3196
+ type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
3197
+ /**
3198
+ * Type helper to make it easier to use vite.config.ts
3199
+ * accepts a direct {@link UserConfig} object, or a function that returns it.
3200
+ * The function receives a {@link ConfigEnv} object.
3201
+ */
3202
+ declare function defineConfig(config: UserConfig): UserConfig;
3203
+ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
3204
+ declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
3205
+ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
3206
+ declare function defineConfig(config: UserConfigFn): UserConfigFn;
3207
+ declare function defineConfig(config: UserConfigExport): UserConfigExport;
3208
+ interface CreateDevEnvironmentContext {
3209
+ ws: WebSocketServer;
3210
+ }
3211
+ interface DevEnvironmentOptions {
3212
+ /**
3213
+ * Files to be pre-transformed. Supports glob patterns.
3214
+ */
3215
+ warmup?: string[];
3216
+ /**
3217
+ * Pre-transform known direct imports
3218
+ * defaults to true for the client environment, false for the rest
3219
+ */
3220
+ preTransformRequests?: boolean;
3221
+ /**
3222
+ * Enables sourcemaps during dev
3223
+ * @default { js: true }
3224
+ * @experimental
3225
+ */
3226
+ sourcemap?: boolean | {
3227
+ js?: boolean;
3228
+ css?: boolean;
3229
+ };
3230
+ /**
3231
+ * Whether or not to ignore-list source files in the dev server sourcemap, used to populate
3232
+ * the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
3233
+ *
3234
+ * By default, it excludes all paths containing `node_modules`. You can pass `false` to
3235
+ * disable this behavior, or, for full control, a function that takes the source path and
3236
+ * sourcemap path and returns whether to ignore the source path.
3237
+ */
3238
+ sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
3239
+ /**
3240
+ * create the Dev Environment instance
3241
+ */
3242
+ createEnvironment?: (name: string, config: ResolvedConfig, context: CreateDevEnvironmentContext) => Promise<DevEnvironment> | DevEnvironment;
3243
+ /**
3244
+ * For environments that support a full-reload, like the client, we can short-circuit when
3245
+ * restarting the server throwing early to stop processing current files. We avoided this for
3246
+ * SSR requests. Maybe this is no longer needed.
3247
+ * @experimental
3248
+ */
3249
+ recoverable?: boolean;
3250
+ /**
3251
+ * For environments associated with a module runner.
3252
+ * By default, it is false for the client environment and true for non-client environments.
3253
+ * This option can also be used instead of the removed config.experimental.skipSsrTransform.
3254
+ */
3255
+ moduleRunnerTransform?: boolean;
3256
+ }
3257
+ type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>, "sourcemapIgnoreList"> & {
3258
+ sourcemapIgnoreList: Exclude<DevEnvironmentOptions["sourcemapIgnoreList"], false | undefined>;
3259
+ };
3260
+ type AllResolveOptions = ResolveOptions & {
3261
+ alias?: AliasOptions;
3262
+ };
3263
+ interface SharedEnvironmentOptions {
3264
+ /**
3265
+ * Define global variable replacements.
3266
+ * Entries will be defined on `window` during dev and replaced during build.
3267
+ */
3268
+ define?: Record<string, any>;
3269
+ /**
3270
+ * Configure resolver
3271
+ */
3272
+ resolve?: EnvironmentResolveOptions;
3273
+ /**
3274
+ * Define if this environment is used for Server-Side Rendering
3275
+ * @default 'server' if it isn't the client environment
3276
+ */
3277
+ consumer?: "client" | "server";
3278
+ /**
3279
+ * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime.
3280
+ * Otherwise, it is statically replaced as an empty object.
3281
+ */
3282
+ keepProcessEnv?: boolean;
3283
+ /**
3284
+ * Optimize deps config
3285
+ */
3286
+ optimizeDeps?: DepOptimizationOptions;
3287
+ }
3288
+ interface EnvironmentOptions extends SharedEnvironmentOptions {
3289
+ /**
3290
+ * Dev specific options
3291
+ */
3292
+ dev?: DevEnvironmentOptions;
3293
+ /**
3294
+ * Build specific options
3295
+ */
3296
+ build?: BuildEnvironmentOptions;
3297
+ }
3298
+ type ResolvedResolveOptions = Required<ResolveOptions>;
3299
+ type ResolvedEnvironmentOptions = {
3300
+ define?: Record<string, any>;
3301
+ resolve: ResolvedResolveOptions;
3302
+ consumer: "client" | "server";
3303
+ keepProcessEnv?: boolean;
3304
+ optimizeDeps: DepOptimizationOptions;
3305
+ dev: ResolvedDevEnvironmentOptions;
3306
+ build: ResolvedBuildEnvironmentOptions;
3307
+ plugins: readonly Plugin[];
3308
+ };
3309
+ type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve" | "keepProcessEnv"> & {
3310
+ resolve?: AllResolveOptions;
3311
+ };
3312
+ interface UserConfig extends DefaultEnvironmentOptions {
3313
+ /**
3314
+ * Project root directory. Can be an absolute path, or a path relative from
3315
+ * the location of the config file itself.
3316
+ * @default process.cwd()
3317
+ */
3318
+ root?: string;
3319
+ /**
3320
+ * Base public path when served in development or production.
3321
+ * @default '/'
3322
+ */
3323
+ base?: string;
3324
+ /**
3325
+ * Directory to serve as plain static assets. Files in this directory are
3326
+ * served and copied to build dist dir as-is without transform. The value
3327
+ * can be either an absolute file system path or a path relative to project root.
3328
+ *
3329
+ * Set to `false` or an empty string to disable copied static assets to build dist dir.
3330
+ * @default 'public'
3331
+ */
3332
+ publicDir?: string | false;
3333
+ /**
3334
+ * Directory to save cache files. Files in this directory are pre-bundled
3335
+ * deps or some other cache files that generated by vite, which can improve
3336
+ * the performance. You can use `--force` flag or manually delete the directory
3337
+ * to regenerate the cache files. The value can be either an absolute file
3338
+ * system path or a path relative to project root.
3339
+ * Default to `.vite` when no `package.json` is detected.
3340
+ * @default 'node_modules/.vite'
3341
+ */
3342
+ cacheDir?: string;
3343
+ /**
3344
+ * Explicitly set a mode to run in. This will override the default mode for
3345
+ * each command, and can be overridden by the command line --mode option.
3346
+ */
3347
+ mode?: string;
3348
+ /**
3349
+ * Array of vite plugins to use.
3350
+ */
3351
+ plugins?: PluginOption[];
3352
+ /**
3353
+ * HTML related options
3354
+ */
3355
+ html?: HTMLOptions;
3356
+ /**
3357
+ * CSS related options (preprocessors and CSS modules)
3358
+ */
3359
+ css?: CSSOptions;
3360
+ /**
3361
+ * JSON loading options
3362
+ */
3363
+ json?: JsonOptions;
3364
+ /**
3365
+ * Transform options to pass to esbuild.
3366
+ * Or set to `false` to disable esbuild.
3367
+ *
3368
+ * @deprecated Use `oxc` option instead.
3369
+ */
3370
+ esbuild?: ESBuildOptions | false;
3371
+ /**
3372
+ * Transform options to pass to Oxc.
3373
+ * Or set to `false` to disable Oxc.
3374
+ */
3375
+ oxc?: OxcOptions | false;
3376
+ /**
3377
+ * Specify additional picomatch patterns to be treated as static assets.
3378
+ */
3379
+ assetsInclude?: string | RegExp | (string | RegExp)[];
3380
+ /**
3381
+ * Builder specific options
3382
+ * @experimental
3383
+ */
3384
+ builder?: BuilderOptions;
3385
+ /**
3386
+ * Server specific options, e.g. host, port, https...
3387
+ */
3388
+ server?: ServerOptions$1;
3389
+ /**
3390
+ * Preview specific options, e.g. host, port, https...
3391
+ */
3392
+ preview?: PreviewOptions;
3393
+ /**
3394
+ * Experimental features
3395
+ *
3396
+ * Features under this field could change in the future and might NOT follow semver.
3397
+ * Please be careful and always pin Vite's version when using them.
3398
+ * @experimental
3399
+ */
3400
+ experimental?: ExperimentalOptions;
3401
+ /**
3402
+ * Options to opt-in to future behavior
3403
+ */
3404
+ future?: FutureOptions | "warn";
3405
+ /**
3406
+ * Legacy options
3407
+ *
3408
+ * Features under this field only follow semver for patches, they could be removed in a
3409
+ * future minor version. Please always pin Vite's version to a minor when using them.
3410
+ */
3411
+ legacy?: LegacyOptions;
3412
+ /**
3413
+ * Log level.
3414
+ * @default 'info'
3415
+ */
3416
+ logLevel?: LogLevel;
3417
+ /**
3418
+ * Custom logger.
3419
+ */
3420
+ customLogger?: Logger;
3421
+ /**
3422
+ * @default true
3423
+ */
3424
+ clearScreen?: boolean;
3425
+ /**
3426
+ * Environment files directory. Can be an absolute path, or a path relative from
3427
+ * root.
3428
+ * @default root
3429
+ */
3430
+ envDir?: string | false;
3431
+ /**
3432
+ * Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
3433
+ * @default 'VITE_'
3434
+ */
3435
+ envPrefix?: string | string[];
3436
+ /**
3437
+ * Worker bundle options
3438
+ */
3439
+ worker?: {
3440
+ /**
3441
+ * Output format for worker bundle
3442
+ * @default 'iife'
3443
+ */
3444
+ format?: "es" | "iife";
3445
+ /**
3446
+ * Vite plugins that apply to worker bundle. The plugins returned by this function
3447
+ * should be new instances every time it is called, because they are used for each
3448
+ * rolldown worker bundling process.
3449
+ */
3450
+ plugins?: () => PluginOption[];
3451
+ /**
3452
+ * Alias to `rolldownOptions`.
3453
+ * @deprecated Use `rolldownOptions` instead.
3454
+ */
3455
+ rollupOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
3456
+ /**
3457
+ * Rolldown options to build worker bundle
3458
+ */
3459
+ rolldownOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
3460
+ };
3461
+ /**
3462
+ * Dep optimization options
3463
+ */
3464
+ optimizeDeps?: DepOptimizationOptions;
3465
+ /**
3466
+ * SSR specific options
3467
+ * We could make SSROptions be a EnvironmentOptions if we can abstract
3468
+ * external/noExternal for environments in general.
3469
+ */
3470
+ ssr?: SSROptions;
3471
+ /**
3472
+ * Environment overrides
3473
+ */
3474
+ environments?: Record<string, EnvironmentOptions>;
3475
+ /**
3476
+ * Whether your application is a Single Page Application (SPA),
3477
+ * a Multi-Page Application (MPA), or Custom Application (SSR
3478
+ * and frameworks with custom HTML handling)
3479
+ * @default 'spa'
3480
+ */
3481
+ appType?: AppType;
3482
+ /**
3483
+ * Enable devtools integration. Ensure that `@vitejs/devtools` is installed as a dependency.
3484
+ * This feature is currently supported only in build mode.
3485
+ * @experimental
3486
+ * @default false
3487
+ */
3488
+ devtools?: boolean | DevToolsConfig;
3489
+ }
3490
+ interface HTMLOptions {
3491
+ /**
3492
+ * A nonce value placeholder that will be used when generating script/style tags.
3493
+ *
3494
+ * Make sure that this placeholder will be replaced with a unique value for each request by the server.
3495
+ */
3496
+ cspNonce?: string;
3497
+ }
3498
+ interface FutureOptions {
3499
+ removePluginHookHandleHotUpdate?: "warn";
3500
+ removePluginHookSsrArgument?: "warn";
3501
+ removeServerModuleGraph?: "warn";
3502
+ removeServerReloadModule?: "warn";
3503
+ removeServerPluginContainer?: "warn";
3504
+ removeServerHot?: "warn";
3505
+ removeServerTransformRequest?: "warn";
3506
+ removeServerWarmupRequest?: "warn";
3507
+ removeSsrLoadModule?: "warn";
3508
+ }
3509
+ interface ExperimentalOptions {
3510
+ /**
3511
+ * Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
3512
+ *
3513
+ * @experimental
3514
+ * @default false
3515
+ */
3516
+ importGlobRestoreExtension?: boolean;
3517
+ /**
3518
+ * Allow finegrain control over assets and public files paths
3519
+ *
3520
+ * @experimental
3521
+ */
3522
+ renderBuiltUrl?: RenderBuiltAssetUrl;
3523
+ /**
3524
+ * Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
3525
+ *
3526
+ * @experimental
3527
+ * @default false
3528
+ */
3529
+ hmrPartialAccept?: boolean;
3530
+ /**
3531
+ * Enable full bundle mode.
3532
+ *
3533
+ * This is highly experimental.
3534
+ *
3535
+ * @experimental
3536
+ * @default false
3537
+ */
3538
+ bundledDev?: boolean;
3539
+ }
3540
+ interface LegacyOptions {
3541
+ /**
3542
+ * In Vite 6.0.8 and below, WebSocket server was able to connect from any web pages. However,
3543
+ * that could be exploited by a malicious web page.
3544
+ *
3545
+ * In Vite 6.0.9+, the WebSocket server now requires a token to connect from a web page.
3546
+ * But this may break some plugins and frameworks that connects to the WebSocket server
3547
+ * on their own. Enabling this option will make Vite skip the token check.
3548
+ *
3549
+ * **We do not recommend enabling this option unless you are sure that you are fine with
3550
+ * that security weakness.**
3551
+ */
3552
+ skipWebSocketTokenCheck?: boolean;
3553
+ /**
3554
+ * Opt-in to the pre-Vite 8 CJS interop behavior, which was inconsistent.
3555
+ *
3556
+ * In pre-Vite 8 versions, Vite had inconsistent CJS interop behavior. This was due to
3557
+ * the different behavior of esbuild and the Rollup commonjs plugin.
3558
+ * Vite 8+ uses Rolldown for both the dependency optimization in dev and the production build,
3559
+ * which aligns the behavior to esbuild.
3560
+ *
3561
+ * See the Vite 8 migration guide for more details.
3562
+ */
3563
+ inconsistentCjsInterop?: boolean;
3564
+ }
3565
+ interface ResolvedWorkerOptions {
3566
+ format: "es" | "iife";
3567
+ plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
3568
+ /**
3569
+ * @deprecated Use `rolldownOptions` instead.
3570
+ */
3571
+ rollupOptions: RolldownOptions;
3572
+ rolldownOptions: RolldownOptions;
3573
+ }
3574
+ interface InlineConfig extends UserConfig {
3575
+ configFile?: string | false;
3576
+ /** @experimental */
3577
+ configLoader?: "bundle" | "runner" | "native";
3578
+ /** @deprecated */
3579
+ envFile?: false;
3580
+ forceOptimizeDeps?: boolean;
3581
+ }
3582
+ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "json" | "assetsInclude" | "optimizeDeps" | "worker" | "build" | "dev" | "environments" | "experimental" | "future" | "server" | "preview" | "devtools"> & {
3583
+ configFile: string | undefined;
3584
+ configFileDependencies: string[];
3585
+ inlineConfig: InlineConfig;
3586
+ root: string;
3587
+ base: string;
3588
+ publicDir: string;
3589
+ cacheDir: string;
3590
+ command: "build" | "serve";
3591
+ mode: string; /** `true` when build or full-bundle mode dev */
3592
+ isBundled: boolean;
3593
+ isWorker: boolean;
3594
+ isProduction: boolean;
3595
+ envDir: string | false;
3596
+ env: Record<string, any>;
3597
+ resolve: Required<ResolveOptions> & {
3598
+ alias: Alias[];
3599
+ };
3600
+ plugins: readonly Plugin[];
3601
+ css: ResolvedCSSOptions;
3602
+ json: Required<JsonOptions>; /** @deprecated Use `oxc` option instead. */
3603
+ esbuild: ESBuildOptions | false;
3604
+ oxc: OxcOptions | false;
3605
+ server: ResolvedServerOptions;
3606
+ dev: ResolvedDevEnvironmentOptions; /** @experimental */
3607
+ builder: ResolvedBuilderOptions | undefined;
3608
+ build: ResolvedBuildOptions;
3609
+ devtools: ResolvedDevToolsConfig;
3610
+ preview: ResolvedPreviewOptions;
3611
+ ssr: ResolvedSSROptions;
3612
+ assetsInclude: (file: string) => boolean;
3613
+ rawAssetsInclude: (string | RegExp)[];
3614
+ logger: Logger;
3615
+ /**
3616
+ * Create an internal resolver to be used in special scenarios, e.g.
3617
+ * optimizer & handling css `@imports`.
3618
+ *
3619
+ * This API is deprecated. It only works for the client and ssr
3620
+ * environments. The `aliasOnly` option is also not being used anymore.
3621
+ * Plugins should move to `createIdResolver(environment.config)` instead.
3622
+ *
3623
+ * @deprecated Use `createIdResolver` from `vite` instead.
3624
+ */
3625
+ createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
3626
+ optimizeDeps: DepOptimizationOptions;
3627
+ worker: ResolvedWorkerOptions;
3628
+ appType: AppType;
3629
+ experimental: RequiredExceptFor<ExperimentalOptions, "renderBuiltUrl">;
3630
+ future: FutureOptions | undefined;
3631
+ environments: Record<string, ResolvedEnvironmentOptions>;
3632
+ /**
3633
+ * The token to connect to the WebSocket server from browsers.
3634
+ *
3635
+ * We recommend using `import.meta.hot` rather than connecting
3636
+ * to the WebSocket server directly.
3637
+ * If you have a usecase that requires connecting to the WebSocket
3638
+ * server, please create an issue so that we can discuss.
3639
+ *
3640
+ * @deprecated
3641
+ */
3642
+ webSocketToken: string;
3643
+ } & PluginHookUtils> {}
3644
+ interface PluginHookUtils {
3645
+ getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
3646
+ getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3647
+ }
3648
+ type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3649
+ declare function resolveConfig(inlineConfig: InlineConfig, command: "build" | "serve", defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>;
3650
+ declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3651
+ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: "bundle" | "runner" | "native"): Promise<{
3652
+ path: string;
3653
+ config: UserConfig;
3654
+ dependencies: string[];
3655
+ } | null>;
3656
+ //#endregion
3657
+ //#region src/node/idResolver.d.ts
3658
+ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>;
3659
+ /**
3660
+ * Create an internal resolver to be used in special scenarios, e.g.
3661
+ * optimizer and handling css @imports
3662
+ */
3663
+ declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
3664
+ //#endregion
3665
+ //#region src/node/server/middlewares/error.d.ts
3666
+ declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
3667
+ //#endregion
3668
+ //#region src/node/ssr/runtime/serverModuleRunner.d.ts
3669
+ /**
3670
+ * @experimental
3671
+ */
3672
+ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "fetchModule" | "hmr" | "transport"> {
3673
+ /**
3674
+ * Disable HMR or configure HMR logger.
3675
+ */
3676
+ hmr?: false | {
3677
+ logger?: ModuleRunnerHmr["logger"];
3678
+ };
3679
+ /**
3680
+ * Provide a custom module evaluator. This controls how the code is executed.
3681
+ */
3682
+ evaluator?: ModuleEvaluator;
3683
+ }
3684
+ declare const createServerModuleRunnerTransport: (options: {
3685
+ channel: NormalizedServerHotChannel;
3686
+ }) => ModuleRunnerTransport;
3687
+ /**
3688
+ * Create an instance of the Vite SSR runtime that support HMR.
3689
+ * @experimental
3690
+ */
3691
+ declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3692
+ //#endregion
3693
+ //#region src/node/server/environments/runnableEnvironment.d.ts
3694
+ declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): RunnableDevEnvironment;
3695
+ interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext, "hot"> {
3696
+ runner?: (environment: RunnableDevEnvironment, options?: ServerModuleRunnerOptions) => ModuleRunner;
3697
+ runnerOptions?: ServerModuleRunnerOptions;
3698
+ hot?: boolean;
3699
+ }
3700
+ declare function isRunnableDevEnvironment(environment: Environment): environment is RunnableDevEnvironment;
3701
+ declare class RunnableDevEnvironment extends DevEnvironment {
3702
+ private _runner;
3703
+ private _runnerFactory;
3704
+ private _runnerOptions;
3705
+ constructor(name: string, config: ResolvedConfig, context: RunnableDevEnvironmentContext);
3706
+ get runner(): ModuleRunner;
3707
+ override close(): Promise<void>;
3708
+ }
3709
+ //#endregion
3710
+ //#region src/node/server/environments/fetchableEnvironments.d.ts
3711
+ interface FetchableDevEnvironmentContext extends DevEnvironmentContext {
3712
+ handleRequest(request: Request): Promise<Response> | Response;
3713
+ }
3714
+ declare function createFetchableDevEnvironment(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext): FetchableDevEnvironment;
3715
+ declare function isFetchableDevEnvironment(environment: Environment): environment is FetchableDevEnvironment;
3716
+ declare class FetchableDevEnvironment extends DevEnvironment {
3717
+ private _handleRequest;
3718
+ constructor(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext);
3719
+ dispatchFetch(request: Request): Promise<Response>;
3720
+ }
3721
+ //#endregion
3722
+ //#region src/node/ssr/runnerImport.d.ts
3723
+ interface RunnerImportResult<T> {
3724
+ module: T;
3725
+ dependencies: string[];
3726
+ }
3727
+ /**
3728
+ * Import any file using the default Vite environment.
3729
+ * @experimental
3730
+ */
3731
+ declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>;
3732
+ //#endregion
3733
+ //#region src/node/ssr/fetchModule.d.ts
3734
+ interface FetchModuleOptions {
3735
+ cached?: boolean;
3736
+ inlineSourceMap?: boolean;
3737
+ startOffset?: number;
3738
+ }
3739
+ /**
3740
+ * Fetch module information for Vite module runner.
3741
+ * @experimental
3742
+ */
3743
+ declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
3744
+ //#endregion
3745
+ //#region src/node/ssr/ssrTransform.d.ts
3746
+ interface ModuleRunnerTransformOptions {
3747
+ json?: {
3748
+ stringify?: boolean;
3749
+ };
3750
+ }
3751
+ declare function ssrTransform(code: string, inMap: SourceMap | {
3752
+ mappings: "";
3753
+ } | null, url: string, originalCode: string, options?: ModuleRunnerTransformOptions): Promise<TransformResult | null>;
3754
+ //#endregion
3755
+ //#region src/node/constants.d.ts
3756
+ declare const VERSION: string;
3757
+ declare const DEFAULT_CLIENT_MAIN_FIELDS: readonly string[];
3758
+ declare const DEFAULT_SERVER_MAIN_FIELDS: readonly string[];
3759
+ declare const DEFAULT_CLIENT_CONDITIONS: readonly string[];
3760
+ declare const DEFAULT_SERVER_CONDITIONS: readonly string[];
3761
+ declare const DEFAULT_EXTERNAL_CONDITIONS: readonly string[];
3762
+ declare const defaultAllowedOrigins: RegExp;
3763
+ //#endregion
3764
+ //#region src/node/utils.d.ts
3765
+ /**
3766
+ * Inlined to keep `@rollup/pluginutils` in devDependencies
3767
+ */
3768
+ type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
3769
+ declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
3770
+ resolve?: string | false | null;
3771
+ }) => (id: unknown) => boolean;
3772
+ declare const rollupVersion = "4.23.0";
3773
+ declare function normalizePath(id: string): string;
3774
+ declare const isCSSRequest: (request: string) => boolean;
3775
+ declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
3776
+ declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
3777
+ //#endregion
3778
+ //#region src/node/server/send.d.ts
3779
+ interface SendOptions {
3780
+ etag?: string;
3781
+ cacheControl?: string;
3782
+ headers?: OutgoingHttpHeaders;
3783
+ map?: SourceMap | {
3784
+ mappings: "";
3785
+ } | null;
3786
+ }
3787
+ declare function send(req: http.IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
3788
+ //#endregion
3789
+ //#region src/node/server/searchRoot.d.ts
3790
+ /**
3791
+ * Search up for the nearest workspace root
3792
+ */
3793
+ declare function searchForWorkspaceRoot(current: string, root?: string): string;
3794
+ //#endregion
3795
+ //#region src/node/server/middlewares/static.d.ts
3796
+ /**
3797
+ * Check if the url is allowed to be served, via the `server.fs` config.
3798
+ * @deprecated Use the `isFileLoadingAllowed` function instead.
3799
+ */
3800
+ declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
3801
+ declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
3802
+ /**
3803
+ * Warning: parameters are not validated, only works with normalized absolute paths
3804
+ */
3805
+ declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
3806
+ //#endregion
3807
+ //#region src/node/env.d.ts
3808
+ declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
3809
+ declare function resolveEnvPrefix({
3810
+ envPrefix
3811
+ }: UserConfig): string[];
3812
+ //#endregion
3813
+ //#region src/node/plugins/manifest.d.ts
3814
+ type Manifest = Record<string, ManifestChunk>;
3815
+ interface ManifestChunk {
3816
+ /**
3817
+ * The input file name of this chunk / asset if known
3818
+ */
3819
+ src?: string;
3820
+ /**
3821
+ * The output file name of this chunk / asset
3822
+ */
3823
+ file: string;
3824
+ /**
3825
+ * The list of CSS files imported by this chunk
3826
+ */
3827
+ css?: string[];
3828
+ /**
3829
+ * The list of asset files imported by this chunk, excluding CSS files
3830
+ */
3831
+ assets?: string[];
3832
+ /**
3833
+ * Whether this chunk or asset is an entry point
3834
+ */
3835
+ isEntry?: boolean;
3836
+ /**
3837
+ * The name of this chunk / asset if known
3838
+ */
3839
+ name?: string;
3840
+ /**
3841
+ * Whether this chunk is a dynamic entry point
3842
+ *
3843
+ * This field is only present in JS chunks.
3844
+ */
3845
+ isDynamicEntry?: boolean;
3846
+ /**
3847
+ * The list of statically imported chunks by this chunk
3848
+ *
3849
+ * The values are the keys of the manifest. This field is only present in JS chunks.
3850
+ */
3851
+ imports?: string[];
3852
+ /**
3853
+ * The list of dynamically imported chunks by this chunk
3854
+ *
3855
+ * The values are the keys of the manifest. This field is only present in JS chunks.
3856
+ */
3857
+ dynamicImports?: string[];
3858
+ }
3859
+ //#endregion
3860
+ //#region src/node/index.d.ts
3861
+ /** @deprecated - use `parse` instead */
3862
+ declare const parseAst: typeof parseAst$1;
3863
+ /** @deprecated - use `parseAsync` instead */
3864
+ declare const parseAstAsync: typeof parseAstAsync$1;
3865
+ declare const esbuildVersion = "0.25.0";
3866
+ //#endregion
3867
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };