@stainless-api/docs 0.1.0-beta.99 → 1.0.0-beta.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +401 -0
  2. package/ambient.d.ts +6 -0
  3. package/eslint-suppressions.json +22 -6
  4. package/{eslint.config.js → eslint.config.ts} +1 -7
  5. package/package.json +62 -40
  6. package/plugin/buildAlgoliaIndex.ts +6 -12
  7. package/plugin/components/SDKSelect.astro +0 -6
  8. package/plugin/components/SnippetCode.tsx +6 -37
  9. package/plugin/components/search/SearchAlgolia.astro +1 -1
  10. package/plugin/components/search/SearchIsland.tsx +19 -13
  11. package/plugin/generateAPIReferenceLink.ts +0 -40
  12. package/plugin/globalJs/ai-dropdown-options.ts +22 -9
  13. package/plugin/globalJs/code-snippets.ts +5 -5
  14. package/plugin/globalJs/copy.ts +20 -91
  15. package/plugin/globalJs/navigation.ts +13 -13
  16. package/plugin/globalJs/summary-selection-tweak.ts +29 -0
  17. package/plugin/index.ts +107 -163
  18. package/plugin/loadPluginConfig.ts +49 -151
  19. package/plugin/markdown/highlighter.ts +100 -0
  20. package/plugin/markdown/index.ts +39 -0
  21. package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +2 -0
  22. package/plugin/react/Routing.tsx +10 -244
  23. package/plugin/referencePlaceholderUtils.ts +1 -1
  24. package/plugin/replaceSidebarPlaceholderMiddleware.ts +1 -1
  25. package/plugin/routes/Docs.astro +3 -1
  26. package/plugin/routes/Overview.astro +14 -7
  27. package/plugin/routes/llms.ts +186 -0
  28. package/plugin/routes/markdown.ts +62 -13
  29. package/plugin/sidebar-utils/sidebar-builder.ts +38 -12
  30. package/plugin/specs/defaultSpecLoader.ts +192 -0
  31. package/plugin/specs/fetchSpecSSR.ts +1 -1
  32. package/plugin/specs/utils.ts +86 -0
  33. package/shared/conditionalIntegration.ts +28 -0
  34. package/shared/getProsePages.ts +6 -7
  35. package/shared/virtualModule.ts +1 -26
  36. package/stl-docs/aiChatExamples.ts +31 -0
  37. package/stl-docs/chat/docs-chat-handler.ts +17 -0
  38. package/stl-docs/chat/hook.ts +225 -0
  39. package/stl-docs/chat/schemas.ts +27 -0
  40. package/stl-docs/chat/ui/AiChat.module.css +591 -0
  41. package/stl-docs/chat/ui/AiChat.tsx +175 -0
  42. package/stl-docs/chat/ui/Trigger.tsx +154 -0
  43. package/stl-docs/chat/ui/components/ChatControls.tsx +51 -0
  44. package/stl-docs/chat/ui/components/ChatEmpty.tsx +42 -0
  45. package/stl-docs/chat/ui/components/ChatLog.tsx +93 -0
  46. package/stl-docs/chat/ui/components/ChatMessage.tsx +47 -0
  47. package/stl-docs/chat/ui/components/CodeBlock.tsx +33 -0
  48. package/stl-docs/chat/ui/components/MessageFeedback.tsx +106 -0
  49. package/stl-docs/chat/ui/components/Table.tsx +15 -0
  50. package/stl-docs/chat/ui/components/ToolCall.tsx +34 -0
  51. package/stl-docs/chat/ui/components/hljs-github.css +81 -0
  52. package/stl-docs/chat/ui/scroll-manager.ts +86 -0
  53. package/stl-docs/chat/ui/types.ts +45 -0
  54. package/stl-docs/components/AiChatIsland.tsx +10 -12
  55. package/stl-docs/components/ContentPanel.astro +9 -0
  56. package/stl-docs/components/Footer.astro +89 -0
  57. package/stl-docs/components/Header.astro +0 -5
  58. package/stl-docs/components/PageFrame.astro +23 -8
  59. package/stl-docs/components/PageSidebar.astro +11 -0
  60. package/stl-docs/components/StainlessLogo.svg +4 -0
  61. package/stl-docs/components/TwoColumnContent.astro +2 -0
  62. package/stl-docs/components/headers/DefaultHeader.astro +6 -8
  63. package/stl-docs/components/headers/StackedHeader.astro +5 -53
  64. package/stl-docs/components/mintlify-compat/Accordion.astro +2 -2
  65. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +0 -4
  66. package/stl-docs/components/mintlify-compat/Columns.astro +2 -2
  67. package/stl-docs/components/mintlify-compat/Frame.astro +2 -2
  68. package/stl-docs/components/mintlify-compat/Tab.astro +2 -2
  69. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +2 -2
  70. package/stl-docs/components/mintlify-compat/callouts/Check.astro +0 -4
  71. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +0 -4
  72. package/stl-docs/components/mintlify-compat/callouts/Info.astro +0 -4
  73. package/stl-docs/components/mintlify-compat/callouts/Note.astro +0 -4
  74. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +0 -4
  75. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +0 -4
  76. package/stl-docs/components/nav-tabs/NavDropdown.astro +12 -7
  77. package/stl-docs/components/nav-tabs/NavTabs.astro +5 -3
  78. package/stl-docs/components/nav-tabs/buildNavLinks.ts +2 -0
  79. package/stl-docs/components/pagination/Pagination.astro +4 -2
  80. package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +2 -2
  81. package/stl-docs/components/pagination/PaginationLinkQuiet.astro +2 -2
  82. package/stl-docs/components/pagination/util.ts +3 -3
  83. package/stl-docs/components/sidebars/BaseSidebar.astro +72 -1
  84. package/stl-docs/disableCalloutSyntax.ts +1 -1
  85. package/stl-docs/fonts.ts +5 -5
  86. package/stl-docs/index.ts +76 -53
  87. package/stl-docs/loadStlDocsConfig.ts +38 -8
  88. package/stl-docs/og-image/components/OpenGraphFunctionSignature.tsx +64 -0
  89. package/stl-docs/og-image/components/OpenGraphImage.tsx +126 -0
  90. package/stl-docs/og-image/config.ts +56 -0
  91. package/stl-docs/og-image/image-gen/generate-api-reference-og-image.tsx +188 -0
  92. package/stl-docs/og-image/image-gen/generate-og-image.tsx +119 -0
  93. package/stl-docs/og-image/image-gen/get-logo-url.ts +47 -0
  94. package/stl-docs/og-image/index.ts +135 -0
  95. package/stl-docs/og-image/routes/add-og-image.ts +45 -0
  96. package/stl-docs/og-image/routes/get-api-reference-og-image.ts +36 -0
  97. package/stl-docs/og-image/routes/get-og-image.ts +28 -0
  98. package/stl-docs/og-image/theme.ts +43 -0
  99. package/stl-docs/og-image/utils.ts +14 -0
  100. package/stl-docs/proseDocSync.test.ts +74 -0
  101. package/stl-docs/proseDocSync.ts +344 -0
  102. package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +4 -12
  103. package/stl-docs/schema-extension.ts +12 -0
  104. package/stl-docs/tabsMiddleware.ts +1 -1
  105. package/styles/overrides.css +2 -14
  106. package/styles/page.css +210 -71
  107. package/styles/sidebar.css +30 -17
  108. package/styles/sl-variables.css +3 -8
  109. package/styles/stldocs-variables.css +2 -2
  110. package/styles/toc.css +8 -0
  111. package/tsconfig.json +1 -1
  112. package/virtual-module.d.ts +35 -11
  113. package/playground-virtual-modules.d.ts +0 -96
  114. package/plugin/globalJs/create-playground.shim.ts +0 -3
  115. package/plugin/globalJs/playground-data.shim.ts +0 -1
  116. package/plugin/globalJs/playground-data.ts +0 -14
  117. package/plugin/specs/FileCache.ts +0 -99
  118. package/plugin/specs/generateSpec.ts +0 -112
  119. package/plugin/specs/index.ts +0 -132
  120. package/plugin/specs/inputResolver.ts +0 -146
  121. package/plugin/specs/worker.ts +0 -199
  122. package/plugin/vendor/preview.worker.docs.js +0 -26108
  123. package/plugin/vendor/templates/cli.md +0 -1
  124. package/plugin/vendor/templates/go.md +0 -316
  125. package/plugin/vendor/templates/java.md +0 -89
  126. package/plugin/vendor/templates/kotlin.md +0 -89
  127. package/plugin/vendor/templates/node.md +0 -235
  128. package/plugin/vendor/templates/python.md +0 -251
  129. package/plugin/vendor/templates/ruby.md +0 -147
  130. package/plugin/vendor/templates/terraform.md +0 -60
  131. package/plugin/vendor/templates/typescript.md +0 -319
  132. package/scripts/vendor_deps.ts +0 -50
  133. package/stl-docs/components/ClientRouterHead.astro +0 -41
  134. package/stl-docs/components/content-panel/ContentPanel.astro +0 -42
  135. package/stl-docs/components/headers/SplashMobileMenuToggle.astro +0 -65
  136. package/stl-docs/proseSearchIndexing.ts +0 -606
package/plugin/index.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import react from '@astrojs/react';
2
2
  import type { StarlightPlugin } from '@astrojs/starlight/types';
3
3
  import type { AstroIntegration } from 'astro';
4
- import type { BundledTheme } from 'shiki';
5
4
  import { config } from 'dotenv';
6
- // import { buildAlgoliaIndex } from './buildAlgoliaIndex';
7
5
  import {
8
6
  getAPIReferencePlaceholderItemFromSidebarConfig,
9
7
  makePlaceholderItems,
@@ -28,12 +26,17 @@ import { getSharedLogger } from '../shared/getSharedLogger';
28
26
  import { resolveSrcFile } from '../resolveSrcFile';
29
27
  import { mkdir, writeFile } from 'fs/promises';
30
28
  import { fileURLToPath } from 'url';
31
- import prebundleWorkers from 'vite-plugin-prebundle-workers';
32
- import { SpecLoader, startSpecLoader } from './specs';
33
29
 
34
30
  import type * as ReferenceSidebarsVirtualModule from 'virtual:stl-starlight-reference-sidebars';
35
- import { generateMissingRouteList } from '@stainless-api/docs-ui/routing';
31
+ import type * as VirtualManifestModule from 'virtual:stainless-apis-manifest';
32
+
33
+ import {
34
+ generateMissingRouteList,
35
+ isSupportedLanguage,
36
+ type DocsLanguage,
37
+ } from '@stainless-api/docs-ui/routing';
36
38
  import { buildAlgoliaIndex } from './buildAlgoliaIndex';
39
+ import { flatSpecsList, loadAllSpecs, LoadedSpecs } from './specs/utils';
37
40
 
38
41
  export { generateAPILink } from './generateAPIReferenceLink';
39
42
  export type { ReferenceSidebarConfigItem };
@@ -91,58 +94,24 @@ export function generateAPIReferenceItems(
91
94
  return makePlaceholderItems(id);
92
95
  }
93
96
 
94
- async function stlStarlightAstroIntegration(
95
- pluginConfig: NormalizedStainlessStarlightConfig,
96
- ): Promise<AstroIntegration> {
97
+ function stlStarlightAstroIntegration(pluginConfig: NormalizedStainlessStarlightConfig): AstroIntegration {
97
98
  const virtualId = `virtual:stl-starlight-virtual-module`;
98
99
  // The '\0' prefix tells Vite “this is a virtual module” and prevents it from being resolved again.
99
100
  const resolvedId = `\0${virtualId}`;
100
- let playgroundsBase: string | undefined;
101
- let buildPlaygrounds;
102
101
  let astroBase = '/';
103
102
 
104
- let specLoader: SpecLoader | undefined;
105
- async function resolveSpecs() {
106
- if (!specLoader) throw new Error('Expected spec loader to exist');
107
- const result = await specLoader.specPromise;
108
- return result.specComposite;
109
- }
103
+ let specsPromise: Promise<LoadedSpecs> | undefined;
104
+ async function specsPromiseResolved() {
105
+ if (!specsPromise) throw new Error('Expected spec promise to exist');
106
+ const result = await specsPromise;
110
107
 
111
- let building: Promise<void> | undefined;
112
- let reportError: ((message: string) => void) | null = null;
113
- let collectedErrors: string[] | null = null;
114
-
115
- function startPlaygroundsBuild(playgroundsCachePath: string) {
116
- if (!pluginConfig.experimentalPlaygrounds) return;
117
- if (building) return building;
118
- return (building = (async () => {
119
- const specComposite = await resolveSpecs();
120
-
121
- if (specComposite.listUniqueSpecs().length > 1) {
122
- throw new Error('Multiple specs found. This is not supported for Playgrounds.');
123
- }
124
-
125
- const spec = specComposite.listUniqueSpecs()[0]!.data.sdkJson;
126
- const auth = specComposite.listUniqueSpecs()[0]!.data.auth;
127
-
128
- const langs = specComposite.getLanguages();
129
-
130
- await buildPlaygrounds!({
131
- spec,
132
- langs,
133
- auth,
134
- playPath: playgroundsCachePath,
135
- reportError(message: string) {
136
- (reportError ?? console.error)(message);
137
- },
138
- });
139
- })());
108
+ return result;
140
109
  }
141
110
 
142
111
  return {
143
112
  name: 'stl-starlight-astro',
144
113
  hooks: {
145
- 'astro:config:setup': async ({
114
+ 'astro:config:setup': ({
146
115
  injectRoute,
147
116
  updateConfig,
148
117
  logger: localLogger,
@@ -154,18 +123,24 @@ async function stlStarlightAstroIntegration(
154
123
  const projectDir = astroConfig.root.pathname;
155
124
  astroBase = astroConfig.base;
156
125
 
157
- specLoader = await startSpecLoader(pluginConfig, logger, createCodegenDir());
158
-
159
- reportError = (message: string) => logger.error(message);
160
-
161
- if (pluginConfig.experimentalPlaygrounds) {
162
- playgroundsBase = pluginConfig.experimentalPlaygrounds.playgroundsBase;
163
- }
126
+ specsPromise = loadAllSpecs(
127
+ pluginConfig.loadSpecs({
128
+ stainlessProject: pluginConfig.stainlessProject,
129
+ branch: pluginConfig.branch,
130
+ apiKey: pluginConfig.apiKey?.value ?? null,
131
+ excludeLanguages: pluginConfig.excludeLanguages,
132
+ logger,
133
+ createCodegenDir,
134
+ }),
135
+ );
164
136
 
165
- const middlewareFile = path.join(projectDir, 'middleware.stainless.ts');
137
+ const middlewareFileBase = path.join(projectDir, 'middleware.stainless');
138
+ const middlewareFile = ['.tsx', '.ts']
139
+ .map((ext) => middlewareFileBase + ext)
140
+ .find((f) => fs.existsSync(f));
166
141
 
167
142
  let vmMiddlewareExport = 'export const MIDDLEWARE = {};';
168
- if (fs.existsSync(middlewareFile)) {
143
+ if (middlewareFile) {
169
144
  logger.debug(`Loading middleware from ${middlewareFile}`);
170
145
  vmMiddlewareExport = `export { default as MIDDLEWARE } from '${middlewareFile}';`;
171
146
  }
@@ -176,6 +151,12 @@ async function stlStarlightAstroIntegration(
176
151
  prerender: pluginConfig.experimentalPrerender ? command === 'build' : false,
177
152
  });
178
153
 
154
+ injectRoute({
155
+ pattern: `${pluginConfig.basePath}/index.md`,
156
+ entrypoint: resolveSrcFile('/plugin/routes/markdown.ts'),
157
+ prerender: pluginConfig.experimentalPrerender ? command === 'build' : false,
158
+ });
159
+
179
160
  const astroFile = command === 'build' ? 'DocsStatic' : 'Docs';
180
161
  injectRoute({
181
162
  pattern: `${pluginConfig.basePath}/[...slug]`,
@@ -189,6 +170,16 @@ async function stlStarlightAstroIntegration(
189
170
  prerender: pluginConfig.experimentalPrerender ? command === 'build' : false,
190
171
  });
191
172
 
173
+ if (pluginConfig.llmsTxt.enabled) {
174
+ injectRoute({
175
+ pattern: '/llms.txt',
176
+ entrypoint: resolveSrcFile('/plugin/routes/llms.ts'),
177
+ prerender: pluginConfig.experimentalPrerender ? command === 'build' : false,
178
+ });
179
+ } else {
180
+ logger.info('LLMS.txt generation is disabled.');
181
+ }
182
+
192
183
  updateConfig({
193
184
  vite: {
194
185
  plugins: [
@@ -196,24 +187,28 @@ async function stlStarlightAstroIntegration(
196
187
  'virtual:stl-starlight-reference-sidebars',
197
188
  async () => {
198
189
  // we know specLoader exists here
199
- const { specComposite } = await specLoader!.specPromise;
190
+ const specs = await specsPromiseResolved();
200
191
 
201
192
  const sidebars = [...sidebarConfigs.entries()]
202
193
  // produce all { id, language } combos with the attached config
203
194
  // flattens to one item per language * id combo
204
195
  .flatMap(([id, config]) =>
205
- specComposite.listAllLanguagesAndIncludeSpecs().map((res) => ({
206
- id,
207
- config,
208
- language: res.language,
209
- spec: res.spec.data.sdkJson,
210
- })),
196
+ flatSpecsList(specs)
197
+ .filter((res): res is typeof res & { language: DocsLanguage } =>
198
+ isSupportedLanguage(res.language),
199
+ )
200
+ .map((res) => ({
201
+ id,
202
+ config,
203
+ language: res.language,
204
+ sdkJson: res.sdkJson,
205
+ })),
211
206
  )
212
207
  // produce a sidebar for each
213
208
  // later we will .find() the sidebar that matches the (id, language)
214
- .map(({ id, config, language, spec }) => {
209
+ .map(({ id, config, language, sdkJson }) => {
215
210
  const configItemsBuilder = new SidebarConfigItemsBuilder(
216
- spec,
211
+ sdkJson,
217
212
  language,
218
213
  config.options,
219
214
  );
@@ -227,11 +222,11 @@ async function stlStarlightAstroIntegration(
227
222
  return {
228
223
  id,
229
224
  language,
230
- // this has to run multpile times because it depends on the
225
+ // this has to run multiple times because it depends on the
231
226
  // userSidebarConfig (which is per-id) and the language
232
227
  entries: toStarlightSidebar({
233
228
  basePath: path.posix.join(astroBase, pluginConfig.basePath),
234
- spec,
229
+ spec: sdkJson,
235
230
  entries: userSidebarConfig,
236
231
  currentLanguage: language,
237
232
  }),
@@ -241,58 +236,33 @@ async function stlStarlightAstroIntegration(
241
236
  return { sidebars };
242
237
  },
243
238
  ),
244
- ...specLoader.vitePlugins,
239
+ makeAsyncVirtualModPlugin<typeof VirtualManifestModule>(
240
+ 'virtual:stainless-apis-manifest',
241
+ async () => {
242
+ // this virtual module only resolves when the specs are loaded
243
+ // this prevents the SSR module from trying to read the spec file before it's generated
244
+ const specs = await specsPromiseResolved();
245
+
246
+ return {
247
+ api: {
248
+ languages: specs
249
+ .map((s) =>
250
+ s.languages
251
+ .filter(isSupportedLanguage)
252
+ .map((lang) => ({ language: lang, sdkJSONFilePath: s.filePath })),
253
+ )
254
+ .flat(),
255
+ },
256
+ };
257
+ },
258
+ ),
245
259
  {
246
260
  name: 'stl-starlight-vite',
247
- buildStart() {
248
- building = undefined;
249
- },
250
- async configureServer(server) {
251
- if (playgroundsBase) {
252
- buildPlaygrounds = (await server.ssrLoadModule(playgroundsBase + '/src/build.ts'))
253
- .buildPlaygrounds;
254
- }
255
-
256
- // TODO: eventually - re-add support for watching local input changes (eg. reloading when OAS/config files change)
257
- },
261
+ // TODO: eventually - re-add support for watching local input changes (eg. reloading when OAS/config files change)
258
262
  resolveId(id) {
259
263
  if (id === virtualId) {
260
264
  return resolvedId;
261
265
  }
262
- if (id === 'virtual:stl-playground/unstable-update-language') {
263
- return resolveSrcFile('plugin/languages.ts');
264
- }
265
- if (id === 'virtual:stl-playground/create') {
266
- return fileURLToPath(
267
- new URL(
268
- pluginConfig.experimentalPlaygrounds
269
- ? path.join(playgroundsBase!, '/src/create.tsx')
270
- : './globalJs/create-playground.shim.ts',
271
- import.meta.url,
272
- ),
273
- );
274
- }
275
- if (id === 'virtual:stl-playground/data') {
276
- return fileURLToPath(
277
- new URL(
278
- pluginConfig.experimentalPlaygrounds
279
- ? './globalJs/playground-data.ts'
280
- : './globalJs/playground-data.shim.ts',
281
- import.meta.url,
282
- ),
283
- );
284
- }
285
- if (id.startsWith('virtual:stl-playground/')) {
286
- const result = path.join(
287
- this.environment.getTopLevelConfig().cacheDir,
288
- 'stl-playground',
289
- id.slice('virtual:stl-playground/'.length),
290
- );
291
- const config = this.environment.getTopLevelConfig();
292
- return startPlaygroundsBuild(path.join(config.cacheDir, 'stl-playground'))?.then(
293
- () => result,
294
- );
295
- }
296
266
  },
297
267
  load(id) {
298
268
  if (id === resolvedId) {
@@ -309,62 +279,39 @@ async function stlStarlightAstroIntegration(
309
279
  EXPERIMENTAL_COLLAPSIBLE_METHOD_DESCRIPTIONS:
310
280
  pluginConfig.experimentalCollapsibleMethodDescriptions,
311
281
  PROPERTY_SETTINGS: pluginConfig.propertySettings,
312
- ENABLE_CONTEXT_MENU: pluginConfig.contextMenu,
313
- EXPERIMENTAL_PLAYGROUNDS: !!pluginConfig.experimentalPlaygrounds,
282
+ ENABLE_CONTEXT_MENU: !!pluginConfig.contextMenu,
283
+ CONTEXT_MENU_ENABLE_THIRD_PARTY:
284
+ (typeof pluginConfig.contextMenu === 'object'
285
+ ? pluginConfig.contextMenu.thirdParty
286
+ : null) ?? true,
314
287
  EXPERIMENTAL_REQUEST_BUILDER: pluginConfig.experimentalRequestBuilder,
315
288
  STAINLESS_PROJECT: pluginConfig.stainlessProject,
289
+ LLMS_TXT_DESCRIPTION: pluginConfig.llmsTxt.description,
290
+ LLMS_TXT_DETAIL_THRESHOLD: pluginConfig.llmsTxt.detailThreshold,
316
291
  } satisfies Omit<typeof StlStarlightVirtualModule, 'MIDDLEWARE'>),
317
292
  vmMiddlewareExport,
318
293
  ].join('\n');
319
294
  }
320
295
  },
321
296
  },
322
- prebundleWorkers({
323
- include: [
324
- '**/typescript/runner*',
325
- '**/typescript/worker*',
326
- '**/pyright.worker*',
327
- '**/python/pyodide*',
328
- ],
329
- configureEsBuild(_, opts) {
330
- opts.external ??= [];
331
- opts.external.push('url');
332
- opts.loader ??= {};
333
- opts.loader['.wasm'] = 'dataurl';
334
- return opts;
335
- },
336
- }),
337
297
  ],
338
298
  },
339
299
  });
340
300
  },
341
- 'astro:build:start'({ logger }) {
342
- collectedErrors = [];
343
- reportError = (message: string) => {
344
- logger.error(message);
345
- collectedErrors!.push(message);
346
- };
347
- },
348
301
  'astro:build:done': async ({ dir, logger }) => {
349
302
  const dist = fileURLToPath(dir);
350
303
  const stainlessDir = path.join(dist, '_stainless');
351
304
  await mkdir(stainlessDir, { recursive: true });
352
- if (collectedErrors) {
353
- for (const error of collectedErrors) {
354
- logger.error(error);
355
- }
356
- collectedErrors = null;
357
- }
358
305
 
359
306
  const manifest = {
360
307
  astroBase,
361
308
  };
362
309
  await writeFile(path.join(stainlessDir, 'stl-manifest.json'), JSON.stringify(manifest, null, 2));
363
310
 
364
- const specComposite = await resolveSpecs();
311
+ const loadedSpecs = await specsPromiseResolved();
365
312
 
366
313
  await buildAlgoliaIndex({
367
- specComposite,
314
+ loadedSpecs,
368
315
  logger,
369
316
  });
370
317
 
@@ -375,7 +322,7 @@ async function stlStarlightAstroIntegration(
375
322
  // about the missing method and provide links to SDKs where it is available.
376
323
 
377
324
  // TODO: (multi-spec) support multiple specs
378
- const spec = specComposite.listUniqueSpecs()[0]!.data.sdkJson;
325
+ const spec = loadedSpecs[0]!.sdkJson;
379
326
 
380
327
  const missingRoutes = generateMissingRouteList({
381
328
  spec,
@@ -395,7 +342,7 @@ export function stainlessStarlight(someUserConfig: SomeStainlessStarlightUserCon
395
342
  return {
396
343
  name: 'stl-starlight',
397
344
  hooks: {
398
- 'config:setup': async ({
345
+ 'config:setup': ({
399
346
  addIntegration,
400
347
  updateConfig,
401
348
  addRouteMiddleware,
@@ -430,18 +377,17 @@ export function stainlessStarlight(someUserConfig: SomeStainlessStarlightUserCon
430
377
  addIntegration(react());
431
378
  }
432
379
 
433
- // TODO: (multi-spec) re-add this? not strictly necessary to merge
434
- // if ('apiKey' in config.specInputs) {
435
- // if (!config.specInputs.apiKey) {
436
- // logger.info(`Stainless credentials not loaded`);
437
- // } else if (config.specInputs.apiKey.source === 'explicit-config') {
438
- // logger.info(`Stainless credentials loaded from user config`);
439
- // } else if (config.specInputs.apiKey.source === 'environment-variable') {
440
- // logger.info('Stainless credentials loaded from `STAINLESS_API_KEY` environment variable');
441
- // } else if (config.specInputs.apiKey.source === 'cli') {
442
- // logger.info('Stainless credentials loaded from `stl` CLI');
443
- // }
444
- // })
380
+ if ('apiKey' in config) {
381
+ if (!config.apiKey) {
382
+ logger.info(`Stainless credentials not loaded`);
383
+ } else if (config.apiKey.source === 'explicit-config') {
384
+ logger.info(`Stainless credentials loaded from user config`);
385
+ } else if (config.apiKey.source === 'environment-variable') {
386
+ logger.info('Stainless credentials loaded from `STAINLESS_API_KEY` environment variable');
387
+ } else if (config.apiKey.source === 'cli') {
388
+ logger.info('Stainless credentials loaded from `stl` CLI');
389
+ }
390
+ }
445
391
 
446
392
  if (starlightConfig.sidebar) {
447
393
  // for pagination (https://starlight.astro.build/reference/configuration/#pagination) to work correctly
@@ -455,14 +401,14 @@ export function stainlessStarlight(someUserConfig: SomeStainlessStarlightUserCon
455
401
  }
456
402
  }
457
403
 
458
- addIntegration(await stlStarlightAstroIntegration(config));
404
+ addIntegration(stlStarlightAstroIntegration(config));
459
405
 
460
406
  const expressiveCodeConfig =
461
407
  typeof starlightConfig.expressiveCode === 'object' ? starlightConfig.expressiveCode : {};
462
408
 
463
409
  const themes = expressiveCodeConfig.themes
464
- ? (expressiveCodeConfig.themes as BundledTheme[])
465
- : (['github-light', 'github-dark'] as BundledTheme[]);
410
+ ? expressiveCodeConfig.themes
411
+ : (['github-light', 'github-dark'] satisfies (typeof expressiveCodeConfig)['themes']);
466
412
 
467
413
  updateConfig({
468
414
  sidebar: starlightConfig.sidebar,
@@ -486,5 +432,3 @@ export function stainlessStarlight(someUserConfig: SomeStainlessStarlightUserCon
486
432
  // Additional exports we want for Stainless <-> docs integration.
487
433
  export { parseStainlessPath } from '@stainless-api/docs-ui/routing';
488
434
  export { renderMarkdown } from '@stainless-api/docs-ui/markdown';
489
-
490
- export { resolveSpec } from './specs/inputResolver';