astro 6.0.0-alpha.0 → 6.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (567) hide show
  1. package/astro-jsx.d.ts +11 -0
  2. package/client.d.ts +17 -41
  3. package/components/Code.astro +2 -2
  4. package/components/Image.astro +2 -2
  5. package/components/Picture.astro +1 -1
  6. package/dist/actions/consts.d.ts +2 -5
  7. package/dist/actions/consts.js +4 -8
  8. package/dist/actions/integration.js +2 -4
  9. package/dist/actions/runtime/client.d.ts +84 -3
  10. package/dist/actions/runtime/client.js +238 -7
  11. package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
  12. package/dist/actions/runtime/entrypoints/client.js +91 -0
  13. package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
  14. package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
  15. package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
  16. package/dist/actions/runtime/entrypoints/server.js +33 -0
  17. package/dist/actions/runtime/server.d.ts +11 -18
  18. package/dist/actions/runtime/server.js +162 -82
  19. package/dist/actions/runtime/types.d.ts +64 -0
  20. package/dist/actions/utils.d.ts +2 -2
  21. package/dist/actions/utils.js +2 -2
  22. package/dist/actions/vite-plugin-actions.js +58 -47
  23. package/dist/assets/build/generate.d.ts +2 -2
  24. package/dist/assets/build/generate.js +12 -10
  25. package/dist/assets/consts.d.ts +1 -0
  26. package/dist/assets/consts.js +2 -0
  27. package/dist/assets/endpoint/config.js +2 -2
  28. package/dist/assets/endpoint/dev.js +7 -6
  29. package/dist/assets/fonts/config.d.ts +91 -350
  30. package/dist/assets/fonts/config.js +35 -136
  31. package/dist/assets/fonts/constants.js +1 -1
  32. package/dist/assets/fonts/core/dedupe-font-faces.d.ts +2 -0
  33. package/dist/assets/fonts/core/dedupe-font-faces.js +30 -0
  34. package/dist/assets/fonts/definitions.d.ts +9 -22
  35. package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +4 -0
  36. package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +8 -0
  37. package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.d.ts +15 -0
  38. package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.js +20 -0
  39. package/dist/assets/fonts/infra/build-url-resolver.d.ts +12 -0
  40. package/dist/assets/fonts/infra/build-url-resolver.js +40 -0
  41. package/dist/assets/fonts/infra/cached-font-fetcher.d.ts +11 -0
  42. package/dist/assets/fonts/infra/cached-font-fetcher.js +42 -0
  43. package/dist/assets/fonts/infra/capsize-font-metrics-resolver.d.ts +18 -0
  44. package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +71 -0
  45. package/dist/assets/fonts/infra/data-collector.d.ts +10 -0
  46. package/dist/assets/fonts/infra/data-collector.js +35 -0
  47. package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +9 -0
  48. package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +14 -0
  49. package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.d.ts +15 -0
  50. package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.js +37 -0
  51. package/dist/assets/fonts/infra/dev-url-resolver.d.ts +10 -0
  52. package/dist/assets/fonts/infra/dev-url-resolver.js +29 -0
  53. package/dist/assets/fonts/infra/font-type-extractor.d.ts +5 -0
  54. package/dist/assets/fonts/infra/font-type-extractor.js +21 -0
  55. package/dist/assets/fonts/infra/fontace-font-file-reader.d.ts +11 -0
  56. package/dist/assets/fonts/infra/fontace-font-file-reader.js +25 -0
  57. package/dist/assets/fonts/infra/levenshtein-string-matcher.d.ts +5 -0
  58. package/dist/assets/fonts/infra/levenshtein-string-matcher.js +145 -0
  59. package/dist/assets/fonts/infra/local-url-proxy-content-resolver.d.ts +4 -0
  60. package/dist/assets/fonts/infra/local-url-proxy-content-resolver.js +14 -0
  61. package/dist/assets/fonts/{implementations/css-renderer.d.ts → infra/minifiable-css-renderer.d.ts} +8 -3
  62. package/dist/assets/fonts/{implementations/css-renderer.js → infra/minifiable-css-renderer.js} +12 -10
  63. package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +10 -0
  64. package/dist/assets/fonts/infra/remote-font-provider-resolver.js +49 -0
  65. package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.d.ts +4 -0
  66. package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.js +9 -0
  67. package/dist/assets/fonts/infra/require-local-provider-url-resolver.d.ts +9 -0
  68. package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +22 -0
  69. package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +6 -0
  70. package/dist/assets/fonts/{implementations → infra}/system-fallbacks-provider.js +8 -11
  71. package/dist/assets/fonts/infra/unstorage-fs-storage.d.ts +11 -0
  72. package/dist/assets/fonts/infra/unstorage-fs-storage.js +26 -0
  73. package/dist/assets/fonts/infra/url-proxy.d.ts +16 -0
  74. package/dist/assets/fonts/infra/url-proxy.js +50 -0
  75. package/dist/assets/fonts/infra/xxhash-hasher.d.ts +7 -0
  76. package/dist/assets/fonts/infra/xxhash-hasher.js +18 -0
  77. package/dist/assets/fonts/orchestrate.d.ts +1 -2
  78. package/dist/assets/fonts/orchestrate.js +50 -17
  79. package/dist/assets/fonts/providers/index.d.ts +6 -24
  80. package/dist/assets/fonts/types.d.ts +138 -8
  81. package/dist/assets/fonts/utils.d.ts +1 -2
  82. package/dist/assets/fonts/vite-plugin-fonts.js +66 -65
  83. package/dist/assets/services/noop.js +11 -1
  84. package/dist/assets/services/service.d.ts +1 -1
  85. package/dist/assets/services/service.js +55 -51
  86. package/dist/assets/types.d.ts +2 -2
  87. package/dist/assets/utils/index.d.ts +1 -3
  88. package/dist/assets/utils/index.js +4 -9
  89. package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
  90. package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -6
  91. package/dist/assets/utils/svg.d.ts +2 -1
  92. package/dist/assets/utils/svg.js +30 -4
  93. package/dist/assets/vite-plugin-assets.js +36 -19
  94. package/dist/cli/add/index.js +21 -13
  95. package/dist/cli/create-key/infra/crypto-key-generator.d.ts +3 -1
  96. package/dist/cli/create-key/infra/crypto-key-generator.js +7 -9
  97. package/dist/cli/definitions.d.ts +19 -2
  98. package/dist/cli/dev/index.js +1 -1
  99. package/dist/cli/docs/core/open-docs.d.ts +5 -3
  100. package/dist/cli/docs/core/open-docs.js +2 -9
  101. package/dist/cli/docs/definitions.d.ts +3 -11
  102. package/dist/cli/docs/domain/cloud-ide.d.ts +1 -0
  103. package/dist/cli/docs/domain/cloud-ide.js +0 -0
  104. package/dist/cli/docs/infra/process-cloud-ide-provider.d.ts +5 -0
  105. package/dist/cli/docs/infra/process-cloud-ide-provider.js +6 -0
  106. package/dist/cli/flags.d.ts +1 -0
  107. package/dist/cli/index.js +78 -21
  108. package/dist/cli/info/core/get-package-manager.d.ts +8 -0
  109. package/dist/cli/info/core/get-package-manager.js +37 -0
  110. package/dist/cli/info/core/info.d.ts +21 -0
  111. package/dist/cli/info/core/info.js +21 -0
  112. package/dist/cli/info/definitions.d.ts +30 -0
  113. package/dist/cli/info/definitions.js +0 -0
  114. package/dist/cli/info/domain/debug-info.d.ts +1 -0
  115. package/dist/cli/info/domain/debug-info.js +0 -0
  116. package/dist/cli/info/infra/bun-package-manager.d.ts +5 -0
  117. package/dist/cli/info/infra/bun-package-manager.js +9 -0
  118. package/dist/cli/info/infra/cli-astro-config-resolver.d.ts +10 -0
  119. package/dist/cli/info/infra/cli-astro-config-resolver.js +36 -0
  120. package/dist/cli/info/infra/cli-clipboard.d.ts +13 -0
  121. package/dist/cli/info/infra/cli-clipboard.js +78 -0
  122. package/dist/cli/info/infra/cli-debug-info-provider.d.ts +15 -0
  123. package/dist/cli/info/infra/cli-debug-info-provider.js +57 -0
  124. package/dist/cli/info/infra/dev-debug-info-provider.d.ts +18 -0
  125. package/dist/cli/info/infra/dev-debug-info-provider.js +36 -0
  126. package/dist/cli/info/infra/noop-package-manager.d.ts +5 -0
  127. package/dist/cli/info/infra/noop-package-manager.js +9 -0
  128. package/dist/cli/info/infra/npm-package-manager.d.ts +10 -0
  129. package/dist/cli/info/infra/npm-package-manager.js +32 -0
  130. package/dist/cli/info/infra/pnpm-package-manager.d.ts +10 -0
  131. package/dist/cli/info/infra/pnpm-package-manager.js +33 -0
  132. package/dist/cli/info/infra/process-node-version-provider.d.ts +4 -0
  133. package/dist/cli/info/infra/process-node-version-provider.js +6 -0
  134. package/dist/cli/info/infra/process-package-manager-user-agent-provider.d.ts +4 -0
  135. package/dist/cli/info/infra/process-package-manager-user-agent-provider.js +7 -0
  136. package/dist/cli/info/infra/prompts-prompt.d.ts +11 -0
  137. package/dist/cli/info/infra/prompts-prompt.js +25 -0
  138. package/dist/cli/info/infra/styled-debug-info-formatter.d.ts +10 -0
  139. package/dist/cli/info/infra/styled-debug-info-formatter.js +29 -0
  140. package/dist/cli/info/infra/yarn-package-manager.d.ts +10 -0
  141. package/dist/cli/info/infra/yarn-package-manager.js +34 -0
  142. package/dist/cli/infra/build-time-astro-version-provider.d.ts +3 -1
  143. package/dist/cli/infra/build-time-astro-version-provider.js +4 -8
  144. package/dist/cli/infra/cli-command-runner.d.ts +7 -4
  145. package/dist/cli/infra/cli-command-runner.js +14 -10
  146. package/dist/cli/infra/logger-help-display.d.ts +11 -7
  147. package/dist/cli/infra/logger-help-display.js +62 -50
  148. package/dist/cli/infra/passthrough-text-styler.d.ts +9 -0
  149. package/dist/cli/infra/passthrough-text-styler.js +23 -0
  150. package/dist/cli/infra/piccolore-text-styler.d.ts +2 -0
  151. package/dist/cli/infra/piccolore-text-styler.js +5 -0
  152. package/dist/cli/infra/process-operating-system-provider.d.ts +6 -0
  153. package/dist/cli/infra/process-operating-system-provider.js +12 -0
  154. package/dist/cli/infra/tinyexec-command-executor.d.ts +6 -0
  155. package/dist/cli/infra/tinyexec-command-executor.js +34 -0
  156. package/dist/cli/install-package.js +1 -1
  157. package/dist/cli/preferences/index.js +6 -2
  158. package/dist/cli/preview/index.js +1 -1
  159. package/dist/cli/utils/format-version.js +1 -1
  160. package/dist/config/index.js +9 -5
  161. package/dist/container/index.js +19 -13
  162. package/dist/container/pipeline.d.ts +2 -1
  163. package/dist/container/pipeline.js +4 -11
  164. package/dist/container/vite-plugin-container.js +7 -4
  165. package/dist/content/config.d.ts +34 -40
  166. package/dist/content/content-layer.js +13 -18
  167. package/dist/content/loaders/errors.d.ts +3 -3
  168. package/dist/content/loaders/errors.js +5 -2
  169. package/dist/content/loaders/glob.js +6 -1
  170. package/dist/content/loaders/types.d.ts +11 -4
  171. package/dist/content/runtime-assets.d.ts +4 -4
  172. package/dist/content/runtime-assets.js +2 -2
  173. package/dist/content/runtime.d.ts +21 -20
  174. package/dist/content/runtime.js +14 -16
  175. package/dist/content/types-generator.js +90 -54
  176. package/dist/content/utils.d.ts +46 -338
  177. package/dist/content/utils.js +52 -50
  178. package/dist/content/vite-plugin-content-assets.d.ts +12 -4
  179. package/dist/content/vite-plugin-content-assets.js +152 -102
  180. package/dist/content/vite-plugin-content-imports.js +58 -40
  181. package/dist/content/vite-plugin-content-virtual-mod.js +95 -77
  182. package/dist/core/app/app.d.ts +5 -0
  183. package/dist/core/app/app.js +13 -0
  184. package/dist/core/app/base.d.ts +132 -0
  185. package/dist/core/app/base.js +448 -0
  186. package/dist/core/app/common.d.ts +6 -2
  187. package/dist/core/app/common.js +60 -33
  188. package/dist/core/app/dev/app.d.ts +15 -0
  189. package/dist/core/app/dev/app.js +86 -0
  190. package/dist/core/app/dev/pipeline.d.ts +13 -0
  191. package/dist/core/app/dev/pipeline.js +123 -0
  192. package/dist/core/app/entrypoint.d.ts +2 -0
  193. package/dist/core/app/entrypoint.js +15 -0
  194. package/dist/core/app/index.d.ts +7 -99
  195. package/dist/core/app/index.js +20 -486
  196. package/dist/core/app/logging.d.ts +3 -0
  197. package/dist/core/app/logging.js +11 -0
  198. package/dist/core/app/manifest.d.ts +9 -0
  199. package/dist/core/app/manifest.js +107 -0
  200. package/dist/core/app/middlewares.js +1 -1
  201. package/dist/core/app/node.js +14 -13
  202. package/dist/core/app/pipeline.d.ts +6 -5
  203. package/dist/core/app/pipeline.js +65 -49
  204. package/dist/core/app/types.d.ts +58 -22
  205. package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
  206. package/dist/core/app/validate-forwarded-headers.js +60 -0
  207. package/dist/core/base-pipeline.d.ts +22 -14
  208. package/dist/core/base-pipeline.js +54 -6
  209. package/dist/core/build/app.d.ts +13 -0
  210. package/dist/core/build/app.js +38 -0
  211. package/dist/core/build/common.d.ts +1 -1
  212. package/dist/core/build/common.js +2 -2
  213. package/dist/core/build/generate.d.ts +1 -1
  214. package/dist/core/build/generate.js +96 -204
  215. package/dist/core/build/graph.js +2 -2
  216. package/dist/core/build/index.js +11 -16
  217. package/dist/core/build/internal.d.ts +2 -27
  218. package/dist/core/build/internal.js +1 -44
  219. package/dist/core/build/page-data.js +1 -1
  220. package/dist/core/build/pipeline.d.ts +15 -26
  221. package/dist/core/build/pipeline.js +106 -170
  222. package/dist/core/build/plugins/index.d.ts +4 -2
  223. package/dist/core/build/plugins/index.js +17 -23
  224. package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
  225. package/dist/core/build/plugins/plugin-analyzer.js +5 -13
  226. package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
  227. package/dist/core/build/plugins/plugin-component-entry.js +15 -17
  228. package/dist/core/build/plugins/plugin-css.d.ts +2 -2
  229. package/dist/core/build/plugins/plugin-css.js +90 -41
  230. package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
  231. package/dist/core/build/plugins/plugin-internals.js +24 -18
  232. package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
  233. package/dist/core/build/plugins/plugin-manifest.js +89 -129
  234. package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
  235. package/dist/core/build/plugins/plugin-middleware.js +5 -7
  236. package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
  237. package/dist/core/build/plugins/plugin-noop.js +35 -0
  238. package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
  239. package/dist/core/build/plugins/plugin-prerender.js +7 -64
  240. package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
  241. package/dist/core/build/plugins/plugin-scripts.js +5 -13
  242. package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
  243. package/dist/core/build/plugins/plugin-ssr.js +85 -139
  244. package/dist/core/build/plugins/util.d.ts +1 -25
  245. package/dist/core/build/plugins/util.js +0 -47
  246. package/dist/core/build/runtime.d.ts +26 -0
  247. package/dist/core/build/runtime.js +45 -0
  248. package/dist/core/build/static-build.d.ts +2 -2
  249. package/dist/core/build/static-build.js +181 -155
  250. package/dist/core/build/types.d.ts +1 -2
  251. package/dist/core/build/util.d.ts +0 -1
  252. package/dist/core/build/util.js +0 -7
  253. package/dist/core/compile/compile.d.ts +2 -3
  254. package/dist/core/compile/compile.js +2 -2
  255. package/dist/core/config/config.js +3 -3
  256. package/dist/core/config/index.d.ts +0 -1
  257. package/dist/core/config/index.js +0 -2
  258. package/dist/core/config/schemas/base.d.ts +336 -1434
  259. package/dist/core/config/schemas/base.js +42 -41
  260. package/dist/core/config/schemas/refined.d.ts +2 -2
  261. package/dist/core/config/schemas/refined.js +1 -1
  262. package/dist/core/config/schemas/relative.d.ts +672 -1761
  263. package/dist/core/config/schemas/relative.js +4 -4
  264. package/dist/core/config/settings.d.ts +3 -3
  265. package/dist/core/config/settings.js +5 -6
  266. package/dist/core/config/validate.js +13 -2
  267. package/dist/core/config/vite-load.js +12 -3
  268. package/dist/core/constants.d.ts +11 -0
  269. package/dist/core/constants.js +20 -1
  270. package/dist/core/create-vite.d.ts +2 -6
  271. package/dist/core/create-vite.js +35 -43
  272. package/dist/core/csp/common.d.ts +1 -1
  273. package/dist/core/csp/common.js +1 -1
  274. package/dist/core/csp/config.d.ts +8 -4
  275. package/dist/core/csp/config.js +1 -1
  276. package/dist/core/csp/runtime.d.ts +11 -0
  277. package/dist/core/csp/runtime.js +35 -0
  278. package/dist/core/dev/container.js +13 -7
  279. package/dist/core/dev/dev.js +2 -2
  280. package/dist/core/dev/restart.js +15 -6
  281. package/dist/core/errors/dev/runtime.d.ts +6 -0
  282. package/dist/core/errors/dev/runtime.js +27 -0
  283. package/dist/core/errors/dev/utils.js +1 -1
  284. package/dist/core/errors/dev/vite.js +1 -1
  285. package/dist/core/errors/errors-data.d.ts +32 -16
  286. package/dist/core/errors/errors-data.js +23 -10
  287. package/dist/core/errors/errors.d.ts +3 -3
  288. package/dist/core/errors/errors.js +8 -8
  289. package/dist/core/errors/zod-error-map.d.ts +2 -2
  290. package/dist/core/errors/zod-error-map.js +26 -24
  291. package/dist/core/logger/core.js +1 -1
  292. package/dist/core/messages.d.ts +2 -2
  293. package/dist/core/messages.js +3 -3
  294. package/dist/core/middleware/callMiddleware.js +1 -1
  295. package/dist/core/middleware/defineMiddleware.d.ts +2 -0
  296. package/dist/core/middleware/defineMiddleware.js +6 -0
  297. package/dist/core/middleware/index.d.ts +3 -3
  298. package/dist/core/middleware/index.js +1 -3
  299. package/dist/core/middleware/sequence.js +4 -4
  300. package/dist/core/middleware/vite-plugin.d.ts +1 -1
  301. package/dist/core/middleware/vite-plugin.js +41 -24
  302. package/dist/core/module-loader/index.d.ts +2 -2
  303. package/dist/core/module-loader/index.js +1 -1
  304. package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
  305. package/dist/core/module-loader/{loader.js → runner.js} +3 -0
  306. package/dist/core/module-loader/vite.d.ts +3 -2
  307. package/dist/core/module-loader/vite.js +17 -13
  308. package/dist/core/preview/index.js +20 -3
  309. package/dist/core/preview/static-preview-server.js +11 -0
  310. package/dist/core/redirects/component.js +1 -2
  311. package/dist/core/redirects/index.d.ts +0 -1
  312. package/dist/core/redirects/index.js +1 -3
  313. package/dist/core/redirects/render.js +5 -2
  314. package/dist/core/render/paginate.d.ts +1 -1
  315. package/dist/core/render/paginate.js +8 -6
  316. package/dist/core/render/params-and-props.d.ts +2 -0
  317. package/dist/core/render/params-and-props.js +19 -6
  318. package/dist/core/render/route-cache.d.ts +3 -2
  319. package/dist/core/render/route-cache.js +6 -5
  320. package/dist/core/render-context.d.ts +6 -4
  321. package/dist/core/render-context.js +66 -25
  322. package/dist/core/routing/astro-designed-error-pages.js +2 -2
  323. package/dist/core/routing/default.js +1 -1
  324. package/dist/core/routing/helpers.d.ts +22 -0
  325. package/dist/core/routing/helpers.js +25 -0
  326. package/dist/core/routing/index.d.ts +1 -1
  327. package/dist/core/routing/index.js +2 -2
  328. package/dist/core/routing/manifest/create.d.ts +6 -1
  329. package/dist/core/routing/manifest/create.js +11 -14
  330. package/dist/core/routing/manifest/generator.d.ts +3 -1
  331. package/dist/core/routing/params.d.ts +2 -1
  332. package/dist/core/routing/params.js +3 -2
  333. package/dist/core/server-islands/endpoint.js +40 -19
  334. package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
  335. package/dist/core/server-islands/vite-plugin-server-islands.js +106 -46
  336. package/dist/core/session/vite-plugin.d.ts +6 -0
  337. package/dist/core/session/vite-plugin.js +59 -0
  338. package/dist/core/session.d.ts +4 -2
  339. package/dist/core/session.js +8 -48
  340. package/dist/core/sync/index.d.ts +2 -5
  341. package/dist/core/sync/index.js +34 -22
  342. package/dist/core/util/pathname.d.ts +10 -0
  343. package/dist/core/util/pathname.js +17 -0
  344. package/dist/core/util.d.ts +2 -2
  345. package/dist/core/util.js +3 -3
  346. package/dist/core/viteUtils.d.ts +1 -0
  347. package/dist/core/viteUtils.js +2 -0
  348. package/dist/entrypoints/legacy.d.ts +2 -0
  349. package/dist/entrypoints/legacy.js +12 -0
  350. package/dist/entrypoints/prerender.d.ts +4 -0
  351. package/dist/entrypoints/prerender.js +7 -0
  352. package/dist/env/schema.d.ts +21 -251
  353. package/dist/env/schema.js +6 -3
  354. package/dist/env/vite-plugin-env.js +61 -42
  355. package/dist/env/vite-plugin-import-meta-env.js +45 -37
  356. package/dist/environments.d.ts +3 -0
  357. package/dist/environments.js +11 -0
  358. package/dist/events/error.d.ts +2 -2
  359. package/dist/i18n/index.d.ts +2 -2
  360. package/dist/i18n/utils.d.ts +1 -6
  361. package/dist/i18n/utils.js +1 -63
  362. package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
  363. package/dist/i18n/vite-plugin-i18n.js +8 -26
  364. package/dist/integrations/hooks.d.ts +1 -1
  365. package/dist/integrations/hooks.js +10 -7
  366. package/dist/manifest/serialized.d.ts +9 -0
  367. package/dist/manifest/serialized.js +150 -0
  368. package/dist/manifest/virtual-module.d.ts +1 -4
  369. package/dist/manifest/virtual-module.js +100 -91
  370. package/dist/preferences/index.d.ts +1 -2
  371. package/dist/prefetch/vite-plugin-prefetch.js +20 -9
  372. package/dist/prerender/routing.d.ts +5 -7
  373. package/dist/prerender/routing.js +6 -17
  374. package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +2 -2
  375. package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +2 -2
  376. package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +2 -2
  377. package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +2 -2
  378. package/dist/runtime/client/dev-toolbar/ui-library/radio-checkbox.d.ts +2 -2
  379. package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +2 -2
  380. package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +2 -2
  381. package/dist/runtime/server/endpoint.js +1 -1
  382. package/dist/runtime/server/render/server-islands.js +5 -4
  383. package/dist/runtime/server/transition.d.ts +1 -0
  384. package/dist/template/4xx.js +3 -1
  385. package/dist/toolbar/vite-plugin-dev-toolbar.js +13 -7
  386. package/dist/transitions/events.d.ts +7 -0
  387. package/dist/transitions/router.js +7 -3
  388. package/dist/transitions/swap-functions.js +4 -0
  389. package/dist/transitions/vite-plugin-transitions.js +35 -22
  390. package/dist/types/astro.d.ts +8 -6
  391. package/dist/types/public/config.d.ts +438 -289
  392. package/dist/types/public/context.d.ts +3 -4
  393. package/dist/types/public/extendables.d.ts +2 -0
  394. package/dist/types/public/index.d.ts +2 -1
  395. package/dist/types/public/integrations.d.ts +23 -1
  396. package/dist/types/public/internal.d.ts +1 -16
  397. package/dist/types/public/preview.d.ts +6 -0
  398. package/dist/virtual-modules/i18n.d.ts +10 -2
  399. package/dist/virtual-modules/i18n.js +16 -7
  400. package/dist/virtual-modules/live-config.d.ts +1 -1
  401. package/dist/virtual-modules/live-config.js +1 -1
  402. package/dist/virtual-modules/middleware.d.ts +2 -1
  403. package/dist/virtual-modules/middleware.js +2 -1
  404. package/dist/vite-plugin-adapter-config/index.js +12 -5
  405. package/dist/vite-plugin-app/app.d.ts +47 -0
  406. package/dist/vite-plugin-app/app.js +410 -0
  407. package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
  408. package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
  409. package/dist/vite-plugin-app/index.d.ts +3 -0
  410. package/dist/vite-plugin-app/index.js +19 -0
  411. package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +6 -7
  412. package/dist/vite-plugin-app/pipeline.js +166 -0
  413. package/dist/vite-plugin-astro/index.js +215 -170
  414. package/dist/vite-plugin-astro-server/base.js +1 -1
  415. package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
  416. package/dist/vite-plugin-astro-server/error.d.ts +3 -4
  417. package/dist/vite-plugin-astro-server/error.js +2 -5
  418. package/dist/vite-plugin-astro-server/index.d.ts +0 -1
  419. package/dist/vite-plugin-astro-server/index.js +0 -2
  420. package/dist/vite-plugin-astro-server/metadata.js +1 -1
  421. package/dist/vite-plugin-astro-server/plugin.d.ts +3 -7
  422. package/dist/vite-plugin-astro-server/plugin.js +40 -108
  423. package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
  424. package/dist/vite-plugin-astro-server/util.d.ts +2 -2
  425. package/dist/vite-plugin-astro-server/util.js +2 -1
  426. package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
  427. package/dist/vite-plugin-astro-server/vite.js +7 -7
  428. package/dist/vite-plugin-chromedevtools/index.d.ts +7 -0
  429. package/dist/vite-plugin-chromedevtools/index.js +47 -0
  430. package/dist/vite-plugin-config-alias/index.js +59 -44
  431. package/dist/vite-plugin-css/index.d.ts +18 -0
  432. package/dist/vite-plugin-css/index.js +155 -0
  433. package/dist/vite-plugin-css/util.d.ts +5 -0
  434. package/dist/vite-plugin-css/util.js +8 -0
  435. package/dist/vite-plugin-environment/index.d.ts +15 -0
  436. package/dist/vite-plugin-environment/index.js +77 -0
  437. package/dist/vite-plugin-fileurl/index.js +6 -3
  438. package/dist/vite-plugin-head/index.d.ts +1 -2
  439. package/dist/vite-plugin-head/index.js +42 -58
  440. package/dist/vite-plugin-hmr-reload/index.js +2 -1
  441. package/dist/vite-plugin-html/index.d.ts +7 -4
  442. package/dist/vite-plugin-html/index.js +5 -3
  443. package/dist/vite-plugin-load-fallback/index.js +12 -5
  444. package/dist/vite-plugin-markdown/index.js +27 -8
  445. package/dist/vite-plugin-overlay/index.d.ts +2 -0
  446. package/dist/vite-plugin-overlay/index.js +21 -0
  447. package/dist/vite-plugin-pages/const.d.ts +2 -0
  448. package/dist/vite-plugin-pages/const.js +6 -0
  449. package/dist/vite-plugin-pages/index.d.ts +2 -0
  450. package/dist/vite-plugin-pages/index.js +7 -0
  451. package/dist/vite-plugin-pages/page.d.ts +7 -0
  452. package/dist/vite-plugin-pages/page.js +54 -0
  453. package/dist/vite-plugin-pages/pages.d.ts +8 -0
  454. package/dist/vite-plugin-pages/pages.js +63 -0
  455. package/dist/vite-plugin-pages/util.d.ts +8 -0
  456. package/dist/vite-plugin-pages/util.js +15 -0
  457. package/dist/vite-plugin-renderers/index.d.ts +9 -0
  458. package/dist/vite-plugin-renderers/index.js +45 -0
  459. package/dist/vite-plugin-routes/index.d.ts +14 -0
  460. package/dist/vite-plugin-routes/index.js +181 -0
  461. package/dist/vite-plugin-scripts/index.js +27 -25
  462. package/dist/vite-plugin-scripts/page-ssr.js +3 -2
  463. package/dist/vite-plugin-utils/index.d.ts +1 -0
  464. package/dist/vite-plugin-utils/index.js +2 -1
  465. package/dist/zod.d.ts +2 -2
  466. package/dist/zod.js +2 -2
  467. package/package.json +35 -32
  468. package/templates/content/module.mjs +1 -0
  469. package/templates/content/types.d.ts +24 -11
  470. package/types/actions.d.ts +1 -5
  471. package/types/content.d.ts +9 -11
  472. package/types/transitions.d.ts +25 -0
  473. package/dist/actions/loadActions.d.ts +0 -8
  474. package/dist/actions/loadActions.js +0 -13
  475. package/dist/actions/runtime/route.d.ts +0 -2
  476. package/dist/actions/runtime/shared.d.ts +0 -60
  477. package/dist/actions/runtime/shared.js +0 -296
  478. package/dist/actions/runtime/utils.d.ts +0 -25
  479. package/dist/actions/runtime/utils.js +0 -16
  480. package/dist/actions/runtime/virtual.d.ts +0 -4
  481. package/dist/actions/runtime/virtual.js +0 -127
  482. package/dist/assets/fonts/implementations/data-collector.d.ts +0 -3
  483. package/dist/assets/fonts/implementations/data-collector.js +0 -21
  484. package/dist/assets/fonts/implementations/error-handler.d.ts +0 -2
  485. package/dist/assets/fonts/implementations/error-handler.js +0 -41
  486. package/dist/assets/fonts/implementations/font-fetcher.d.ts +0 -8
  487. package/dist/assets/fonts/implementations/font-fetcher.js +0 -34
  488. package/dist/assets/fonts/implementations/font-file-reader.d.ts +0 -4
  489. package/dist/assets/fonts/implementations/font-file-reader.js +0 -26
  490. package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +0 -5
  491. package/dist/assets/fonts/implementations/font-metrics-resolver.js +0 -66
  492. package/dist/assets/fonts/implementations/font-type-extractor.d.ts +0 -4
  493. package/dist/assets/fonts/implementations/font-type-extractor.js +0 -22
  494. package/dist/assets/fonts/implementations/hasher.d.ts +0 -2
  495. package/dist/assets/fonts/implementations/hasher.js +0 -14
  496. package/dist/assets/fonts/implementations/levenshtein-string-matcher.d.ts +0 -2
  497. package/dist/assets/fonts/implementations/levenshtein-string-matcher.js +0 -147
  498. package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +0 -5
  499. package/dist/assets/fonts/implementations/local-provider-url-resolver.js +0 -17
  500. package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +0 -6
  501. package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +0 -20
  502. package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +0 -6
  503. package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +0 -47
  504. package/dist/assets/fonts/implementations/storage.d.ts +0 -4
  505. package/dist/assets/fonts/implementations/storage.js +0 -14
  506. package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +0 -11
  507. package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +0 -5
  508. package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +0 -28
  509. package/dist/assets/fonts/implementations/url-proxy-hash-resolver.d.ts +0 -8
  510. package/dist/assets/fonts/implementations/url-proxy-hash-resolver.js +0 -39
  511. package/dist/assets/fonts/implementations/url-proxy.d.ts +0 -7
  512. package/dist/assets/fonts/implementations/url-proxy.js +0 -31
  513. package/dist/assets/fonts/implementations/url-resolver.d.ts +0 -11
  514. package/dist/assets/fonts/implementations/url-resolver.js +0 -55
  515. package/dist/assets/utils/node/emitAsset.d.ts +0 -15
  516. package/dist/assets/utils/remotePattern.d.ts +0 -3
  517. package/dist/assets/utils/remotePattern.js +0 -16
  518. package/dist/assets/utils/transformToPath.js +0 -32
  519. package/dist/cli/docs/domains/platform.d.ts +0 -1
  520. package/dist/cli/docs/infra/process-platform-provider.d.ts +0 -2
  521. package/dist/cli/docs/infra/process-platform-provider.js +0 -11
  522. package/dist/cli/docs/infra/tinyexec-command-executor.d.ts +0 -2
  523. package/dist/cli/docs/infra/tinyexec-command-executor.js +0 -30
  524. package/dist/cli/info/index.d.ts +0 -12
  525. package/dist/cli/info/index.js +0 -267
  526. package/dist/cli/infra/picocolors-text-styler.d.ts +0 -2
  527. package/dist/cli/infra/picocolors-text-styler.js +0 -7
  528. package/dist/core/build/css-asset-name.d.ts +0 -9
  529. package/dist/core/build/css-asset-name.js +0 -89
  530. package/dist/core/build/plugin.d.ts +0 -43
  531. package/dist/core/build/plugin.js +0 -61
  532. package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
  533. package/dist/core/build/plugins/plugin-actions.js +0 -16
  534. package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
  535. package/dist/core/build/plugins/plugin-chunks.js +0 -33
  536. package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
  537. package/dist/core/build/plugins/plugin-pages.js +0 -66
  538. package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
  539. package/dist/core/build/plugins/plugin-renderers.js +0 -54
  540. package/dist/core/middleware/loadMiddleware.d.ts +0 -7
  541. package/dist/core/middleware/loadMiddleware.js +0 -14
  542. package/dist/core/redirects/helpers.d.ts +0 -7
  543. package/dist/core/redirects/helpers.js +0 -10
  544. package/dist/core/routing/manifest/serialization.d.ts +0 -5
  545. package/dist/core/routing/manifest/serialization.js +0 -37
  546. package/dist/prerender/metadata.d.ts +0 -8
  547. package/dist/prerender/metadata.js +0 -18
  548. package/dist/vite-plugin-astro-server/css.d.ts +0 -13
  549. package/dist/vite-plugin-astro-server/css.js +0 -48
  550. package/dist/vite-plugin-astro-server/pipeline.js +0 -161
  551. package/dist/vite-plugin-astro-server/request.d.ts +0 -14
  552. package/dist/vite-plugin-astro-server/request.js +0 -66
  553. package/dist/vite-plugin-astro-server/route.d.ts +0 -25
  554. package/dist/vite-plugin-astro-server/route.js +0 -283
  555. package/dist/vite-plugin-scanner/index.d.ts +0 -10
  556. package/dist/vite-plugin-scanner/index.js +0 -87
  557. package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
  558. package/dist/vite-plugin-ssr-manifest/index.js +0 -26
  559. /package/dist/{cli/docs/domains/platform.js → actions/runtime/types.js} +0 -0
  560. /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.d.ts +0 -0
  561. /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.js +0 -0
  562. /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.d.ts +0 -0
  563. /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.js +0 -0
  564. /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.d.ts +0 -0
  565. /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.js +0 -0
  566. /package/dist/assets/fonts/{logic → core}/resolve-families.d.ts +0 -0
  567. /package/dist/assets/fonts/{logic → core}/resolve-families.js +0 -0
@@ -0,0 +1,37 @@
1
+ class DevUrlProxyHashResolver {
2
+ #hasher;
3
+ #contentResolver;
4
+ constructor({
5
+ hasher,
6
+ contentResolver
7
+ }) {
8
+ this.#hasher = hasher;
9
+ this.#contentResolver = contentResolver;
10
+ }
11
+ #formatWeight(weight) {
12
+ if (Array.isArray(weight)) {
13
+ return weight.join("-");
14
+ }
15
+ if (typeof weight === "number") {
16
+ return weight.toString();
17
+ }
18
+ return weight?.replace(/\s+/g, "-");
19
+ }
20
+ resolve({
21
+ cssVariable,
22
+ data,
23
+ originalUrl,
24
+ type
25
+ }) {
26
+ return [
27
+ cssVariable.slice(2),
28
+ this.#formatWeight(data.weight),
29
+ data.style,
30
+ data.subset,
31
+ `${this.#hasher.hashString(this.#contentResolver.resolve(originalUrl))}.${type}`
32
+ ].filter(Boolean).join("-");
33
+ }
34
+ }
35
+ export {
36
+ DevUrlProxyHashResolver
37
+ };
@@ -0,0 +1,10 @@
1
+ import type { UrlResolver } from '../definitions.js';
2
+ export declare class DevUrlResolver implements UrlResolver {
3
+ #private;
4
+ constructor({ base, searchParams, }: {
5
+ base: string;
6
+ searchParams: URLSearchParams;
7
+ });
8
+ resolve(hash: string): string;
9
+ get cspResources(): Array<string>;
10
+ }
@@ -0,0 +1,29 @@
1
+ import { joinPaths, prependForwardSlash } from "../../../core/path.js";
2
+ import { createPlaceholderURL, stringifyPlaceholderURL } from "../../utils/url.js";
3
+ class DevUrlResolver {
4
+ #resolved = false;
5
+ #base;
6
+ #searchParams;
7
+ constructor({
8
+ base,
9
+ searchParams
10
+ }) {
11
+ this.#base = base;
12
+ this.#searchParams = searchParams;
13
+ }
14
+ resolve(hash) {
15
+ this.#resolved ||= true;
16
+ const urlPath = prependForwardSlash(joinPaths(this.#base, hash));
17
+ const url = createPlaceholderURL(urlPath);
18
+ this.#searchParams.forEach((value, key) => {
19
+ url.searchParams.set(key, value);
20
+ });
21
+ return stringifyPlaceholderURL(url);
22
+ }
23
+ get cspResources() {
24
+ return this.#resolved ? ["'self'"] : [];
25
+ }
26
+ }
27
+ export {
28
+ DevUrlResolver
29
+ };
@@ -0,0 +1,5 @@
1
+ import type { FontTypeExtractor } from '../definitions.js';
2
+ import type { FontType } from '../types.js';
3
+ export declare class RealFontTypeExtractor implements FontTypeExtractor {
4
+ extract(url: string): FontType;
5
+ }
@@ -0,0 +1,21 @@
1
+ import { extname } from "node:path";
2
+ import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
3
+ import { isFontType } from "../utils.js";
4
+ class RealFontTypeExtractor {
5
+ extract(url) {
6
+ const extension = extname(url).slice(1);
7
+ if (!isFontType(extension)) {
8
+ throw new AstroError(
9
+ {
10
+ ...AstroErrorData.CannotExtractFontType,
11
+ message: AstroErrorData.CannotExtractFontType.message(url)
12
+ },
13
+ { cause: `Unexpected extension, got "${extension}"` }
14
+ );
15
+ }
16
+ return extension;
17
+ }
18
+ }
19
+ export {
20
+ RealFontTypeExtractor
21
+ };
@@ -0,0 +1,11 @@
1
+ import type { FontFileReader } from '../definitions.js';
2
+ import type { Style } from '../types.js';
3
+ export declare class FontaceFontFileReader implements FontFileReader {
4
+ extract({ family, url }: {
5
+ family: string;
6
+ url: string;
7
+ }): {
8
+ weight: string;
9
+ style: Style;
10
+ };
11
+ }
@@ -0,0 +1,25 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { fontace } from "fontace";
3
+ import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
4
+ class FontaceFontFileReader {
5
+ extract({ family, url }) {
6
+ try {
7
+ const data = fontace(readFileSync(url));
8
+ return {
9
+ weight: data.weight,
10
+ style: data.style
11
+ };
12
+ } catch (cause) {
13
+ throw new AstroError(
14
+ {
15
+ ...AstroErrorData.CannotDetermineWeightAndStyleFromFontFile,
16
+ message: AstroErrorData.CannotDetermineWeightAndStyleFromFontFile.message(family, url)
17
+ },
18
+ { cause }
19
+ );
20
+ }
21
+ }
22
+ }
23
+ export {
24
+ FontaceFontFileReader
25
+ };
@@ -0,0 +1,5 @@
1
+ import type { StringMatcher } from '../definitions.js';
2
+ export declare class LevenshteinStringMatcher implements StringMatcher {
3
+ #private;
4
+ getClosestMatch(target: string, candidates: Array<string>): string;
5
+ }
@@ -0,0 +1,145 @@
1
+ class LevenshteinStringMatcher {
2
+ #peq = new Uint32Array(65536);
3
+ #myers_32(a, b) {
4
+ const n = a.length;
5
+ const m = b.length;
6
+ const lst = 1 << n - 1;
7
+ let pv = -1;
8
+ let mv = 0;
9
+ let sc = n;
10
+ let i = n;
11
+ while (i--) {
12
+ this.#peq[a.charCodeAt(i)] |= 1 << i;
13
+ }
14
+ for (i = 0; i < m; i++) {
15
+ let eq = this.#peq[b.charCodeAt(i)];
16
+ const xv = eq | mv;
17
+ eq |= (eq & pv) + pv ^ pv;
18
+ mv |= ~(eq | pv);
19
+ pv &= eq;
20
+ if (mv & lst) {
21
+ sc++;
22
+ }
23
+ if (pv & lst) {
24
+ sc--;
25
+ }
26
+ mv = mv << 1 | 1;
27
+ pv = pv << 1 | ~(xv | mv);
28
+ mv &= xv;
29
+ }
30
+ i = n;
31
+ while (i--) {
32
+ this.#peq[a.charCodeAt(i)] = 0;
33
+ }
34
+ return sc;
35
+ }
36
+ #myers_x(b, a) {
37
+ const n = a.length;
38
+ const m = b.length;
39
+ const mhc = [];
40
+ const phc = [];
41
+ const hsize = Math.ceil(n / 32);
42
+ const vsize = Math.ceil(m / 32);
43
+ for (let i = 0; i < hsize; i++) {
44
+ phc[i] = -1;
45
+ mhc[i] = 0;
46
+ }
47
+ let j = 0;
48
+ for (; j < vsize - 1; j++) {
49
+ let mv2 = 0;
50
+ let pv2 = -1;
51
+ const start2 = j * 32;
52
+ const vlen2 = Math.min(32, m) + start2;
53
+ for (let k = start2; k < vlen2; k++) {
54
+ this.#peq[b.charCodeAt(k)] |= 1 << k;
55
+ }
56
+ for (let i = 0; i < n; i++) {
57
+ const eq = this.#peq[a.charCodeAt(i)];
58
+ const pb = phc[i / 32 | 0] >>> i & 1;
59
+ const mb = mhc[i / 32 | 0] >>> i & 1;
60
+ const xv = eq | mv2;
61
+ const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb;
62
+ let ph = mv2 | ~(xh | pv2);
63
+ let mh = pv2 & xh;
64
+ if (ph >>> 31 ^ pb) {
65
+ phc[i / 32 | 0] ^= 1 << i;
66
+ }
67
+ if (mh >>> 31 ^ mb) {
68
+ mhc[i / 32 | 0] ^= 1 << i;
69
+ }
70
+ ph = ph << 1 | pb;
71
+ mh = mh << 1 | mb;
72
+ pv2 = mh | ~(xv | ph);
73
+ mv2 = ph & xv;
74
+ }
75
+ for (let k = start2; k < vlen2; k++) {
76
+ this.#peq[b.charCodeAt(k)] = 0;
77
+ }
78
+ }
79
+ let mv = 0;
80
+ let pv = -1;
81
+ const start = j * 32;
82
+ const vlen = Math.min(32, m - start) + start;
83
+ for (let k = start; k < vlen; k++) {
84
+ this.#peq[b.charCodeAt(k)] |= 1 << k;
85
+ }
86
+ let score = m;
87
+ for (let i = 0; i < n; i++) {
88
+ const eq = this.#peq[a.charCodeAt(i)];
89
+ const pb = phc[i / 32 | 0] >>> i & 1;
90
+ const mb = mhc[i / 32 | 0] >>> i & 1;
91
+ const xv = eq | mv;
92
+ const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
93
+ let ph = mv | ~(xh | pv);
94
+ let mh = pv & xh;
95
+ score += ph >>> m - 1 & 1;
96
+ score -= mh >>> m - 1 & 1;
97
+ if (ph >>> 31 ^ pb) {
98
+ phc[i / 32 | 0] ^= 1 << i;
99
+ }
100
+ if (mh >>> 31 ^ mb) {
101
+ mhc[i / 32 | 0] ^= 1 << i;
102
+ }
103
+ ph = ph << 1 | pb;
104
+ mh = mh << 1 | mb;
105
+ pv = mh | ~(xv | ph);
106
+ mv = ph & xv;
107
+ }
108
+ for (let k = start; k < vlen; k++) {
109
+ this.#peq[b.charCodeAt(k)] = 0;
110
+ }
111
+ return score;
112
+ }
113
+ #distance(a, b) {
114
+ if (a.length < b.length) {
115
+ const tmp = b;
116
+ b = a;
117
+ a = tmp;
118
+ }
119
+ if (b.length === 0) {
120
+ return a.length;
121
+ }
122
+ if (a.length <= 32) {
123
+ return this.#myers_32(a, b);
124
+ }
125
+ return this.#myers_x(a, b);
126
+ }
127
+ #closest(str, arr) {
128
+ let min_distance = Infinity;
129
+ let min_index = 0;
130
+ for (let i = 0; i < arr.length; i++) {
131
+ const dist = this.#distance(str, arr[i]);
132
+ if (dist < min_distance) {
133
+ min_distance = dist;
134
+ min_index = i;
135
+ }
136
+ }
137
+ return arr[min_index];
138
+ }
139
+ getClosestMatch(target, candidates) {
140
+ return this.#closest(target, candidates);
141
+ }
142
+ }
143
+ export {
144
+ LevenshteinStringMatcher
145
+ };
@@ -0,0 +1,4 @@
1
+ import type { UrlProxyContentResolver } from '../definitions.js';
2
+ export declare class LocalUrlProxyContentResolver implements UrlProxyContentResolver {
3
+ resolve(url: string): string;
4
+ }
@@ -0,0 +1,14 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
3
+ class LocalUrlProxyContentResolver {
4
+ resolve(url) {
5
+ try {
6
+ return url + readFileSync(url, "utf-8");
7
+ } catch (cause) {
8
+ throw new AstroError(AstroErrorData.UnknownFilesystemError, { cause });
9
+ }
10
+ }
11
+ }
12
+ export {
13
+ LocalUrlProxyContentResolver
14
+ };
@@ -4,6 +4,11 @@ export declare function renderCssVariable(key: string, values: Array<string>, mi
4
4
  export declare function withFamily(family: string, properties: CssProperties): CssProperties;
5
5
  /** If the value contains spaces (which would be incorrectly interpreted), we wrap it in quotes. */
6
6
  export declare function handleValueWithSpaces(value: string): string;
7
- export declare function createMinifiableCssRenderer({ minify }: {
8
- minify: boolean;
9
- }): CssRenderer;
7
+ export declare class MinifiableCssRenderer implements CssRenderer {
8
+ #private;
9
+ constructor({ minify }: {
10
+ minify: boolean;
11
+ });
12
+ generateFontFace(family: string, properties: CssProperties): string;
13
+ generateCssVariable(key: string, values: Array<string>): string;
14
+ }
@@ -23,18 +23,20 @@ function handleValueWithSpaces(value) {
23
23
  }
24
24
  return value;
25
25
  }
26
- function createMinifiableCssRenderer({ minify }) {
27
- return {
28
- generateFontFace(family, properties) {
29
- return renderFontFace(withFamily(family, properties), minify);
30
- },
31
- generateCssVariable(key, values) {
32
- return renderCssVariable(key, values, minify);
33
- }
34
- };
26
+ class MinifiableCssRenderer {
27
+ #minify;
28
+ constructor({ minify }) {
29
+ this.#minify = minify;
30
+ }
31
+ generateFontFace(family, properties) {
32
+ return renderFontFace(withFamily(family, properties), this.#minify);
33
+ }
34
+ generateCssVariable(key, values) {
35
+ return renderCssVariable(key, values, this.#minify);
36
+ }
35
37
  }
36
38
  export {
37
- createMinifiableCssRenderer,
39
+ MinifiableCssRenderer,
38
40
  handleValueWithSpaces,
39
41
  renderCssVariable,
40
42
  renderFontFace,
@@ -0,0 +1,10 @@
1
+ import type { RemoteFontProviderModResolver, RemoteFontProviderResolver } from '../definitions.js';
2
+ import type { AstroFontProvider, ResolvedFontProvider } from '../types.js';
3
+ export declare class RealRemoteFontProviderResolver implements RemoteFontProviderResolver {
4
+ #private;
5
+ constructor({ root, modResolver, }: {
6
+ root: URL;
7
+ modResolver: RemoteFontProviderModResolver;
8
+ });
9
+ resolve({ entrypoint, config }: AstroFontProvider): Promise<ResolvedFontProvider>;
10
+ }
@@ -0,0 +1,49 @@
1
+ import { AstroError, AstroErrorData } from "../../../core/errors/index.js";
2
+ import { resolveEntrypoint } from "../utils.js";
3
+ class RealRemoteFontProviderResolver {
4
+ #root;
5
+ #modResolver;
6
+ constructor({
7
+ root,
8
+ modResolver
9
+ }) {
10
+ this.#root = root;
11
+ this.#modResolver = modResolver;
12
+ }
13
+ #validateMod({
14
+ mod,
15
+ entrypoint
16
+ }) {
17
+ try {
18
+ if (typeof mod !== "object" || mod === null) {
19
+ throw new Error(`Expected an object for the module, but received ${typeof mod}.`);
20
+ }
21
+ if (typeof mod.provider !== "function") {
22
+ throw new Error(`Invalid provider export in module, expected a function.`);
23
+ }
24
+ return {
25
+ provider: mod.provider
26
+ };
27
+ } catch (cause) {
28
+ throw new AstroError(
29
+ {
30
+ ...AstroErrorData.CannotLoadFontProvider,
31
+ message: AstroErrorData.CannotLoadFontProvider.message(entrypoint)
32
+ },
33
+ { cause }
34
+ );
35
+ }
36
+ }
37
+ async resolve({ entrypoint, config }) {
38
+ const id = resolveEntrypoint(this.#root, entrypoint.toString()).href;
39
+ const mod = await this.#modResolver.resolve(id);
40
+ const { provider } = this.#validateMod({
41
+ mod,
42
+ entrypoint: id
43
+ });
44
+ return { config, provider };
45
+ }
46
+ }
47
+ export {
48
+ RealRemoteFontProviderResolver
49
+ };
@@ -0,0 +1,4 @@
1
+ import type { UrlProxyContentResolver } from '../definitions.js';
2
+ export declare class RemoteUrlProxyContentResolver implements UrlProxyContentResolver {
3
+ resolve(url: string): string;
4
+ }
@@ -0,0 +1,9 @@
1
+ class RemoteUrlProxyContentResolver {
2
+ // Passthrough, the remote provider URL is enough
3
+ resolve(url) {
4
+ return url;
5
+ }
6
+ }
7
+ export {
8
+ RemoteUrlProxyContentResolver
9
+ };
@@ -0,0 +1,9 @@
1
+ import type { LocalProviderUrlResolver } from '../definitions.js';
2
+ export declare class RequireLocalProviderUrlResolver implements LocalProviderUrlResolver {
3
+ #private;
4
+ constructor({ root, intercept, }: {
5
+ root: URL;
6
+ intercept?: ((path: string) => void) | undefined;
7
+ });
8
+ resolve(input: string): string;
9
+ }
@@ -0,0 +1,22 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { resolveEntrypoint } from "../utils.js";
3
+ class RequireLocalProviderUrlResolver {
4
+ #root;
5
+ // TODO: remove when stabilizing
6
+ #intercept;
7
+ constructor({
8
+ root,
9
+ intercept
10
+ }) {
11
+ this.#root = root;
12
+ this.#intercept = intercept;
13
+ }
14
+ resolve(input) {
15
+ const path = fileURLToPath(resolveEntrypoint(this.#root, input));
16
+ this.#intercept?.(path);
17
+ return path;
18
+ }
19
+ }
20
+ export {
21
+ RequireLocalProviderUrlResolver
22
+ };
@@ -0,0 +1,6 @@
1
+ import type { SystemFallbacksProvider } from '../definitions.js';
2
+ import type { FontFaceMetrics, GenericFallbackName } from '../types.js';
3
+ export declare class RealSystemFallbacksProvider implements SystemFallbacksProvider {
4
+ getLocalFonts(fallback: GenericFallbackName): Array<string> | null;
5
+ getMetricsForLocalFont(family: string): FontFaceMetrics;
6
+ }
@@ -58,17 +58,14 @@ const DEFAULT_FALLBACKS = {
58
58
  "ui-sans-serif": ["Arial"],
59
59
  "ui-monospace": ["Courier New"]
60
60
  };
61
- function createSystemFallbacksProvider() {
62
- return {
63
- getLocalFonts(fallback) {
64
- return DEFAULT_FALLBACKS[fallback] ?? null;
65
- },
66
- getMetricsForLocalFont(family) {
67
- return SYSTEM_METRICS[family];
68
- }
69
- };
61
+ class RealSystemFallbacksProvider {
62
+ getLocalFonts(fallback) {
63
+ return DEFAULT_FALLBACKS[fallback] ?? null;
64
+ }
65
+ getMetricsForLocalFont(family) {
66
+ return SYSTEM_METRICS[family];
67
+ }
70
68
  }
71
69
  export {
72
- DEFAULT_FALLBACKS,
73
- createSystemFallbacksProvider
70
+ RealSystemFallbacksProvider
74
71
  };
@@ -0,0 +1,11 @@
1
+ import type { Storage } from '../definitions.js';
2
+ export declare class UnstorageFsStorage implements Storage {
3
+ #private;
4
+ constructor({ base }: {
5
+ base: URL;
6
+ });
7
+ getItem(key: string): Promise<any | null>;
8
+ getItemRaw(key: string): Promise<Buffer | null>;
9
+ setItem(key: string, value: any): Promise<void>;
10
+ setItemRaw(key: string, value: any): Promise<void>;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import * as unstorage from "unstorage";
3
+ import fsLiteDriver from "unstorage/drivers/fs-lite";
4
+ class UnstorageFsStorage {
5
+ #unstorage;
6
+ constructor({ base }) {
7
+ this.#unstorage = unstorage.createStorage({
8
+ driver: fsLiteDriver({ base: fileURLToPath(base) })
9
+ });
10
+ }
11
+ async getItem(key) {
12
+ return await this.#unstorage.getItem(key);
13
+ }
14
+ async getItemRaw(key) {
15
+ return await this.#unstorage.getItemRaw(key);
16
+ }
17
+ async setItem(key, value) {
18
+ return await this.#unstorage.setItem(key, value);
19
+ }
20
+ async setItemRaw(key, value) {
21
+ return await this.#unstorage.setItemRaw(key, value);
22
+ }
23
+ }
24
+ export {
25
+ UnstorageFsStorage
26
+ };
@@ -0,0 +1,16 @@
1
+ import type { DataCollector, ProxyData, UrlProxy, UrlProxyHashResolver, UrlResolver } from '../definitions.js';
2
+ import type { FontFileData, FontType } from '../types.js';
3
+ export declare class RealUrlProxy implements UrlProxy {
4
+ #private;
5
+ constructor({ hashResolver, dataCollector, urlResolver, cssVariable, }: {
6
+ hashResolver: UrlProxyHashResolver;
7
+ dataCollector: DataCollector;
8
+ urlResolver: UrlResolver;
9
+ cssVariable: string;
10
+ });
11
+ proxy({ url: originalUrl, type, data, collectPreload, init, }: Pick<FontFileData, 'url' | 'init'> & {
12
+ type: FontType;
13
+ collectPreload: boolean;
14
+ data: ProxyData;
15
+ }): string;
16
+ }
@@ -0,0 +1,50 @@
1
+ import { renderFontWeight } from "../utils.js";
2
+ class RealUrlProxy {
3
+ #hashResolver;
4
+ #dataCollector;
5
+ #urlResolver;
6
+ #cssVariable;
7
+ constructor({
8
+ hashResolver,
9
+ dataCollector,
10
+ urlResolver,
11
+ cssVariable
12
+ }) {
13
+ this.#hashResolver = hashResolver;
14
+ this.#dataCollector = dataCollector;
15
+ this.#urlResolver = urlResolver;
16
+ this.#cssVariable = cssVariable;
17
+ }
18
+ proxy({
19
+ url: originalUrl,
20
+ type,
21
+ data,
22
+ collectPreload,
23
+ init
24
+ }) {
25
+ const hash = this.#hashResolver.resolve({
26
+ cssVariable: this.#cssVariable,
27
+ data,
28
+ originalUrl,
29
+ type
30
+ });
31
+ const url = this.#urlResolver.resolve(hash);
32
+ this.#dataCollector.collect({
33
+ url: originalUrl,
34
+ hash,
35
+ preload: collectPreload ? {
36
+ url,
37
+ type,
38
+ weight: renderFontWeight(data.weight),
39
+ style: data.style,
40
+ subset: data.subset
41
+ } : null,
42
+ data,
43
+ init
44
+ });
45
+ return url;
46
+ }
47
+ }
48
+ export {
49
+ RealUrlProxy
50
+ };
@@ -0,0 +1,7 @@
1
+ import type { Hasher } from '../definitions.js';
2
+ export declare class XxhashHasher implements Hasher {
3
+ hashString: (input: string) => string;
4
+ private constructor();
5
+ static create(): Promise<XxhashHasher>;
6
+ hashObject(input: Record<string, any>): string;
7
+ }
@@ -0,0 +1,18 @@
1
+ import xxhash from "xxhash-wasm";
2
+ import { sortObjectByKey } from "../utils.js";
3
+ class XxhashHasher {
4
+ hashString;
5
+ constructor(hashString) {
6
+ this.hashString = hashString;
7
+ }
8
+ static async create() {
9
+ const { h64ToString } = await xxhash();
10
+ return new XxhashHasher(h64ToString);
11
+ }
12
+ hashObject(input) {
13
+ return this.hashString(JSON.stringify(sortObjectByKey(input)));
14
+ }
15
+ }
16
+ export {
17
+ XxhashHasher
18
+ };
@@ -1,6 +1,5 @@
1
- import type { Storage } from 'unstorage';
2
1
  import type { Logger } from '../../core/logger/core.js';
3
- import type { CssRenderer, FontFileReader, FontMetricsResolver, FontTypeExtractor, Hasher, LocalProviderUrlResolver, RemoteFontProviderResolver, StringMatcher, SystemFallbacksProvider, UrlProxy } from './definitions.js';
2
+ import type { CssRenderer, FontFileReader, FontMetricsResolver, FontTypeExtractor, Hasher, LocalProviderUrlResolver, RemoteFontProviderResolver, Storage, StringMatcher, SystemFallbacksProvider, UrlProxy } from './definitions.js';
4
3
  import type { ConsumableMap, CreateUrlProxyParams, Defaults, FontFamily, FontFileDataMap, InternalConsumableMap } from './types.js';
5
4
  /**
6
5
  * Manages how fonts are resolved: