forked from laptou/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (w…
…ithastro#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
099c4d5
commit 31110e3
Showing
30 changed files
with
361 additions
and
233 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
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.