Skip to content

Commit 650f9b0

Browse files
committed
chore(gates): type the size-report exports the helper pack guard imports
The repo guard imports the plain-Node size-report module, which the typechecked program excludes, so tsc saw it as an untyped boundary. A hand-written .d.mts declares the two exports the checked code reads, keeping the script bare-node runnable, and the guard's JSON parse carries its own narrowing.
1 parent 57367bc commit 650f9b0

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎.fallowrc.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@
6464
"scripts/maestro-conformance/corpus/**",
6565
"apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan",
6666
"scripts/help-conformance-sample-outputs.d.mts",
67-
"scripts/help-conformance-runner-output.d.mts"
67+
"scripts/help-conformance-runner-output.d.mts",
68+
// A hand-written type surface for a plain-Node .mjs the typechecked program (and Fallow's
69+
// graph) cannot import; its only consumer is the .mjs's real importers, resolved by tsc, not
70+
// by an import edge. Same shape as the help-conformance declaration files above.
71+
"scripts/size-report-package.d.mts"
6872
],
6973
"dynamicallyLoaded": ["packages/daemon/src/execution/interaction/index.ts"],
7074
"ignoreDependencies": [

‎scripts/size-report-package.d.mts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Type surface for the plain-Node size-report module (it must stay runnable by bare `node`, so
2+
// it is not in the typechecked program). TypeScript resolves this file when a checked module
3+
// imports `./size-report-package.mjs`; keep it in step with the exports there.
4+
export function readMacosHelperTestTargets(manifestSource: string): string[];
5+
export type NpmPackEntry = Readonly<{ path: string; size: number }>;
6+
export function assertPublishPackageContents(
7+
entries: readonly NpmPackEntry[],
8+
options?: Readonly<{
9+
repoRoot?: string;
10+
requireSnapshotBridge?: boolean;
11+
macosHelperManifestSource?: string;
12+
}>,
13+
): void;

‎test/repo-guards/macos-helper-package-contents.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ function packedPaths(): string[] {
3535
encoding: 'utf8',
3636
maxBuffer: 64 * 1024 * 1024,
3737
});
38-
const pack = JSON.parse(stdout);
39-
return (Array.isArray(pack) ? pack[0] : pack).files.map((entry) => entry.path);
38+
const parsed = JSON.parse(stdout);
39+
const pack: { files?: { path?: unknown }[] } = Array.isArray(parsed) ? parsed[0] : parsed;
40+
return pack.files?.map((entry) => String(entry.path)) ?? [];
4041
}
4142

4243
test('the shipped macOS helper manifest declares the helper and its test targets', () => {

0 commit comments

Comments
 (0)