feat: move registry and runtime into separate packages
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m32s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m32s
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Grid from "$lib/grid";
|
||||
import GraphInterface from "$lib/graph-interface";
|
||||
import { WorkerRuntimeExecutor } from "$lib/worker-runtime-executor";
|
||||
import { RemoteNodeRegistry } from "$lib/node-registry-client";
|
||||
import * as templates from "$lib/graph-templates";
|
||||
import type { Graph, Node } from "@nodes/types";
|
||||
import Viewer from "$lib/result-viewer/Viewer.svelte";
|
||||
@@ -18,17 +16,17 @@
|
||||
import Panel from "$lib/settings/Panel.svelte";
|
||||
import GraphSettings from "$lib/settings/panels/GraphSettings.svelte";
|
||||
import NestedSettings from "$lib/settings/panels/NestedSettings.svelte";
|
||||
import { createPerformanceStore } from "$lib/performance";
|
||||
import type { Group, Scene } from "three";
|
||||
import type { Group } from "three";
|
||||
import ExportSettings from "$lib/settings/panels/ExportSettings.svelte";
|
||||
import {
|
||||
MemoryRuntimeCache,
|
||||
WorkerRuntimeExecutor,
|
||||
MemoryRuntimeExecutor,
|
||||
} from "$lib/runtime-executor";
|
||||
import { IndexDBCache } from "$lib/node-registry-cache";
|
||||
import { decodeNestedArray, fastHashString } from "@nodes/utils";
|
||||
} from "@nodes/runtime";
|
||||
import { IndexDBCache, RemoteNodeRegistry } from "@nodes/registry";
|
||||
import { decodeNestedArray, createPerformanceStore } from "@nodes/utils";
|
||||
import BenchmarkPanel from "$lib/settings/panels/BenchmarkPanel.svelte";
|
||||
import { debounceAsyncFunction, withArgsChangeOnly } from "$lib/helpers";
|
||||
import { debounceAsyncFunction } from "$lib/helpers";
|
||||
|
||||
let performanceStore = createPerformanceStore("page");
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { MemoryRuntimeExecutor } from "$lib/runtime-executor";
|
||||
import { RemoteNodeRegistry } from "$lib/node-registry-client";
|
||||
import { createPerformanceStore } from "$lib/performance";
|
||||
|
||||
const registry = new RemoteNodeRegistry("");
|
||||
const runtime = new MemoryRuntimeExecutor(registry);
|
||||
const performanceStore = createPerformanceStore();
|
||||
runtime.perf = performanceStore;
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
export const POST: RequestHandler = async ({ request, fetch }) => {
|
||||
|
||||
const { graph, settings } = await request.json();
|
||||
|
||||
if (!graph || !settings) {
|
||||
return new Response("Invalid request", { status: 400 });
|
||||
}
|
||||
|
||||
registry.fetch = fetch;
|
||||
|
||||
await registry.load(graph.nodes.map(node => node.type))
|
||||
|
||||
const res = await runtime.execute(graph, settings);
|
||||
|
||||
let headers: Record<string, string> = { "Content-Type": "application/octet-stream" };
|
||||
if (runtime.perf) {
|
||||
headers["performance"] = JSON.stringify(runtime.perf.get());
|
||||
}
|
||||
|
||||
return new Response(res, { headers });
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user