| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Improve rendering performance for pages with many components (#17344) * fix(head-propagation): collect propagated head parts in a single pass The collection loop restarted its scan of the propagator set once per propagator (skipping seen entries) to reach propagators registered during init(). That skip-scan is O(N^2) in set-iteration steps; pages rendering thousands of propagating component instances spend most of their render time in it. A JS Set iterator already visits entries added during iteration, in insertion order, so a single pass has identical traversal order and semantics. Pending slot evaluations are drained before the iterator advances, so nothing can register a propagator after the iterator has completed. Adds regression tests asserting linear iteration and covering the in-loop drain of async slot pre-renders queued by a propagator's init(). * benchmark: add head-propagation scaling pages to rendering-perf Every MDX <Content /> instance registers a head propagator, so these pages put N entries into the set that collectPropagatedHeadParts iterates. Two sizes (1000/2000) make the complexity class visible, not just point cost: linear collection keeps the 2000-page near 2x the 1000-page, while a quadratic rescan of the propagator set pushes the pair toward 4x and more than doubles the 2000-page's absolute cost. The entry must be MDX: plain data-store markdown does not mark the route for propagation (handlePropagation), so its Content instances never enter the propagator set. | 2 个月前 | |
Improve rendering performance for pages with many components (#17344) * fix(head-propagation): collect propagated head parts in a single pass The collection loop restarted its scan of the propagator set once per propagator (skipping seen entries) to reach propagators registered during init(). That skip-scan is O(N^2) in set-iteration steps; pages rendering thousands of propagating component instances spend most of their render time in it. A JS Set iterator already visits entries added during iteration, in insertion order, so a single pass has identical traversal order and semantics. Pending slot evaluations are drained before the iterator advances, so nothing can register a propagator after the iterator has completed. Adds regression tests asserting linear iteration and covering the in-loop drain of async slot pre-renders queued by a propagator's init(). * benchmark: add head-propagation scaling pages to rendering-perf Every MDX <Content /> instance registers a head propagator, so these pages put N entries into the set that collectPropagatedHeadParts iterates. Two sizes (1000/2000) make the complexity class visible, not just point cost: linear collection keeps the 2000-page near 2x the 1000-page, while a quadratic rescan of the propagator set pushes the pair toward 4x and more than doubles the 2000-page's absolute cost. The entry must be MDX: plain data-store markdown does not mark the route for propagation (handlePropagation), so its Content instances never enter the propagator set. | 2 个月前 | |
Refactor internal request handling into a functional core (#17636) * Refactor request handling into a purely functional core Replace the App/Pipeline god objects with pure functions drawing static data from the manifest (the only permitted ambient source of truth): - All internal handler classes (AstroHandler, PagesHandler, AstroMiddleware, CacheHandler, ActionHandler, I18n, Rewrites, TrailingSlashHandler, error handlers, session provider) are now module functions rooted in FetchState. - FetchState constructs from (manifest, request, options?, hooks?); the public one-arg new FetchState(request) works from a bare Request by reaching the manifest module directly (ambient), with no app handle. - Symbol.for('astro.app') and Symbol.for('astro.pipeline') are deleted; nothing static rides the request. Render options carry only render() inputs. - Environment differences (prod SSR, dev runnable/non-runnable, build, container) are per-manifest RenderEnvironment records composed at entrypoint time; production is the zero-setup default. - Process-lifetime derivations (route table, middleware, actions, session driver, cache provider, logger, renderers) are WeakMap memos keyed by the manifest in their owning modules. - App and NodeApp remain public facades with unchanged signatures; every method delegates to the functional core. app.pipeline survives as a stateless compat shim. Pipeline base and all subclasses are deleted. - Dev HMR route updates are now atomic (fixes stale-router split-brain). No public API changes. All suites green: unit, full integration, @astrojs/node, @astrojs/cloudflare (workerd), dev/HMR. * Remove stray compiled artifacts of components/index.ts * Make error-strategy switch exhaustive for lint * Address review: user-facing changesets, standalone comments Rewrites the three changesets to describe user-facing behavior instead of internals, removes all references to internal planning documents from code comments, and rewrites comments that described pre-refactor behavior to describe how the code currently works. * Add regression test for FetchState in a custom Cloudflare worker Covers the documented advanced pattern from #17591: a custom wrangler entryfile that builds its own state with `new FetchState(request)` from a bare workerd request, serves assets through `cf()`, and renders with `astro(state)`. * Remove unused DefaultFetchHandler.renderWithOptions The method had no callers — BaseApp.render constructs the FetchState itself and generated builds only use the fetch member. Also rewrites the constructor comment to describe the current contract. * Remove AppPipeline and the app.pipeline property The last surviving Pipeline: app.pipeline was undocumented, so the stateless compat shim is gone entirely. The node adapter uses the new public app.getLogger() to wait for the configured log destination, and BuildApp carries the routeCache/getComponentByRoute accessors StaticPaths needs across the prerender bundle boundary. The internal PipelineFeatures bit flags are renamed to FetchFeatures, and @astrojs/node now requires the astro version that ships app.getLogger(). * Memoize the resolved logger with createAsyncManifestMemo Replaces resolveLoggerDestination's hand-rolled WeakMap with a getResolvedLogger accessor built on the shared async manifest memo. The derivation never rejects: a custom log destination that fails to load is reported through the console logger and the request proceeds, instead of failing the first request. * Remove AppPipeline from the benchmark adapter * Address review-bot findings in the dev request path Reject the dev body-buffering promise on stream error so an aborted or malformed upload surfaces through runWithErrorHandling instead of hanging the request, and make DevFacadeApp.devMatch's pathname optional to match the BaseApp contract. * Ship the ambient-manifest stub in the publish tarball The #astro-internal/ambient-manifest types condition points at the src stub, which was not in the files list — nothing consults the path in the published package today, but shipping the file keeps the condition resolvable if a future declaration ever references the specifier. * Clarify the type-only FetchState import comment * Rewrite the RenderEnvironment doc comment in plain language * Make NoManifestAvailableError a documented error with an actionable hint * Update the FetchState no-manifest test for the new error message | 1 个月前 | |
chore(head): normalize html charset declarations (#17197) - Update meta charset from `UTF-8` to `utf-8` across layouts. - Apply the same formatting change consistently in all affected project files. - I first checked `charset="utf-8"` usage which was 191, and for `charset="UTF-8"` it was 57, therefore I've made the change to pick up the lowercase "utf-8" to normalize. | 2 个月前 | |
Refactor benchmark script (#6376) * Add timer setting * Setup benchmark code * Setup memory benchmark * Add compare function * Add result preview * Setup results preview * Simplify script for CI * Update CI * Cleanup * Temp remove fork guard * Fix stuff * Fix again * Fix quotes * Fix multiline output * Simplify title * Fix memory numbers * Remove astro bin dir * Fix gc * Add repo guards * Fix wrong call * Set max space size * Remove guard * Bump memory a bit * Organize neatly * Update readme * Try large md * Try no gc * Revert markdown and gc changes * Test sha * Try ref * Try 128mb * Set 256 * Add guard * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Add docs comment --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> | 3 年前 | |
Refactor benchmark script (#6376) * Add timer setting * Setup benchmark code * Setup memory benchmark * Add compare function * Add result preview * Setup results preview * Simplify script for CI * Update CI * Cleanup * Temp remove fork guard * Fix stuff * Fix again * Fix quotes * Fix multiline output * Simplify title * Fix memory numbers * Remove astro bin dir * Fix gc * Add repo guards * Fix wrong call * Set max space size * Remove guard * Bump memory a bit * Organize neatly * Update readme * Try large md * Try no gc * Revert markdown and gc changes * Test sha * Try ref * Try 128mb * Set 256 * Add guard * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Add docs comment --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> | 3 年前 | |
chore: remove unused imports (#12696) | 1 年前 | |
Update dependency vitest [SECURITY] (#18026) Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> | 4 天前 | |
refactor: use TypeScript project service in ESLint (#16623) | 4 个月前 | |
ci: shard benchmarks (#15314) | 7 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 4 天前 | ||
| 4 个月前 | ||
| 7 个月前 |