mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
* fix(build): suppress Turbopack over-bundling warning from agentSkills generator (#6582) generator.ts builds outputBase from a non-literal outputDir parameter, so Turbopack's file-tracing analyzer can't narrow it and emits an "Overly broad patterns" warning per entry point that imports the module (603 warnings on v3.8.46, up from 379). The fs access is legitimate and bounded, so next.config.mjs now suppresses this specific diagnostic via turbopack.ignoreIssue, mirroring the existing webpack.ignoreWarnings precedent in the same file. * chore(6720): re-sync onto release tip; CHANGELOG entry → changelog.d fragment (fragments-first)
This commit is contained in:
committed by
GitHub
parent
e5c19f4a12
commit
1834ed366e
1
changelog.d/fixes/6720-turbopack-agentskills-warning.md
Normal file
1
changelog.d/fixes/6720-turbopack-agentskills-warning.md
Normal file
@@ -0,0 +1 @@
|
||||
- **fix(build):** Turbopack production build emitted an "Overly broad patterns can lead to build performance issues" warning per entry point importing `src/lib/agentSkills/generator.ts` (603 warnings reported on v3.8.46, up from 379 on v3.8.45) ([#6582](https://github.com/diegosouzapw/OmniRoute/issues/6582)) — `generator.ts`'s `outputBase` is built as `path.isAbsolute(outputDir) ? outputDir : path.join(process.cwd(), outputDir)`, where `outputDir` is a runtime function parameter, not a compile-time literal, so Turbopack's build-time file-tracing analyzer can't statically narrow the several dynamic `readdirSync`/`rmSync`/`readFileSync`/`writeFileSync` call sites a few lines below and falls back to a project-wide glob; #6366's commit message claimed to "anchor the base path with a literal" but the shipped code never did. Since this fs access is legitimate and bounded (`skills/<id>/SKILL.md`, ~48 known IDs), `next.config.mjs`'s `turbopack.ignoreIssue` (Next.js 16.2+) now suppresses this specific, known-benign diagnostic, mirroring the existing `webpack.ignoreWarnings`/`isNextIntlExtractorDynamicImportWarning` precedent already in the same file for the webpack path. Regression guard: `tests/unit/next-config.test.ts` (asserts the `turbopack.ignoreIssue` rule shape targeting `src/lib/agentSkills/**`).
|
||||
@@ -116,6 +116,24 @@ const nextConfig = {
|
||||
...mitmManagerAliasFor(process.env),
|
||||
...minimalBuildAliases,
|
||||
},
|
||||
// src/lib/agentSkills/generator.ts builds its fs base path from a runtime
|
||||
// `outputDir` parameter (`path.join(process.cwd(), outputDir)`), which is
|
||||
// NOT a compile-time literal, so Turbopack's build-time file-tracing
|
||||
// analyzer can't statically narrow the several dynamic readdirSync/rmSync/
|
||||
// readFileSync/writeFileSync call sites a few lines below and falls back
|
||||
// to an "Overly broad patterns... matches N files" warning — once per
|
||||
// Next.js entry point that imports the module (/api/agent-skills/generate,
|
||||
// /api/cli-tools/pi-settings). The fs access is legitimate and bounded
|
||||
// (skills/<id>/SKILL.md, ~48 known IDs), so this is a known-benign,
|
||||
// expected diagnostic — suppress it here rather than fight the analyzer,
|
||||
// mirroring the isNextIntlExtractorDynamicImportWarning precedent below
|
||||
// for the webpack path. (#6582)
|
||||
ignoreIssue: [
|
||||
{
|
||||
path: "**/src/lib/agentSkills/**",
|
||||
description: /Overly broad patterns can lead to build performance issues/,
|
||||
},
|
||||
],
|
||||
},
|
||||
output: "standalone",
|
||||
compress: true,
|
||||
|
||||
@@ -271,6 +271,23 @@ test("next-intl webpack hook preserves caller config and filters known extractor
|
||||
);
|
||||
});
|
||||
|
||||
test("turbopack.ignoreIssue suppresses the agentSkills over-bundling warning (#6582)", async () => {
|
||||
// src/lib/agentSkills/generator.ts joins process.cwd() with a runtime
|
||||
// `outputDir` parameter — not a compile-time literal — so Turbopack's
|
||||
// file-tracing analyzer can't narrow it and emits an "Overly broad
|
||||
// patterns..." warning per entry point importing the module. The fs access
|
||||
// is legitimate and bounded, so it's suppressed via turbopack.ignoreIssue
|
||||
// rather than fought. This guards the config shape so the suppression rule
|
||||
// isn't silently dropped in a future edit.
|
||||
const { default: nextConfig } = await loadNextConfig("ignore-issue");
|
||||
const rules = nextConfig.turbopack?.ignoreIssue;
|
||||
|
||||
assert.ok(Array.isArray(rules), "expected turbopack.ignoreIssue to be an array");
|
||||
const agentSkillsRule = rules.find((rule) => String(rule.path).includes("agentSkills"));
|
||||
assert.ok(agentSkillsRule, "expected an ignoreIssue rule targeting src/lib/agentSkills/**");
|
||||
assert.match(String(agentSkillsRule.description), /Overly broad patterns/);
|
||||
});
|
||||
|
||||
test("optimizePackageImports excludes the internal @omniroute/open-sse workspace (build-OOM guard)", async () => {
|
||||
// Regression guard: adding the internal `@omniroute/open-sse` workspace to
|
||||
// optimizePackageImports makes Next.js resolve its entire barrel at build
|
||||
|
||||
Reference in New Issue
Block a user