fix(studio): resolve exact component filenames for Linux previews
This commit is contained in:
1 parent
f1cf0e9f2b
commit
59f1d9d28a
5 files changed
+61
-8
No files matched your search
@@ -1,14 +1,14 @@
|
||||
import { validateAgentPage } from "./agent-pages.ts";
|
||||
import { readFileSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { join } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { createHash } from "node:crypto";
|
||||
import { compileWrnFile } from "@wrnexus/compiler";
|
||||
import { runWithRequestContext } from "@wrnexus/core";
|
||||
import { REACTIVE_RUNTIME } from "@wrnexus/csr";
|
||||
import { renderDocument } from "@wrnexus/ssr";
|
||||
import { uiCss, uiComponentsDir } from "@wrnexus/ui/registry";
|
||||
import { uiCss, uiComponentPath } from "@wrnexus/ui/registry";
|
||||
import { resolveThemeConfig, renderThemeCss } from "@wrnexus/styles/theme";
|
||||
import {
|
||||
COMPONENT_CONTRACTS,
|
||||
@@ -25,10 +25,7 @@ const escape = (text: string) =>
|
||||
async function component(name: string, props: Record<string, unknown> = {}) {
|
||||
if (!Object.hasOwn(COMPONENT_CONTRACTS, name)) throw Error("Unknown component.");
|
||||
if (!modules.has(name)) {
|
||||
const sourcePath = resolve(
|
||||
uiComponentsDir(),
|
||||
name === "ComboBox" ? "Combobox.wrn" : `${name}.wrn`,
|
||||
);
|
||||
const sourcePath = uiComponentPath(name);
|
||||
const source = readFileSync(sourcePath, "utf8");
|
||||
const directory = join(tmpdir(), "wrnexus-design-studio");
|
||||
mkdirSync(directory, { recursive: true });
|
||||
|
||||
Reference in new issue
Block a user