From 1883ddcb76dbfe2d2e9e16e759e7e6d9d5a28108 Mon Sep 17 00:00:00 2001 From: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Date: Wed, 14 Oct 2026 05:51:09 +0000 Subject: [PATCH] fix(ci): invalidate caches for imported declarations Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> --- .../filesystem/staticTaskCache.test.ts | 37 ++++++++++++++++++- turbo.json | 8 ++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/tests/boundary/filesystem/staticTaskCache.test.ts b/tests/boundary/filesystem/staticTaskCache.test.ts index 2efec538d5..374d354000 100644 --- a/tests/boundary/filesystem/staticTaskCache.test.ts +++ b/tests/boundary/filesystem/staticTaskCache.test.ts @@ -239,6 +239,27 @@ it.each([ diagnostic: "TS2322", invalidatesCompile: false, }, + { + label: "source declaration", + path: "src/types.d.mts", + content: "export type SourceValue = 2;\n", + diagnostic: "TS2322", + invalidatesCompile: true, + }, + { + label: "test declaration", + path: "tests/types.d.cts", + content: 'export type TestValue = "shadow";\n', + diagnostic: "TS2322", + invalidatesCompile: false, + }, + { + label: "script declaration", + path: "scripts/value.d.cts", + content: 'export type ScriptValue = "shadow";\n', + diagnostic: "TS2322", + invalidatesCompile: false, + }, ])( "rejects a changed $label after warming real compiler tasks", async ({ path, content, diagnostic, invalidatesCompile }) => { @@ -275,7 +296,11 @@ it.each([ ); await writeFile( join(root, "src/main.ts"), - "export const value: number = 1;\n", + 'import type { SourceValue } from "./types.mjs";\nexport const value: SourceValue = 1;\n', + ); + await writeFile( + join(root, "src/types.d.mts"), + "export type SourceValue = 1;\n", ); await writeFile( join(root, "docs/.vitepress/helper.ts"), @@ -299,7 +324,15 @@ it.each([ ); await writeFile( join(root, "tests/use-script.ts"), - 'import type { ApiScope } from "../scripts/api.mjs";\nexport const scope: ApiScope = "root";\n', + 'import type { ApiScope } from "../scripts/api.mjs";\nimport type { TestValue } from "./types.cjs";\nimport type { ScriptValue } from "../scripts/value.cjs";\nexport const scope: ApiScope = "root";\nexport const testValue: TestValue = "root";\nexport const scriptValue: ScriptValue = "root";\n', + ); + await writeFile( + join(root, "tests/types.d.cts"), + 'export type TestValue = "root";\n', + ); + await writeFile( + join(root, "scripts/value.d.cts"), + 'export type ScriptValue = "root";\n', ); await workflowGit(root, ["init", "--initial-branch=main"]); await workflowGit(root, ["add", "."]); diff --git a/turbo.json b/turbo.json index 7813b14dae..8476c9ba0e 100644 --- a/turbo.json +++ b/turbo.json @@ -14,7 +14,7 @@ "scripts/clean-build-output.mjs", "scripts/bundle-runtime.mjs", "scripts/generate-package-metadata.mjs", - "src/**/*.ts", + "src/**/*.{cts,mts,ts,tsx}", "src/**/package.json", "!src/**/*.test.ts", "!src/**/*.fixture.ts", @@ -27,14 +27,14 @@ "inputs": [ "package.json", "package-lock.json", - "src/**/*.ts", + "src/**/*.{cts,mts,ts,tsx}", "src/**/package.json", - "tests/**/*.ts", + "tests/**/*.{cts,mts,ts,tsx}", "tests/**/package.json", "tsconfig.json", "tsconfig.build.json", "vitest.config.ts", - "scripts/**/*.d.mts", + "scripts/**/*.d.{cts,mts,ts}", "scripts/**/package.json", "docs/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", "docs/**/package.json",