Skip to content

Commit c3f7c4e

Browse files
committed
fix(data-inspector): deterministic dts emission (per-entry graphs)
A combined dts graph let rolldown hoist entry declarations into shared chunks nondeterministically across runs, flaking the tsnapi snapshots in CI (some matrix cells emitted inline declarations, others re-exports). One dts graph per entry has nothing to split: declarations always inline, verified byte-identical across rebuilds. Snapshots regenerated against the inline form.
1 parent 83fa96c commit c3f7c4e

4 files changed

Lines changed: 218 additions & 43 deletions

File tree

plugins/data-inspector/tsdown.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ export default defineConfig([
3737
dts: false,
3838
entry: serverEntries,
3939
},
40-
{
40+
// One dts graph PER entry: a single-entry graph can never split shared
41+
// chunks, so declarations always inline and the emitted .d.mts files are
42+
// byte-deterministic (a combined graph let rolldown hoist entry contents
43+
// into shared chunks nondeterministically, flaking the tsnapi snapshots).
44+
...Object.entries({ ...clientEntries, ...serverEntries }).map(([name, source]) => ({
4145
clean: false,
42-
platform: 'neutral',
46+
platform: 'neutral' as const,
4347
tsconfig,
4448
dts: { emitDtsOnly: true },
4549
outExtensions: () => ({ dts: '.d.mts' }),
46-
entry: { ...clientEntries, ...serverEntries },
47-
},
50+
entry: { [name]: source },
51+
})),
4852
])
Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,86 @@
11
/**
22
* Generated by tsnapi — public API snapshot of `@devframes/plugin-data-inspector/client`
33
*/
4+
// #region Interfaces
5+
export interface DataSourceMeta {
6+
id: string;
7+
title: string;
8+
description?: string;
9+
icon?: string;
10+
static: boolean;
11+
queries?: Query[];
12+
}
13+
export interface FilterOptions {
14+
excludeFunctions?: boolean;
15+
excludeUnderscoreProps?: boolean;
16+
excludeDollarProps?: boolean;
17+
}
18+
export interface Query extends FilterOptions {
19+
query: string;
20+
title?: string;
21+
description?: string;
22+
}
23+
export interface QueryStats {
24+
queryMs: number;
25+
normalize: NormalizeStatsWire;
26+
payloadBytes: number;
27+
}
28+
export interface SavedQuery extends Query {
29+
id: string;
30+
scope: SavedQueryScope;
31+
updatedAt: number;
32+
}
33+
export interface SaveQueryInput extends Query {
34+
id?: string;
35+
scope: SavedQueryScope;
36+
}
37+
export interface SuggestItem {
38+
type: string;
39+
from: number;
40+
to: number;
41+
current: string;
42+
value: string;
43+
}
44+
export interface SuggestOutcome {
45+
ok: boolean;
46+
suggestions: SuggestItem[];
47+
statMs: number;
48+
error?: string;
49+
}
50+
// #endregion
51+
52+
// #region Types
53+
export type QueryOutcome = {
54+
ok: true;
55+
result: unknown;
56+
stats: QueryStats;
57+
} | {
58+
ok: false;
59+
error: {
60+
name: string;
61+
message: string;
62+
};
63+
};
64+
export type SavedQueryScope = 'workspace' | 'project';
65+
export type SkeletonOutcome = {
66+
ok: true;
67+
skeleton: unknown;
68+
nodes: number;
69+
ms: number;
70+
} | {
71+
ok: false;
72+
error: {
73+
name: string;
74+
message: string;
75+
};
76+
};
77+
// #endregion
78+
479
// #region Functions
580
export declare function connectDataInspector(_?: DevframeRpcClientOptions): Promise<DevframeRpcClient>;
681
// #endregion
782

883
// #region Other
9-
export { DataSourceMeta }
1084
export { DevframeConnectionStatus }
1185
export { DevframeRpcClient }
12-
export { FilterOptions }
13-
export { Query }
14-
export { QueryOutcome }
15-
export { QueryStats }
16-
export { SavedQuery }
17-
export { SavedQueryScope }
18-
export { SaveQueryInput }
19-
export { SkeletonOutcome }
20-
export { SuggestItem }
21-
export { SuggestOutcome }
2286
// #endregion
Lines changed: 114 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,118 @@
11
/**
22
* Generated by tsnapi — public API snapshot of `@devframes/plugin-data-inspector/engine`
33
*/
4-
// #region Other
5-
export { DataSourceMeta }
6-
export { FilterOptions }
7-
export { isExcludedKey }
8-
export { normalize }
9-
export { NormalizeOptions }
10-
export { NormalizeStats }
11-
export { NormalizeStatsWire }
12-
export { Query }
13-
export { QueryOutcome }
14-
export { QueryStats }
15-
export { runQuery }
16-
export { SavedQuery }
17-
export { SavedQueryScope }
18-
export { SaveQueryInput }
19-
export { skeletonOf }
20-
export { SkeletonOptions }
21-
export { SkeletonOutcome }
22-
export { suggest }
23-
export { SuggestItem }
24-
export { SuggestOutcome }
4+
// #region Interfaces
5+
export interface DataSourceMeta {
6+
id: string;
7+
title: string;
8+
description?: string;
9+
icon?: string;
10+
static: boolean;
11+
queries?: Query[];
12+
}
13+
export interface FilterOptions {
14+
excludeFunctions?: boolean;
15+
excludeUnderscoreProps?: boolean;
16+
excludeDollarProps?: boolean;
17+
}
18+
export interface NormalizeOptions {
19+
maxDepth?: number;
20+
maxEntries?: number;
21+
maxProps?: number;
22+
maxString?: number;
23+
excludeFunctions?: boolean;
24+
excludeUnderscoreProps?: boolean;
25+
excludeDollarProps?: boolean;
26+
}
27+
export interface NormalizeStats {
28+
nodes: number;
29+
refs: number;
30+
truncatedDepth: number;
31+
truncatedEntries: number;
32+
truncatedProps: number;
33+
ms: number;
34+
}
35+
export interface NormalizeStatsWire {
36+
nodes: number;
37+
refs: number;
38+
truncatedDepth: number;
39+
truncatedEntries: number;
40+
truncatedProps: number;
41+
ms: number;
42+
}
43+
export interface Query extends FilterOptions {
44+
query: string;
45+
title?: string;
46+
description?: string;
47+
}
48+
export interface QueryStats {
49+
queryMs: number;
50+
normalize: NormalizeStatsWire;
51+
payloadBytes: number;
52+
}
53+
export interface SavedQuery extends Query {
54+
id: string;
55+
scope: SavedQueryScope;
56+
updatedAt: number;
57+
}
58+
export interface SaveQueryInput extends Query {
59+
id?: string;
60+
scope: SavedQueryScope;
61+
}
62+
export interface SuggestItem {
63+
type: string;
64+
from: number;
65+
to: number;
66+
current: string;
67+
value: string;
68+
}
69+
export interface SuggestOutcome {
70+
ok: boolean;
71+
suggestions: SuggestItem[];
72+
statMs: number;
73+
error?: string;
74+
}
75+
// #endregion
76+
77+
// #region Types
78+
export type QueryOutcome = {
79+
ok: true;
80+
result: unknown;
81+
stats: QueryStats;
82+
} | {
83+
ok: false;
84+
error: {
85+
name: string;
86+
message: string;
87+
};
88+
};
89+
export type SavedQueryScope = 'workspace' | 'project';
90+
export type SkeletonOptions = Pick<NormalizeOptions, 'maxDepth' | 'maxProps' | 'excludeFunctions' | 'excludeUnderscoreProps' | 'excludeDollarProps'>;
91+
export type SkeletonOutcome = {
92+
ok: true;
93+
skeleton: unknown;
94+
nodes: number;
95+
ms: number;
96+
} | {
97+
ok: false;
98+
error: {
99+
name: string;
100+
message: string;
101+
};
102+
};
103+
// #endregion
104+
105+
// #region Functions
106+
export declare function isExcludedKey(_: string, _: Pick<NormalizeOptions, 'excludeUnderscoreProps' | 'excludeDollarProps'>): boolean;
107+
export declare function normalize(_: unknown, _?: NormalizeOptions): {
108+
data: unknown;
109+
stats: NormalizeStats;
110+
};
111+
export declare function runQuery(_: unknown, _: string, _?: NormalizeOptions): QueryOutcome;
112+
export declare function skeletonOf(_: unknown, _?: SkeletonOptions): {
113+
skeleton: unknown;
114+
nodes: number;
115+
ms: number;
116+
};
117+
export declare function suggest(_: unknown, _: string, _: number, _?: number): SuggestOutcome;
25118
// #endregion

tests/__snapshots__/tsnapi/@devframes/plugin-data-inspector/index.snapshot.d.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,34 @@ export interface DataInspectorDevframeOptions {
1010
port?: number;
1111
auth?: boolean;
1212
}
13+
export interface DataSourceEntry {
14+
id: string;
15+
title: string;
16+
description?: string;
17+
icon?: string;
18+
data: unknown | (() => unknown | Promise<unknown>);
19+
static?: boolean;
20+
queries?: Query[];
21+
}
22+
export interface DataSourcesService {
23+
register: (_: DataSourceEntry) => () => void;
24+
unregister: (_: string) => void;
25+
list: () => DataSourceMeta[];
26+
get: (_: string) => DataSourceEntry | undefined;
27+
onChanged: (_: () => void) => () => void;
28+
}
1329
// #endregion
1430

1531
// #region Functions
1632
export declare function createDataInspectorDevframe(_?: DataInspectorDevframeOptions): DevframeDefinition;
33+
export declare function registerDataSource(_: DataSourceEntry): () => void;
34+
// #endregion
35+
36+
// #region Variables
37+
export declare const DATA_SOURCES_SERVICE_ID: string;
1738
// #endregion
1839

1940
// #region Default Export
2041
declare const _default: DevframeDefinition;
2142
export default _default
22-
// #endregion
23-
24-
// #region Other
25-
export { DATA_SOURCES_SERVICE_ID }
26-
export { DataSourceEntry }
27-
export { DataSourcesService }
28-
export { registerDataSource }
2943
// #endregion

0 commit comments

Comments
 (0)