Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore mount #644

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions runtime/fresh/middlewares/1_alienRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { MiddlewareHandlerContext, weakcache } from "../../../deps.ts";
import { fromEndpoint } from "../../../engine/releases/fetcher.ts";
import { newContext } from "../../../mod.ts";
import { DecoSiteState, DecoState } from "../../../types.ts";
import { contextFromVolume } from "../../context.ts";

interface Opts {
cacheSize?: number;
Expand Down Expand Up @@ -68,38 +67,31 @@ export async function alienRelease(
: [alienReleaseFromCookie, false];

// If the inline release is a string, create a new context cache
if (typeof alienRelease === "string") {
if (typeof alienRelease === "string" && !alienRelease.includes("watch.ts")) {
contextCache ??= new ContextCache({
cacheSize: 7, // 7 is arbitrarily chosen
});
let contextPromise: Promise<DecoContext> | undefined = contextCache.get(
alienRelease,
);
if (!contextPromise) {
const isVolumeKind = alienRelease.includes("watch.ts");
if (!isVolumeKind) {
const active = Context.active();
const { manifest, importMap } = await active.runtime!;
contextPromise = newContext(
manifest,
importMap,
fromEndpoint(alienRelease),
alienRelease,
);
} else {
contextPromise = contextFromVolume(alienRelease, () => {
contextCache?.delete(alienRelease);
});
}
contextCache.set(
const active = Context.active();
const { manifest, importMap } = await active.runtime!;
contextPromise = newContext(
manifest,
importMap,
fromEndpoint(alienRelease),
alienRelease,
contextPromise.catch((err) => {
console.error("context creation error", err);
contextCache?.delete(alienRelease);
throw err;
}),
);
}
contextCache.set(
alienRelease,
contextPromise.catch((err) => {
console.error("context creation error", err);
contextCache?.delete(alienRelease);
throw err;
}),
);
const ctx = await contextPromise;

const next = Context.bind(ctx, context.next.bind(context));
Expand Down
Loading