Skip to content

Commit 25afc6f

Browse files
Revert "claude: Fix bundler async cycles with refactoring and dynamic imports"
This reverts commit 3a81483.
1 parent d4919b9 commit 25afc6f

File tree

5 files changed

+43
-55
lines changed

5 files changed

+43
-55
lines changed

src/command/call/cmd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command } from "cliffy/command/mod.ts";
2-
import { engineCommand } from "./engine-cmd.ts";
2+
import { engineCommand } from "../../execute/engine.ts";
33
import { buildTsExtensionCommand } from "./build-ts-extension/cmd.ts";
44

55
export const callCommand = new Command()

src/command/call/engine-cmd.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/command/check/check-render.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (C) 2020-2022 Posit Software, PBC
55
*/
66

7+
import { render } from "../render/render-shared.ts";
78
import type { RenderServiceWithLifetime } from "../render/types.ts";
89

910
/**
@@ -38,9 +39,6 @@ export interface CheckRenderResult {
3839
export async function checkRender(
3940
options: CheckRenderOptions,
4041
): Promise<CheckRenderResult> {
41-
// Dynamic import to break cycle
42-
const { render } = await import("../render/render-shared.ts");
43-
4442
const { content, services } = options;
4543

4644
// Create temporary file

src/command/command-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { initYamlIntelligenceResourcesFromFilesystem } from "../core/schema/util
88
import { projectContext } from "../project/project-context.ts";
99
import { notebookContext } from "../render/notebook/notebook-context.ts";
1010
import { reorderEngines } from "../execute/engine.ts";
11-
import type { ProjectContext } from "../project/types.ts";
11+
import { ProjectContext } from "../project/types.ts";
1212

1313
/**
1414
* Create a minimal "zero-file" project context for loading bundled engine extensions

src/execute/engine.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { Command } from "cliffy/command/mod.ts";
4040
import { quartoAPI } from "../core/quarto-api.ts";
4141
import { satisfies } from "semver/mod.ts";
4242
import { quartoConfig } from "../core/quarto.ts";
43+
import { initializeProjectContextAndEngines } from "../command/command-utils.ts";
4344

4445
const kEngines: Map<string, ExecutionEngineDiscovery> = new Map();
4546

@@ -375,3 +376,42 @@ export function projectIgnoreGlobs(dir: string) {
375376
gitignoreEntries(dir).map((ignore) => `**/${ignore}**`),
376377
);
377378
}
379+
380+
export const engineCommand = new Command()
381+
.name("engine")
382+
.description(
383+
`Access functionality specific to quarto's different rendering engines.`,
384+
)
385+
.stopEarly()
386+
.arguments("<engine-name:string> [args...:string]")
387+
.action(async (options, engineName: string, ...args: string[]) => {
388+
// Initialize project context and register external engines
389+
await initializeProjectContextAndEngines();
390+
391+
// Get the engine (now includes external ones)
392+
const engine = executionEngine(engineName);
393+
if (!engine) {
394+
console.error(`Unknown engine: ${engineName}`);
395+
console.error(
396+
`Available engines: ${
397+
executionEngines().map((e) => e.name).join(", ")
398+
}`,
399+
);
400+
Deno.exit(1);
401+
}
402+
403+
if (!engine.populateCommand) {
404+
console.error(`Engine ${engineName} does not support subcommands`);
405+
Deno.exit(1);
406+
}
407+
408+
// Create temporary command and let engine populate it
409+
const engineSubcommand = new Command()
410+
.description(
411+
`Access functionality specific to the ${engineName} rendering engine.`,
412+
);
413+
engine.populateCommand(engineSubcommand);
414+
415+
// Recursively parse remaining arguments
416+
await engineSubcommand.parse(args);
417+
});

0 commit comments

Comments
 (0)