Skip to content

Commit b8d4339

Browse files
chargomeclaude
andcommitted
ref(solidstart): Document orchestrion rollupConfig cast
Hoist the `rollup:before` config cast into one narrowing with a justification comment, replacing the duplicate double-cast. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 16dd435 commit b8d4339

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/solidstart/src/config/withSentry.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,20 @@ export function withSentry(
5353
// Use a module so we don't override preset hooks.
5454
const sentryNitroModule = (nitro: Nitro) => {
5555
nitro.hooks.hook('rollup:before', async (nitro, rollupConfig) => {
56+
// Nitro types the `rollup:before` hook's `rollupConfig.plugins` as `string[]` (plugin paths),
57+
// but at runtime it holds resolved plugin objects we can push onto, so narrow to our own shape.
58+
const sentryRollupConfig = rollupConfig as unknown as RollupConfig;
59+
5660
if (addBuildTimeInstrumentation) {
57-
(rollupConfig as unknown as RollupConfig).plugins.push(
61+
sentryRollupConfig.plugins.push(
5862
sentryOrchestrionPlugin({ buildTimeInstrumentation: sentryPluginOptions.buildTimeInstrumentation }),
5963
);
6064
}
6165

6266
if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {
6367
await addDynamicImportEntryFileWrapper({
6468
nitro,
65-
rollupConfig: rollupConfig as unknown as RollupConfig,
69+
rollupConfig: sentryRollupConfig,
6670
sentryPluginOptions,
6771
});
6872

0 commit comments

Comments
 (0)