fix(assistant): isolate server-safe JSX analyzer
This commit is contained in:
1 parent
b49f6b5631
commit
0fbe1e3fa3
2 files changed
+3
-4
No files matched your search
@@ -19,7 +19,7 @@ import {
|
|||||||
normalizeCustomJsxAuthoringTemplate,
|
normalizeCustomJsxAuthoringTemplate,
|
||||||
normalizeCustomWidgetAuthoringDefinition,
|
normalizeCustomWidgetAuthoringDefinition,
|
||||||
} from "@homarr/custom-widgets/core";
|
} from "@homarr/custom-widgets/core";
|
||||||
import { addCustomJsxDiagnosticSourceExcerpts, validateCustomJsxTemplate } from "@homarr/custom-widgets/jsx";
|
import { addCustomJsxDiagnosticSourceExcerpts, validateCustomJsxTemplate } from "@homarr/custom-widgets/jsx/analyzer";
|
||||||
|
|
||||||
import { permissionRequiredProcedure } from "../../trpc";
|
import { permissionRequiredProcedure } from "../../trpc";
|
||||||
|
|
||||||
@@ -217,9 +217,7 @@ export const metadataProcedures = {
|
|||||||
const template = normalizeCustomJsxAuthoringTemplate(rawTemplate);
|
const template = normalizeCustomJsxAuthoringTemplate(rawTemplate);
|
||||||
const diagnostics = addCustomJsxDiagnosticSourceExcerpts(template, validateCustomJsxTemplate(template));
|
const diagnostics = addCustomJsxDiagnosticSourceExcerpts(template, validateCustomJsxTemplate(template));
|
||||||
const valid = diagnostics.every((diagnostic) => diagnostic.severity !== "error");
|
const valid = diagnostics.every((diagnostic) => diagnostic.severity !== "error");
|
||||||
const hasUnknownProp = diagnostics.some((diagnostic) =>
|
const hasUnknownProp = diagnostics.some((diagnostic) => diagnostic.message.startsWith("UNKNOWN_MANTINE_PROP"));
|
||||||
diagnostic.message.startsWith("UNKNOWN_MANTINE_PROP"),
|
|
||||||
);
|
|
||||||
let nextStep =
|
let nextStep =
|
||||||
"After the manifest and template agree, send the complete definition once to customWidget_previewCreate for full validation and a testable preview.";
|
"After the manifest and template agree, send the complete definition once to customWidget_previewCreate for full validation and a testable preview.";
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"./catalog-example": "./src/core/component-example.ts",
|
"./catalog-example": "./src/core/component-example.ts",
|
||||||
"./core": "./src/core/index.ts",
|
"./core": "./src/core/index.ts",
|
||||||
"./jsx": "./src/jsx/index.ts",
|
"./jsx": "./src/jsx/index.ts",
|
||||||
|
"./jsx/analyzer": "./src/jsx/analyzer.ts",
|
||||||
"./runtime": "./src/runtime/index.ts",
|
"./runtime": "./src/runtime/index.ts",
|
||||||
"./server": "./src/server/index.ts",
|
"./server": "./src/server/index.ts",
|
||||||
"./workbench": "./src/workbench/index.ts"
|
"./workbench": "./src/workbench/index.ts"
|
||||||
|
|||||||
Reference in new issue
Block a user