-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support re-exporting astro components containing client components (#…
…3625) * Support re-exporting astro components containing client components * Include metadata for markdown too * Fix ssr, probably * Inject post-build * Remove tagName custom element test * Allows using the constructor for lit elements * Fix hoisted script scanning * Pass through plugin context * Get edge functions working in the edge tests * Fix types for the edge function integration * Upgrade the compiler * Upgrade compiler version * Better release notes for lit * Update .changeset/unlucky-hairs-camp.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Properly test that the draft was not rendered * Prevent from rendering draft posts * Add a changeset about the build perf improvement. Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
- Loading branch information
1 parent
411af7a
commit f5afaf2
Showing
40 changed files
with
434 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Significantly improved build performance | ||
|
||
This change reflects in a significantly improved build performance, especially on larger sites. | ||
|
||
With this change Astro is not building everything by statically analyzing `.astro` files. This means it no longer needs to dynamically *run* your code in order to know what JavaScript needs to be built. | ||
|
||
With one particular large site we found it to build __32%__ faster. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@astrojs/lit': minor | ||
--- | ||
|
||
Conform to Constructor based rendering | ||
|
||
This changes `@astrojs/lit` to conform to the way rendering happens in all other frameworks. Instead of using the tag name `<my-element client:load>` you use the imported constructor function, `<MyElement client:load>` like you would do with any other framework. | ||
|
||
Support for `tag-name` syntax had to be removed due to the fact that it was a runtime feature that was not statically analyzable. To improve build performance, we have removed all runtime based component discovery. Using the imported Constructor name allows Astro to discover what components need to be built and bundled for production without ever running your file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { GetModuleInfo, ModuleInfo, OutputChunk } from 'rollup'; | ||
import { resolvedPagesVirtualModuleId } from '../app/index.js'; | ||
|
||
// This walks up the dependency graph and yields out each ModuleInfo object. | ||
export function* walkParentInfos( | ||
id: string, | ||
ctx: { getModuleInfo: GetModuleInfo }, | ||
seen = new Set<string>() | ||
): Generator<ModuleInfo, void, unknown> { | ||
seen.add(id); | ||
const info = ctx.getModuleInfo(id); | ||
if (info) { | ||
yield info; | ||
} | ||
const importers = (info?.importers || []).concat(info?.dynamicImporters || []); | ||
for (const imp of importers) { | ||
if (seen.has(imp)) { | ||
continue; | ||
} | ||
yield* walkParentInfos(imp, ctx, seen); | ||
} | ||
} | ||
|
||
// This function walks the dependency graph, going up until it finds a page component. | ||
// This could be a .astro page or a .md page. | ||
export function* getTopLevelPages( | ||
id: string, | ||
ctx: { getModuleInfo: GetModuleInfo } | ||
): Generator<string, void, unknown> { | ||
for (const info of walkParentInfos(id, ctx)) { | ||
const importers = (info?.importers || []).concat(info?.dynamicImporters || []); | ||
if (importers.length <= 2 && importers[0] === resolvedPagesVirtualModuleId) { | ||
yield info.id; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.