- frontend/src + messages restored byte-identical to upstream v1.3.3: format normalization shims, isMoxieEditorFormat gates, bundle marker, tooltip reword, and their tests all removed; editor bundle rebuilt from that pristine source so the editor behaves exactly like upstream - format combo shows 'MiniMax' again (options=[MiniMax]); legacy queued 'Moxie Multimedia' values still normalized to MiniMax at execution - T2V resolves natively again: t2v stays t2v in h3_task_type, _multitrack_task_type and getMultiTrackTaskType; generation-mode t2v mapping and the zero-media cloud fallback removed (upstream behavior); Python tests and stub scripts updated accordingly - editor delivery fix: core lets WEB_DIRECTORY overwrite the pack's EXTENSION_WEB_DIRS entry, so the /extensions listing never contained dist/release and a fresh browser never imported the editor (it only ever appeared from stale browser cache). web/js/editor-loader.js now imports the editor entry from the pack's own static mount, which serves index.js with no-cache (chunks stay cacheable); the /extensions/<pack>/index.js route was removed as a 404 trap - shipped Moxie*.json templates carry format value MiniMax Verified: frontend diff vs upstream = 0; bundle string checks + chunk refs; vitest 565/566 (same pre-existing jsdom URL.revokeObjectURL env failure); py_compile; test_t2v_r2v_and_loader.py ALL PASS; test_rtx_upscale_integration.py ALL PASS
49 lines
2.2 KiB
JavaScript
49 lines
2.2 KiB
JavaScript
// Editor bundle loader.
|
|
//
|
|
// WHY THIS FILE EXISTS
|
|
// ComfyUI core (nodes.py, load_custom_node) lets a pack's WEB_DIRECTORY
|
|
// overwrite its EXTENSION_WEB_DIRS entry after the pack's __init__.py has
|
|
// run. This pack ships WEB_DIRECTORY = "./web" (the helper files next to
|
|
// this loader), so core's static mount and the browser's /extensions listing
|
|
// only ever see THIS directory - never dist/release. The React editor entry
|
|
// (dist/release/index.js) would therefore never be imported on a fresh
|
|
// browser, and the editor only appeared for people whose browser still held
|
|
// an old cached copy.
|
|
//
|
|
// This loader bridges that gap: the frontend imports every listed extension
|
|
// file (this one included), and this file then imports the real editor entry
|
|
// from the pack's own static mount "/<pack>/index.js", which __init__.py
|
|
// serves with "Cache-Control: no-cache, must-revalidate". The entry file is
|
|
// therefore always revalidated, and its relative chunk imports
|
|
// ("./chunks/...") resolve against the same mount, which serves the
|
|
// content-hashed chunk files that ship next to it. No cache can pin a stale
|
|
// editor bundle anymore.
|
|
//
|
|
// The pack folder name is derived from this file's own URL
|
|
// (.../extensions/<pack>/js/editor-loader.js), so the loader works no matter
|
|
// what the pack directory is called.
|
|
|
|
const segments = new URL(import.meta.url).pathname
|
|
.split('/')
|
|
.filter(Boolean)
|
|
.map(decodeURIComponent);
|
|
|
|
const extensionsIndex = segments.lastIndexOf('extensions');
|
|
const packName = extensionsIndex >= 0 ? segments[extensionsIndex + 1] : null;
|
|
|
|
if (!packName) {
|
|
console.warn(
|
|
'[Moxie Multimedia Suite] editor loader could not resolve the pack folder from',
|
|
import.meta.url,
|
|
);
|
|
} else {
|
|
// Base prefix covers deployments behind a sub-path reverse proxy
|
|
// ("/comfyui/extensions/<pack>/..." -> "/comfyui/"); the pack's own
|
|
// static mount sits at "<base><pack>/".
|
|
const base = '/' + segments.slice(0, extensionsIndex).join('/') + '/';
|
|
// Top-level await: extension scripts are awaited before ComfyUI registers
|
|
// node definitions, so the editor's registerExtension()/custom-widget
|
|
// hooks stay in the normal loading order.
|
|
await import(`${base}${packName}/index.js`);
|
|
}
|