Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions packages/vinext/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,19 +424,19 @@ async function buildApp() {
userTransformPlugins = flat.filter(
(p): p is import("vite").Plugin =>
!!p &&
typeof (p as any).name === "string" &&
typeof p.name === "string" &&
// vinext and its sub-plugins — re-registered below
!(p as any).name.startsWith("vinext:") &&
!p.name.startsWith("vinext:") &&
// @vitejs/plugin-react — auto-registered by vinext
!(p as any).name.startsWith("vite:react") &&
!p.name.startsWith("vite:react") &&
// @vitejs/plugin-rsc and its sub-plugins — App Router only
!(p as any).name.startsWith("rsc:") &&
(p as any).name !== "vite-rsc-load-module-dev-proxy" &&
!p.name.startsWith("rsc:") &&
p.name !== "vite-rsc-load-module-dev-proxy" &&
// vite-tsconfig-paths — auto-registered by vinext
(p as any).name !== "vite-tsconfig-paths" &&
p.name !== "vite-tsconfig-paths" &&
// cloudflare() — injects multi-env environments block which
// conflicts with the plain SSR build config below
!(p as any).name.startsWith("vite-plugin-cloudflare"),
!p.name.startsWith("vite-plugin-cloudflare"),
);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/vinext/src/cloudflare/kv-cache-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export class KVCacheHandler implements CacheHandler {
// revalidate: 0 means "don't cache", so skip storage entirely.
let effectiveRevalidate: number | undefined;
if (ctx) {
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
const revalidate = (ctx as any).cacheControl?.revalidate ?? (ctx as any).revalidate;
if (typeof revalidate === "number") {
effectiveRevalidate = revalidate;
Expand Down
4 changes: 2 additions & 2 deletions packages/vinext/src/config/config-matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,8 @@ export async function proxyExternalRequest(
let upstreamResponse: Response;
try {
upstreamResponse = await fetch(targetUrl.href, { ...init, signal: controller.signal });
} catch (e: any) {
if (e?.name === "AbortError") {
} catch (e) {
if (e instanceof Error && e.name === "AbortError") {
console.error("[vinext] External rewrite proxy timeout:", targetUrl.href);
return new Response("Gateway Timeout", { status: 504 });
}
Expand Down
7 changes: 7 additions & 0 deletions packages/vinext/src/config/next-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ async function resolveConfigValue(
* Unwrap the config value from a loaded module namespace.
*/
async function unwrapConfig(
// oxlint-disable-next-line typescript/no-explicit-any
mod: any,
phase: string = PHASE_DEVELOPMENT_SERVER,
): Promise<NextConfig> {
Expand Down Expand Up @@ -656,11 +657,13 @@ async function probeWebpackConfig(
return { aliases: {}, mdx: null };
}

// oxlint-disable-next-line typescript/no-explicit-any
const mockModuleRules: any[] = [];
const mockConfig = {
context: root,
resolve: { alias: {} as Record<string, unknown> },
module: { rules: mockModuleRules },
// oxlint-disable-next-line typescript/no-explicit-any
plugins: [] as any[],
};
const mockOptions = {
Expand All @@ -674,6 +677,7 @@ async function probeWebpackConfig(
// oxlint-disable-next-line typescript/no-unsafe-function-type
const result = await (config.webpack as Function)(mockConfig, mockOptions);
const finalConfig = result ?? mockConfig;
// oxlint-disable-next-line typescript/no-explicit-any
const rules: any[] = finalConfig.module?.rules ?? mockModuleRules;
return {
aliases: normalizeAliasEntries(finalConfig.resolve?.alias, root),
Expand Down Expand Up @@ -762,6 +766,7 @@ export function detectNextIntlConfig(root: string, resolved: ResolvedNextConfig)
}
}

// oxlint-disable-next-line typescript/no-explicit-any
function extractMdxOptionsFromRules(rules: any[]): MdxOptions | null {
// Search through webpack rules for the MDX loader injected by @next/mdx
for (const rule of rules) {
Expand All @@ -775,6 +780,7 @@ function extractMdxOptionsFromRules(rules: any[]): MdxOptions | null {
* Recursively search a webpack rule (which may have nested `oneOf` arrays)
* for an MDX loader and extract its remark/rehype/recma plugin options.
*/
// oxlint-disable-next-line typescript/no-explicit-any
function extractMdxLoaders(rule: any): MdxOptions | null {
if (!rule) return null;

Expand Down Expand Up @@ -814,6 +820,7 @@ function isMdxLoader(loaderPath: string): boolean {
);
}

// oxlint-disable-next-line typescript/no-explicit-any
function extractPluginsFromOptions(opts: any): MdxOptions | null {
if (!opts || typeof opts !== "object") return null;

Expand Down
Loading
Loading