Skip to content

Commit 5fbbf59

Browse files
claude: Fix bundler top-level await issue with log functions
Wrap log.info/warning/error in arrow functions instead of direct references in quartoAPI object. This prevents the bundler from creating top-level async initialization code. When functions are assigned directly at module level (e.g., `{ info, error }`), the bundler assumes they might be accessed immediately and inserts top-level await calls to initialize underlying Deno extensions. Wrapping them in arrow functions defers access until the functions are actually called, avoiding the top-level await issue. Fixes prepare-dist workflow error: await init_quarto_api(); ^ SyntaxError: Unexpected reserved word 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8b1af04 commit 5fbbf59

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core/quarto-api.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { completeMessage, withSpinner } from "./console.ts";
5959
import { checkRender } from "../command/check/check-render.ts";
6060
import type { RenderServiceWithLifetime } from "../command/render/types.ts";
6161
import type { LogMessageOptions } from "./log.ts";
62-
import { error, info, warning } from "../deno_ral/log.ts";
62+
import * as log from "../deno_ral/log.ts";
6363

6464
export interface QuartoAPI {
6565
markdownRegex: {
@@ -377,9 +377,12 @@ export const quartoAPI: QuartoAPI = {
377377
console: {
378378
withSpinner,
379379
completeMessage,
380-
info,
381-
warning,
382-
error,
380+
info: (message: string, options?: LogMessageOptions) =>
381+
log.info(message, options),
382+
warning: (message: string, options?: LogMessageOptions) =>
383+
log.warning(message, options),
384+
error: (message: string, options?: LogMessageOptions) =>
385+
log.error(message, options),
383386
},
384387

385388
crypto: {

0 commit comments

Comments
 (0)