A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
refactor(pipeline): what a project IS belongs to the build, not to the editor
esenginefa9e65fc828e
diff --git a/desktop/electron/agent/acceptance.ts b/desktop/electron/agent/acceptance.tsindex d461da4a2..688a80488 100644--- a/desktop/electron/agent/acceptance.ts+++ b/desktop/electron/agent/acceptance.ts@@ -16,7 +16,7 @@* criterion with neither is refused rather than recorded as passing.*/import type { KernelDeps } from './types';-import type { AcceptanceCriterion } from '../../src/project/format';+import type { AcceptanceCriterion } from '../../../pipeline/src/project/format';/*** One claim, and the thing that settles it. The project's standing claims arediff --git a/desktop/electron/agent/store.ts b/desktop/electron/agent/store.tsindex 9c7f95be2..bfc251b40 100644--- a/desktop/electron/agent/store.ts+++ b/desktop/electron/agent/store.ts@@ -23,7 +23,7 @@*/import { writeFile, readFile, mkdir, readdir, rm, stat } from 'node:fs/promises';import path from 'node:path';-import { WORKSPACE_DIR } from '../../src/project/format';+import { WORKSPACE_DIR } from '../../../pipeline/src/project/format';import type { AgentEvent } from './types';const AGENT_SUBDIR = 'agent';diff --git a/desktop/electron/assetMeta.ts b/desktop/electron/assetMeta.tsindex b5f2cd66d..3f80517f7 100644--- a/desktop/electron/assetMeta.ts+++ b/desktop/electron/assetMeta.ts@@ -14,7 +14,7 @@ import { writeFile, open } from 'node:fs/promises';import { existsSync } from 'node:fs';import { randomUUID } from 'node:crypto';import { META_EXT } from './contentPolicy';-import { importerDefaults } from '../src/project/assetImporter';+import { importerDefaults } from '../../pipeline/src/project/importSettings';import {EXT_TO_TYPE, metaTypeForExt, metaTypeForContent, needsContentType, CONTENT_SNIFF_BYTES,} from '../../tools/assetMetaTable.js';diff --git a/desktop/electron/autosave.ts b/desktop/electron/autosave.tsindex 559e1b415..c5ec999d1 100644--- a/desktop/electron/autosave.ts+++ b/desktop/electron/autosave.ts@@ -15,7 +15,7 @@import { writeFile, mkdir, rm, stat, readdir, cp } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { WORKSPACE_DIR } from '../src/project/format';+import { WORKSPACE_DIR } from '../../pipeline/src/project/format';import { resolveInRoot } from './projectFs';const AUTOSAVE_SUBDIR = 'autosave';diff --git a/desktop/electron/contentPolicy.ts b/desktop/electron/contentPolicy.tsindex b4bfc674b..5137d535c 100644--- a/desktop/electron/contentPolicy.ts+++ b/desktop/electron/contentPolicy.ts@@ -6,7 +6,7 @@* can't disagree. `.meta` sidecars and dot entries are pipeline/plumbing, not* content. Pure (no I/O) → unit-testable.*/-import { PROJECT_PLUGIN_REL } from '../src/plugins/paths';+import { PROJECT_PLUGIN_REL } from '../../pipeline/src/project/pluginPaths';/** Sidecar suffix carrying an asset's uuid/type/importer (see assetDb). */export const META_EXT = '.meta';diff --git a/desktop/electron/cookAssets.ts b/desktop/electron/cookAssets.tsindex 5ee88f731..ffc635ddb 100644--- a/desktop/electron/cookAssets.ts+++ b/desktop/electron/cookAssets.ts@@ -25,7 +25,7 @@ import { packAtlas, decodePngImage, encodePagePng, encodeRgbaPng, downscaleRgba,// Per-asset texture cook settings (compress opt-out / format / size cap), read// from the `.meta` `importer` block — the same registry the inspector edits, so a// texture's ship-time compression is authored per asset, not one global switch.-import { readTextureCookSettings } from '../src/project/assetImporter';+import { readTextureCookSettings } from '../../pipeline/src/project/importSettings';// Single-source content hash (sdk/src/asset/contentHash.ts). Imported as source —// no hand-mirrored copy — so the cook and the runtime agree by construction.import { contentHashHex } from '../../sdk/src/asset/contentHash';diff --git a/desktop/electron/exportGame.ts b/desktop/electron/exportGame.tsindex da1cb8eb4..1273d0fb8 100644--- a/desktop/electron/exportGame.ts+++ b/desktop/electron/exportGame.ts@@ -30,7 +30,7 @@ import { activeRemoteRoot } from '../../sdk/src/asset/assetGroups';import type { PackagedGameConfig } from 'esengine';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../src/project/runtimeConfig';+} from '../../pipeline/src/project/runtimeConfig';import { IMPORT_MAP_JSON, IMPORT_MAP_CSP_HASH } from './buildPlayRealm';import { exportWeChat } from './exportWeChat';import { exportMiniGame } from './exportMiniGame';@@ -49,12 +49,12 @@ import { assembleAab, aabFileName } from '../../build-tools/utils/aab.js';import { assembleDesktopApp } from '../../build-tools/utils/desktopApp.js';import { emitSteamBuild, defaultDepotId } from '../../build-tools/utils/steamChannel.js';import { debugSigningKey, type SigningKey } from '../../build-tools/utils/androidKeystore.js';-import { isNativePlatform, desktopTemplateFor, type DesktopOs, type ExportPlatform } from '../src/project/platforms';-import type { DesktopPackaging, SteamPackaging } from '../src/project/format';-import type { SizeBudget } from '../src/project/sizeBudget';+import { isNativePlatform, desktopTemplateFor, type DesktopOs, type ExportPlatform } from '../../pipeline/src/project/platforms';+import type { DesktopPackaging, SteamPackaging } from '../../pipeline/src/project/format';+import type { SizeBudget } from '../../pipeline/src/project/sizeBudget';import { measureBuild, type BuildSizeReport } from './sizeReport';import { loadProjectModules, sideModuleDeclarations, stageProjectModules } from './projectModules';-import { collectSubsystems, subsystemGapWarnings, targetGaps, type Subsystem } from '../src/project/targetSupport';+import { collectSubsystems, subsystemGapWarnings, targetGaps, type Subsystem } from '../../pipeline/src/project/targetSupport';export type { ExportPlatform };/**diff --git a/desktop/electron/exportMiniGame.ts b/desktop/electron/exportMiniGame.tsindex 778d7cd5f..098ff7bc8 100644--- a/desktop/electron/exportMiniGame.ts+++ b/desktop/electron/exportMiniGame.ts@@ -31,7 +31,7 @@import { loadEsbuild } from './esbuildRuntime';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../src/project/runtimeConfig';+} from '../../pipeline/src/project/runtimeConfig';import { writeFile, mkdir, cp, readFile, rename, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';diff --git a/desktop/electron/exportPlayable.ts b/desktop/electron/exportPlayable.tsindex 9164b537a..7ce872eaf 100644--- a/desktop/electron/exportPlayable.ts+++ b/desktop/electron/exportPlayable.ts@@ -19,7 +19,7 @@import { loadEsbuild } from './esbuildRuntime';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../src/project/runtimeConfig';+} from '../../pipeline/src/project/runtimeConfig';import { writeFile, mkdir, readFile, stat, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';diff --git a/desktop/electron/launcher.ts b/desktop/electron/launcher.tsindex cd79bf0dc..d3bad63a1 100644--- a/desktop/electron/launcher.ts+++ b/desktop/electron/launcher.ts@@ -16,7 +16,7 @@ import {parseManifest,type RecentEntry,type TemplateEntry,-} from '../src/project/format';+} from '../../pipeline/src/project/format';import { scaffoldProjectFiles } from './projectScaffold';type StoredRecent = Pick<RecentEntry, 'name' | 'root' | 'openedAt'>;diff --git a/desktop/electron/main.ts b/desktop/electron/main.tsindex 0bf050653..6a586a244 100644--- a/desktop/electron/main.ts+++ b/desktop/electron/main.ts@@ -23,7 +23,7 @@ import {resolveInRoot,META_EXT,} from './projectFs';-import { PROJECT_MANIFEST_FILE, type AcceptanceCriterion } from '../src/project/format';+import { PROJECT_MANIFEST_FILE, type AcceptanceCriterion } from '../../pipeline/src/project/format';import { isInsideRoot } from './pathSandbox';import * as journal from './fileJournal';import { syncAutosave, listAutosave, restoreAutosave, clearAutosave, type AutosaveEntry } from './autosave';@@ -42,7 +42,7 @@ import {removeNativeTemplate, downloadNativeTemplate, type TemplatePlatform,} from './nativeTemplates';import { isTemplatePlatform } from '../../build-tools/utils/nativeTemplate.js';-import { DESKTOP_OSES } from '../src/project/platforms';+import { DESKTOP_OSES } from '../../pipeline/src/project/platforms';import { loopbackServer, closeAllLoopbackServers } from './loopbackServer';import { httpContentType } from './mimeTypes';import { buildPlayRealm } from './buildPlayRealm';@@ -82,9 +82,9 @@ import {listPlayableNetworks, loadPlayableProfile,type PlatformRuntimeDirs, type ProjectPlatformKind,} from './platformCatalog';-import { resolveLayout, resolveScripts, resolveOrientation, resolveAppId, type ExportPlatform } from '../src/project/format';-import { runtimeConfigOf } from '../src/project/runtimeConfig';-import type { WorkspaceState } from '../src/project/format';+import { resolveLayout, resolveScripts, resolveOrientation, resolveAppId, type ExportPlatform } from '../../pipeline/src/project/format';+import { runtimeConfigOf } from '../../pipeline/src/project/runtimeConfig';+import type { WorkspaceState } from '../../pipeline/src/project/format';// Enable WebGPU in the renderer so the viewport's WebGPU backend (Settings →// Renderer) has an adapter to acquire. Without it navigator.gpu has no adapter anddiff --git a/desktop/electron/miniGameExportProfile.ts b/desktop/electron/miniGameExportProfile.tsindex 45a8b53a3..b14d3cedb 100644--- a/desktop/electron/miniGameExportProfile.ts+++ b/desktop/electron/miniGameExportProfile.ts@@ -12,7 +12,7 @@* Adding a vendor = one profile object, not a fork of the pipeline.*/import { WECHAT_MODULE_BUILD_TARGET } from './sideModuleScan';-import type { SizeBudget } from '../src/project/sizeBudget';+import type { SizeBudget } from '../../pipeline/src/project/sizeBudget';/*** A mini-game vendor's id. Open on purpose: the value is identity — the cook'sdiff --git a/desktop/electron/platformCatalog.ts b/desktop/electron/platformCatalog.tsindex 4cb61930d..139d49b7b 100644--- a/desktop/electron/platformCatalog.ts+++ b/desktop/electron/platformCatalog.ts@@ -30,7 +30,7 @@ import {BUILTIN_PLAYABLE_PROFILES, builtinPlayableProfile, genericPlayableProfile,type PlayableAdProfile,} from './playableAdProfile';-import { BUILTIN_PLATFORMS, DESKTOP_OSES, desktopTemplateFor, type PlatformPrereq } from '../src/project/platforms';+import { BUILTIN_PLATFORMS, DESKTOP_OSES, desktopTemplateFor, type PlatformPrereq } from '../../pipeline/src/project/platforms';import { resolveNativeTemplate } from './nativeTemplates';import { templateId } from '../../build-tools/utils/nativeTemplate.js';import type { MiniGameExportProfile, MiniGameConfigContext } from './miniGameExportProfile';diff --git a/desktop/electron/pluginHost.ts b/desktop/electron/pluginHost.tsindex de847f7df..810d5b492 100644--- a/desktop/electron/pluginHost.ts+++ b/desktop/electron/pluginHost.ts@@ -34,7 +34,7 @@ import { readdir, readFile } from 'node:fs/promises';import path from 'node:path';import { loadEsbuild } from './esbuildRuntime';import { validateManifest, type PluginManifest } from '../src/plugins/manifest';-import { PROJECT_PLUGIN_REL } from '../src/plugins/paths';+import { PROJECT_PLUGIN_REL } from '../../pipeline/src/project/pluginPaths';import { PROJECT_PLATFORM_DIR, platformTrustId } from './platformCatalog';/** Where a project keeps its own plugins (sibling of `.esengine/platforms/`),diff --git a/desktop/electron/pluginPackage.ts b/desktop/electron/pluginPackage.tsindex 1ace5cfce..e3c86fe66 100644--- a/desktop/electron/pluginPackage.ts+++ b/desktop/electron/pluginPackage.ts@@ -26,7 +26,7 @@ import { readFile, writeFile, mkdir, rm } from 'node:fs/promises';import path from 'node:path';import { makeZip, zipTree, listZip, readZip, extractZip } from '../../build-tools/utils/zip.js';import { validateManifest, resolveLocalized, type PluginManifest } from '../src/plugins/manifest';-import { PLUGIN_TYPES_DIR } from '../src/plugins/paths';+import { PLUGIN_TYPES_DIR } from '../../pipeline/src/project/pluginPaths';/** The extension, spelled once. */export const PLUGIN_PACKAGE_EXT = 'esplugin';diff --git a/desktop/electron/pluginScaffold.ts b/desktop/electron/pluginScaffold.tsindex 0b9409789..e3b6c4944 100644--- a/desktop/electron/pluginScaffold.ts+++ b/desktop/electron/pluginScaffold.ts@@ -21,7 +21,7 @@ import { existsSync } from 'node:fs';import { mkdir, writeFile } from 'node:fs/promises';import path from 'node:path';import { pluginIdProblem } from '../src/plugins/manifest';-import { PLUGIN_TYPES_DIR } from '../src/plugins/paths';+import { PLUGIN_TYPES_DIR } from '../../pipeline/src/project/pluginPaths';/** Sample contributions the scaffold can write into the entry file. */export type ScaffoldContribution = 'command' | 'panel' | 'inspector' | 'overlay' | 'tool';diff --git a/desktop/electron/preload.ts b/desktop/electron/preload.tsindex 638c4b279..c34f91836 100644--- a/desktop/electron/preload.ts+++ b/desktop/electron/preload.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { contextBridge, ipcRenderer, webUtils } from 'electron';-import type { OpenedProject, WorkspaceState, DirEntry, RecentEntry, TemplateEntry, ExportPlatform } from '../src/project/format';+import type { OpenedProject, WorkspaceState, DirEntry, RecentEntry, TemplateEntry, ExportPlatform } from '../../pipeline/src/project/format';import type { BuildScriptsResult } from './buildScripts';import type { ExtractSchemasResult } from './extractSchemas';import type { ScaffoldScriptResult, ScriptKind } from './scriptScaffold';diff --git a/desktop/electron/projectFs.ts b/desktop/electron/projectFs.tsindex de83cc616..dd84328ba 100644--- a/desktop/electron/projectFs.ts+++ b/desktop/electron/projectFs.ts@@ -22,7 +22,7 @@ import {type OpenedProject,type WorkspaceState,type DirEntry,-} from '../src/project/format';+} from '../../pipeline/src/project/format';import { META_EXT, isContentDir, isContentFile } from './contentPolicy';import { resolveInside } from './pathSandbox';import { capture } from './fileJournal';diff --git a/desktop/electron/projectModules.ts b/desktop/electron/projectModules.tsindex 4d552e428..ff07b63b0 100644--- a/desktop/electron/projectModules.ts+++ b/desktop/electron/projectModules.ts@@ -36,7 +36,7 @@import { readFile, readdir, cp, mkdir, writeFile } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { isNativePlatform, type ExportPlatform } from '../src/project/platforms';+import { isNativePlatform, type ExportPlatform } from '../../pipeline/src/project/platforms';/** Where a project keeps them. */export const PROJECT_MODULES_DIR = path.join('.esengine', 'modules');diff --git a/desktop/electron/sizeReport.ts b/desktop/electron/sizeReport.tsindex 6aa9f8068..6f6a02f89 100644--- a/desktop/electron/sizeReport.ts+++ b/desktop/electron/sizeReport.ts@@ -25,11 +25,11 @@*/import { readFile, stat, readdir } from 'node:fs/promises';import path from 'node:path';-import type { ExportPlatform } from '../src/project/platforms';+import type { ExportPlatform } from '../../pipeline/src/project/platforms';import {evaluateSizeBudget, resolveSizeBudgets,type SizeBudget, type SizeVerdict,-} from '../src/project/sizeBudget';+} from '../../pipeline/src/project/sizeBudget';/** Where a file sits in the delivery model — see the file header. */export type SizeBucket = 'initial' | 'lazy' | 'remote';diff --git a/desktop/scripts/export-project.mjs b/desktop/scripts/export-project.mjsindex d3da177a3..507a3c883 100644--- a/desktop/scripts/export-project.mjs+++ b/desktop/scripts/export-project.mjs@@ -120,7 +120,7 @@ async function loadProjectFormat() {// into one module: a headless export that derived the project's settings by// hand would be a second answer to what a project MEANS.stdin: {- contents: "export * from './src/project/format';\nexport * from './src/project/runtimeConfig';\n",+ contents: "export * from '../pipeline/src/project/format';\nexport * from '../pipeline/src/project/runtimeConfig';\n",resolveDir: DESKTOP,sourcefile: 'projectFormat.ts',loader: 'ts',diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsxindex bbec2b67c..d7ccf6d36 100644--- a/desktop/src/components/BuildDialog.tsx+++ b/desktop/src/components/BuildDialog.tsx@@ -33,12 +33,12 @@ import {Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy, ExternalLink, Play,Globe, Monitor, MessageSquare, ChevronRight, Smartphone, Apple, Package, TriangleAlert, Plus,} from 'lucide-react';-import type { ExportPlatform, NativeToolchain, PlatformPrereq } from '@/project/platforms';+import type { ExportPlatform, NativeToolchain, PlatformPrereq } from '../../../pipeline/src/project/platforms';import { platformLabel } from '@/project/platformLabels';import type { PlayableNetworkOption } from '../../electron/platformCatalog';import type { TemplatePlatform } from '../../electron/nativeTemplates';import type { BuildSizeReport } from '../../electron/sizeReport';-import { formatBytes } from '@/project/sizeBudget';+import { formatBytes } from '../../../pipeline/src/project/sizeBudget';import { BuildSizePanel } from '@/components/BuildSizePanel';import { Modal } from '@/components/Modal';import { Segmented } from '@/components/Segmented';@@ -48,7 +48,7 @@ import { Group as SettingsGroup, groupByGroup } from '@/components/SettingsRow';import { settingsRegistry } from '@/settings/registry';import { useSettings } from '@/store/settingsStore';import { ProjectStore } from '@/project/ProjectStore';-import { cookOptionsOf } from '@/project/runtimeConfig';+import { cookOptionsOf } from '../../../pipeline/src/project/runtimeConfig';import { AssetRegistry } from '@/project/AssetRegistry';import { useEditorStore } from '@/store/editorStore';import { t } from '@/i18n';diff --git a/desktop/src/components/BuildSizePanel.tsx b/desktop/src/components/BuildSizePanel.tsxindex 56a9ab6a2..761b8edfb 100644--- a/desktop/src/components/BuildSizePanel.tsx+++ b/desktop/src/components/BuildSizePanel.tsx@@ -19,8 +19,8 @@import { useState } from 'react';import { ChevronRight } from 'lucide-react';import type { BuildSizeReport, SizeBucket, SizeKind } from '../../electron/sizeReport';-import type { BudgetScope, SizeVerdict } from '@/project/sizeBudget';-import { formatBytes, PROJECT_BUDGET_NOTE } from '@/project/sizeBudget';+import type { BudgetScope, SizeVerdict } from '../../../pipeline/src/project/sizeBudget';+import { formatBytes, PROJECT_BUDGET_NOTE } from '../../../pipeline/src/project/sizeBudget';import { t } from '@/i18n';const SCOPE_LABEL: Record<BudgetScope, () => string> = {diff --git a/desktop/src/engine/EngineHost.ts b/desktop/src/engine/EngineHost.tsindex e96ca788e..eb004ec8d 100644--- a/desktop/src/engine/EngineHost.ts+++ b/desktop/src/engine/EngineHost.ts@@ -26,7 +26,7 @@ import { loadEditorDragonBones, editorDragonBonesManager } from './dragonBonesLoimport type { DragonBonesManager } from 'esengine/dragonbones';import { checkEngineBuild } from './EngineGuard';import { bootProfiler } from './bootProfiler';-import { PROJECT_MANIFEST_FILE } from '@/project/format';+import { PROJECT_MANIFEST_FILE } from '../../../pipeline/src/project/format';import type { ReadonlyWorldT, WorldT } from './schema';// Scene the editor opens on boot (placeholder until a project/open-scene flow exists).diff --git a/desktop/src/launcher/Launcher.tsx b/desktop/src/launcher/Launcher.tsxindex 2668876c2..2b7746f08 100644--- a/desktop/src/launcher/Launcher.tsx+++ b/desktop/src/launcher/Launcher.tsx@@ -9,7 +9,7 @@ import { SearchField } from '@/components/SearchField';import { Segmented } from '@/components/Segmented';import { Toaster } from '@/components/Toaster';import { t } from '@/i18n';-import type { RecentEntry, TemplateEntry } from '@/project/format';+import type { RecentEntry, TemplateEntry } from '../../../pipeline/src/project/format';import { version } from '../../package.json';// Project browser shown before a project is open. A hub layout — persistent topdiff --git a/desktop/src/mode/TargetScreen.tsx b/desktop/src/mode/TargetScreen.tsxindex 08b4e2386..94314ab1d 100644--- a/desktop/src/mode/TargetScreen.tsx+++ b/desktop/src/mode/TargetScreen.tsx@@ -20,7 +20,7 @@ import { OvDropdown, DdCheck, DdRadio } from '@/components/OverlayMenu';import { useEditorMode } from '@/store/editorModeStore';import { screenPresets, screenPresetById, deviceDims } from '@/mode/resolutionPresets';import { ProjectStore } from '@/project/ProjectStore';-import type { ScreenPreset as ProjectScreenPreset } from '@/project/format';+import type { ScreenPreset as ProjectScreenPreset } from '../../../pipeline/src/project/format';/** The open project's declared screens, reactively. */export function useProjectScreenPresets(): ProjectScreenPreset[] | undefined {diff --git a/desktop/src/mode/resolutionPresets.ts b/desktop/src/mode/resolutionPresets.tsindex 4f04496b3..b299a8faf 100644--- a/desktop/src/mode/resolutionPresets.ts+++ b/desktop/src/mode/resolutionPresets.ts@@ -9,7 +9,7 @@* orientation toggle swaps them at render time.*/import { t } from '@/i18n';-import type { ScreenPreset as ProjectScreenPreset } from '@/project/format';+import type { ScreenPreset as ProjectScreenPreset } from '../../../pipeline/src/project/format';/** The built-in ids. Not a closed set: a project may declare its own screens, so* anything holding a selection types it as `string`. */diff --git a/desktop/src/panels/ContentBrowser.tsx b/desktop/src/panels/ContentBrowser.tsxindex e227c407d..555ab0ab6 100644--- a/desktop/src/panels/ContentBrowser.tsx+++ b/desktop/src/panels/ContentBrowser.tsx@@ -16,7 +16,7 @@ import { AssetRegistry } from '@/project/AssetRegistry';import { Toasts } from '@/store/Toasts';import { useSelection } from '@/store/selectionStore';import { IMAGE_RE, baseName, TYPE_CODE } from '@/project/assetMeta';-import { formatBytes } from '@/project/sizeBudget';+import { formatBytes } from '../../../pipeline/src/project/sizeBudget';import { openAssetOfType } from '@/project/assetOpen';import { assetTypeRegistry } from '@/project/assetTypes';import { contributedContextRows } from '@/plugins/contextMenus';@@ -39,7 +39,7 @@ import { ASSET_GROUP_MODES, type AssetGroupMode } from 'esengine';import { onAssetReveal } from '@/project/assetReveal';import { fsRefresh } from '@/project/fsRefresh';import { t, type MsgKey } from '@/i18n';-import type { DirEntry } from '@/project/format';+import type { DirEntry } from '../../../pipeline/src/project/format';import type { AssetType } from '@/types';const TILE_MIN = 64;diff --git a/desktop/src/panels/Details.tsx b/desktop/src/panels/Details.tsxindex 86d340cd0..175a52f96 100644--- a/desktop/src/panels/Details.tsx+++ b/desktop/src/panels/Details.tsx@@ -45,8 +45,8 @@ import { NineSliceEditor } from '@/components/NineSliceEditor';import { fsRefresh } from '@/project/fsRefresh';import { Toasts } from '@/store/Toasts';import { baseName, IMAGE_RE } from '@/project/assetMeta';-import { BUILTIN_PLATFORMS, type BuiltinPlatform } from '@/project/platforms';-import { formatBytes } from '@/project/sizeBudget';+import { BUILTIN_PLATFORMS, type BuiltinPlatform } from '../../../pipeline/src/project/platforms';+import { formatBytes } from '../../../pipeline/src/project/sizeBudget';import { useSelection } from '@/store/selectionStore';import { usePrefabConflicts } from '@/store/prefabConflicts';import { useEditorStore } from '@/store/editorStore';@@ -72,7 +72,8 @@ import { localizePlugin } from '@/plugins/localize';import type { AssetInspectorContribution, ComponentInspectorContribution } from '@/plugins/types';import * as imap from '@/project/inputMapDoc';import * as ldoc from '@/project/localeTableDoc';-import { buildImporterComponent, applyImporterEdit, readTextureCookSettings } from '@/project/assetImporter';+import { buildImporterComponent, applyImporterEdit } from '@/project/assetImporter';+import { readTextureCookSettings } from '../../../pipeline/src/project/importSettings';import { findAssetUsages } from '@/project/assetUsages';import { FindUsagesDialog } from '@/components/FindUsagesDialog';import { ProjectStore } from '@/project/ProjectStore';diff --git a/desktop/src/playableHost.ts b/desktop/src/playableHost.tsindex 8357112f5..8fdfc6851 100644--- a/desktop/src/playableHost.ts+++ b/desktop/src/playableHost.ts@@ -16,7 +16,7 @@ import {} from 'esengine';import type { SceneData, EmbeddedSideModuleRegistry } from 'esengine';import type { ESEngineModule as EngineModule } from 'esengine/wasm';-import type { PackagedRuntimeFields } from '@/project/runtimeConfig';+import type { PackagedRuntimeFields } from '../../pipeline/src/project/runtimeConfig';type EngineFactory = (opts?: Record<string, unknown>) => Promise<EngineModule>;// Inlined by exportPlayable as <script> globals (kept out of the bundle so thediff --git a/desktop/src/plugins/init.ts b/desktop/src/plugins/init.tsindex f4cb7f04a..29b1c44cb 100644--- a/desktop/src/plugins/init.ts+++ b/desktop/src/plugins/init.ts@@ -12,7 +12,7 @@* that tests can drive without a project.*/import { ProjectStore } from '@/project/ProjectStore';-import { PROJECT_PLUGIN_REL, PLUGIN_TYPES_FILE } from './paths';+import { PROJECT_PLUGIN_REL, PLUGIN_TYPES_FILE } from '../../../pipeline/src/project/pluginPaths';import { PluginHost } from './PluginHost';// The public type surface, as TEXT. types.ts is types-only and import-free// precisely so it doubles as the `.d.ts` plugin authors compile against — shippingdiff --git a/desktop/src/project/ProjectStore.ts b/desktop/src/project/ProjectStore.tsindex 96c1e3b51..b079e6190 100644--- a/desktop/src/project/ProjectStore.ts+++ b/desktop/src/project/ProjectStore.ts@@ -2,14 +2,15 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { createStore } from 'zustand/vanilla';import { getComponent, Assets, migratePrefabData, extractPrefab, flattenPrefab, collectExternalEntityRefs, collapseInstance, applyDeltaToSource, buildVariant, textureImportSettingsFrom, Renderer, RETIRED_COMPONENT_TYPES, parseThemeOverrides, resolveAssetGroup, folderGroupMode, withFolderGroup, folderAlwaysInclude, withFolderAlwaysInclude, withActiveRemoteRoot, Audio, applyAudioProjectConfig } from 'esengine';-import { importerDefaults, applyImporterEdit } from './assetImporter';+import { applyImporterEdit } from './assetImporter';+import { importerDefaults } from '../../../pipeline/src/project/importSettings';import { AssetRegistry, UUID_PREFIX, refUuid, type AssetEntryLite } from './AssetRegistry';import { imageSize } from './imageSize';import { PrefabCache } from './PrefabCache';import {runtimeConfigOf, packagedRuntimeFields, normalizeCollisionLayers, normalizeCollisionLayerMasks,type RuntimeProjectConfig,-} from './runtimeConfig';+} from '../../../pipeline/src/project/runtimeConfig';import type { ParsedTextureImportSettings } from 'esengine';import type { SceneData, PrefabData, ExtractEntity, ProcessedEntity, PhysicsPluginConfig, AudioProjectConfig, AssetsData, ThemeOverrides, AddressableManifest, AssetGroupsConfig, AssetGroupMode } from 'esengine';import { EngineHost } from '@/engine/EngineHost';@@ -45,7 +46,7 @@ import { confirm } from '@/components/confirm';import { previewApply } from './applyPreview';import { t } from '@/i18n';import { ASSET_SLOTS, metaTypeToSlot } from '@/project/assetSlots';-import { resolveLayout, orientationFromDesignResolution, resolveOrientation, cameraScaleModeValue, resolveScripts, DEFAULT_SCRIPTS, WORKSPACE_DIR, PROJECT_MANIFEST_FILE, SORTING_LAYER_COUNT, trimSortingLayers, type OpenedProject, type ProjectFeatures, type ProjectLayout, type ProjectPackaging, type SteamPackaging, type ProjectScripts, type WorkspaceState, type DesignResolution, type ScreenPreset, type ScreenOrientation, type CameraScaleMode, type ExportPlatform, type AcceptanceCriterion } from './format';+import { resolveLayout, orientationFromDesignResolution, resolveOrientation, cameraScaleModeValue, resolveScripts, DEFAULT_SCRIPTS, WORKSPACE_DIR, PROJECT_MANIFEST_FILE, SORTING_LAYER_COUNT, trimSortingLayers, type OpenedProject, type ProjectFeatures, type ProjectLayout, type ProjectPackaging, type SteamPackaging, type ProjectScripts, type WorkspaceState, type DesignResolution, type ScreenPreset, type ScreenOrientation, type CameraScaleMode, type ExportPlatform, type AcceptanceCriterion } from '../../../pipeline/src/project/format';import { useEditorMode } from '@/store/editorModeStore';import { PlayInspect } from '@/engine/PlayInspect';import { useEditorStore } from '@/store/editorStore';diff --git a/desktop/src/project/assetImporter.ts b/desktop/src/project/assetImporter.tsindex c5f666678..092369066 100644--- a/desktop/src/project/assetImporter.ts+++ b/desktop/src/project/assetImporter.ts@@ -2,245 +2,33 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team/*** @file assetImporter.ts- * @brief Single source of truth for per-type asset import settings (the `.meta`- * `importer` block). One registry produces both the import-time defaults and- * the inspector's editable fields, so the two can't drift. DOM/engine-free- * (importable from the Electron main process; the type import is erased).+ * @brief Renders the project's import settings as inspector rows.+ *+ * What the settings ARE — their keys, defaults and value ranges — is the+ * project's, and lives in the pipeline so a build with no window reads the+ * same registry. This side owns only the mapping onto the inspector's+ * field vocabulary.*/import type { InspectorField, InspectorComponent, InspectorFieldValue } from '@/types';--/** A field spec: an InspectorField minus the live `value` (filled per asset) plus- * its import-time default (which also becomes the inspector's reset target). */-export type ImporterFieldSpec = Omit<InspectorField, 'value' | 'defaultValue'> & {- default: InspectorFieldValue;-};--const powerOfTwo = [256, 512, 1024, 2048, 4096, 8192];--const TEXTURE: ImporterFieldSpec[] = [- {- key: 'maxSize', label: 'Max Size', type: 'enum', default: 2048, category: 'Texture',- options: powerOfTwo.map((n) => ({ label: String(n), value: n })),- tooltip: 'Downscale cap applied at cook (power of two). A source larger than this on '- + 'its longest side is box-filtered down; smaller sources are untouched.',- },- {- key: 'compress', label: 'Compress', type: 'bool', default: true, category: 'Texture',- tooltip: 'GPU-compress this texture to KTX2 (Basis Universal) at cook — it stays '- + 'compressed in VRAM and transcodes per device. Turn OFF to ship the raw image '- + '(crisp UI, smooth gradients). Only applies when the build compresses assets.',- },- {- key: 'compressFormat', label: 'Compress Format', type: 'select', default: 'uastc',- category: 'Texture', advanced: true, selectOptions: ['uastc', 'etc1s'],- tooltip: 'UASTC — high quality, larger. ETC1S — much smaller, lower quality '- + '(good for photographic / low-frequency art). Only used when Compress is on.',- },- {- key: 'filterMode', label: 'Filter', type: 'select', default: 'linear', category: 'Texture',- selectOptions: ['nearest', 'linear'],- tooltip: 'Texture sampling filter. Nearest keeps pixels crisp; Linear smooths.',- },- {- key: 'wrapMode', label: 'Wrap', type: 'select', default: 'repeat', category: 'Texture',- selectOptions: ['repeat', 'clamp', 'mirror'],- tooltip: 'How UVs outside [0,1] are addressed.',- },- {- key: 'premultiplyAlpha', label: 'Premultiply Alpha', type: 'bool', default: false,- category: 'Texture', advanced: true,- },- {- key: 'sRGB', label: 'sRGB Color', type: 'bool', default: true, category: 'Texture', advanced: true,- tooltip: 'The image stores sRGB-encoded color (albedo/UI). Disable for authored-linear '- + 'data like normal maps and masks — only meaningful when the project renders in linear color.',- },- { key: 'sliceBorder.left', label: 'Border Left', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },- { key: 'sliceBorder.right', label: 'Border Right', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },- { key: 'sliceBorder.top', label: 'Border Top', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },- { key: 'sliceBorder.bottom', label: 'Border Bottom', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },-];--const SPINE: ImporterFieldSpec[] = [- { key: 'scale', label: 'Scale', type: 'number', default: 1, min: 0, step: 0.01, category: 'Spine' },- { key: 'defaultSkin', label: 'Default Skin', type: 'string', default: 'default', category: 'Spine' },- { key: 'premultiplyAlpha', label: 'Premultiply Alpha', type: 'bool', default: false, category: 'Spine', advanced: true },-];--// A DragonBones file is a project: it can hold several armatures, so which one an-// entity gets is an import-time default rather than something derived from the-// file. Spine needs no equivalent — its file IS one skeleton.-const DRAGONBONES: ImporterFieldSpec[] = [- { key: 'scale', label: 'Scale', type: 'number', default: 1, min: 0, step: 0.01, category: 'DragonBones' },- {- key: 'defaultArmature', label: 'Default Armature', type: 'string', default: '', category: 'DragonBones',- tooltip: 'Armature used when an entity does not name one. Empty picks the first in the file.',- },- {- key: 'defaultAnimation', label: 'Default Animation', type: 'string', default: '', category: 'DragonBones',- tooltip: 'Played on spawn. Empty leaves the armature in its setup pose.',- },-];--const AUDIO: ImporterFieldSpec[] = [- {- key: 'compress', label: 'Compress', type: 'bool', default: true, category: 'Audio',- tooltip: 'Re-encode WAV to MP3 at cook (already-compressed formats pass through). '- + 'MP3 has a small encoder delay — disable for seamless-loop clips.',- },- {- key: 'bitrateKbps', label: 'Bitrate', type: 'enum', default: 128, category: 'Audio',- options: [96, 128, 192].map((n) => ({ label: `${n} kbps`, value: n })),- tooltip: 'MP3 bitrate for cooked WAV sources.',- },-];--const VIDEO: ImporterFieldSpec[] = [- {- key: 'loop', label: 'Loop', type: 'bool', default: true, category: 'Video',- tooltip: 'Suggested loop state when this clip is assigned to a Video component.',- },- { key: 'autoplay', label: 'Autoplay', type: 'bool', default: true, category: 'Video' },- {- key: 'muted', label: 'Muted', type: 'bool', default: true, category: 'Video',- tooltip: 'Muted clips can autoplay; unmuted autoplay is blocked until a user gesture.',- },- {- key: 'quality', label: 'Cook Quality', type: 'number', default: 4, min: 2, max: 31, step: 1,- category: 'Video', advanced: true,- tooltip: 'MPEG-1 quantizer for targets on the wasm decode path (WeChat): '- + '2 = near-lossless (largest file), 31 = smallest. Web targets ship the source untouched.',- },- {- key: 'audioBitrateKbps', label: 'Cook Audio Bitrate', type: 'enum', default: 128,- category: 'Video', advanced: true,- options: [96, 128, 192].map((n) => ({ label: `${n} kbps`, value: n })),- tooltip: 'AAC bitrate for the audio track demuxed at cook (wasm decode path).',- },-];--const SCENELIKE: ImporterFieldSpec[] = [- {- key: 'autoMigrate', label: 'Auto Migrate', type: 'bool', default: true, category: 'Import',- tooltip: 'Upgrade this asset to the current schema version when it loads.',- },-];--/** type → its import-setting field specs. Types absent here have no import- * settings (only metadata) and get an empty defaults object. */-export const IMPORTER_SCHEMAS: Record<string, ImporterFieldSpec[]> = {- texture: TEXTURE,- sprite: TEXTURE,- spine: SPINE,- dragonbones: DRAGONBONES,- audio: AUDIO,- video: VIDEO,- scene: SCENELIKE,- prefab: SCENELIKE,-};--/** Cook-facing audio import settings, tolerant of hand-edited `.meta` blocks. */-export function readAudioImportSettings(importer: Record<string, unknown> | undefined): {- compress: boolean; bitrateKbps: number;-} {- const compress = importer?.compress;- const bitrate = importer?.bitrateKbps;- return {- compress: typeof compress === 'boolean' ? compress : true,- bitrateKbps: bitrate === 96 || bitrate === 128 || bitrate === 192 ? bitrate : 128,- };-}--const getByPath = (obj: Record<string, unknown>, path: string): unknown =>- path.split('.').reduce<unknown>((o, k) => (o && typeof o === 'object' ? (o as Record<string, unknown>)[k] : undefined), obj);--function setByPath(obj: Record<string, unknown>, path: string, value: unknown): void {- const keys = path.split('.');- let cur = obj;- for (let i = 0; i < keys.length - 1; i++) {- const k = keys[i];- if (!cur[k] || typeof cur[k] !== 'object') cur[k] = {};- cur = cur[k] as Record<string, unknown>;- }- cur[keys[keys.length - 1]] = value;-}--/** The `importer` block written into a fresh `.meta` at import time — derived from- * the same specs the inspector edits, so the two never drift. */-export function importerDefaults(type: string): Record<string, unknown> {- const specs = IMPORTER_SCHEMAS[type];- if (!specs) return {};- const out: Record<string, unknown> = {};- for (const s of specs) setByPath(out, s.key, s.default);- return out;-}--/** True when a type exposes editable import settings (drives whether the inspector- * renders an Import Settings section). */-export const hasImporterSettings = (type: string): boolean => (IMPORTER_SCHEMAS[type]?.length ?? 0) > 0;--/** Build the inspector's "Import Settings" component from a type's specs and the- * asset's current `importer` block — filling each field's live value (falling- * back to the default) and its reset target. */+import {+ IMPORTER_SCHEMAS,+ getImporterValueByPath,+ setImporterValueByPath,+} from '../../../pipeline/src/project/importSettings';++/** Build the "Import Settings" component from a type's specs and the asset's+ * current `importer` block — filling each field's live value (falling back to+ * the default) and its reset target. */export function buildImporterComponent(type: string, importer: Record<string, unknown>): InspectorComponent | null {const specs = IMPORTER_SCHEMAS[type];if (!specs?.length) return null;const fields: InspectorField[] = specs.map(({ default: def, ...rest }) => {- const cur = getByPath(importer, rest.key);+ const cur = getImporterValueByPath(importer, rest.key);return { ...rest, value: (cur ?? def) as InspectorFieldValue, defaultValue: def };});return { name: 'Import Settings', label: 'Import Settings', fields };}-/** The subset of texture cook settings a platform may override — the axes that- * actually vary per target for a Basis "encode once, transcode per GPU" pipeline:- * size cap + whether/how to compress. (sRGB is intrinsic to the asset's color, not- * the platform, so it is NOT overridable.) `enabled` is the inspector's per-platform- * "Override for <platform>" switch — an override is only applied when it is on. */-export interface TexturePlatformOverride {- enabled?: boolean;- maxSize?: number;- compress?: boolean;- compressFormat?: 'uastc' | 'etc1s';-}--/** Cook-facing texture settings (compression + downscale), tolerant of hand-edited- * `.meta` blocks. Mirrors {@link readAudioImportSettings} — the cook reads this- * per asset so each texture decides its own KTX2 format / opt-out / size cap,- * the way audio clips already do. When `platform` is given and that platform has- * an ENABLED override in `importer.overrides`, its present fields win over the- * defaults per-field (an unset field inherits the default). Defaults match a- * fresh `.meta`. */-export function readTextureCookSettings(importer: Record<string, unknown> | undefined, platform?: string): {- compress: boolean; format: 'uastc' | 'etc1s'; maxSize: number; srgb: boolean;-} {- const compress = importer?.compress;- const format = importer?.compressFormat;- const maxSize = importer?.maxSize;- const srgb = importer?.sRGB;- const resolved = {- compress: typeof compress === 'boolean' ? compress : true,- format: (format === 'etc1s' ? 'etc1s' : 'uastc') as 'uastc' | 'etc1s',- maxSize: typeof maxSize === 'number' && maxSize > 0 ? maxSize : 2048,- srgb: typeof srgb === 'boolean' ? srgb : true,- };- const overrides = importer?.overrides as Record<string, TexturePlatformOverride> | undefined;- const ov = platform ? overrides?.[platform] : undefined;- if (ov?.enabled) {- if (typeof ov.compress === 'boolean') resolved.compress = ov.compress;- if (ov.compressFormat === 'etc1s' || ov.compressFormat === 'uastc') resolved.format = ov.compressFormat;- if (typeof ov.maxSize === 'number' && ov.maxSize > 0) resolved.maxSize = ov.maxSize;- }- return resolved;-}--// A texture's LOAD-time settings (sampler + 9-slice border) are parsed by the-// SDK's `textureImportSettingsFrom`, not here: the editor and a shipped build-// read the same `.meta` importer block, and a second reader is how "works in-// the editor, not in the build" gets born. This module stays engine-free (the-// Electron main process imports it for the cook), which is why the parser lives-// on the SDK side rather than the other way round.-/** Apply one inspector edit to a copy of the `importer` block (dotted keys →* nested), returning the new block. Pure — the caller owns dirty/save. */export function applyImporterEdit(@@ -249,6 +37,6 @@ export function applyImporterEdit(value: InspectorFieldValue,): Record<string, unknown> {const next = structuredClone(importer);- setByPath(next, key, value);+ setImporterValueByPath(next, key, value);return next;}diff --git a/desktop/src/project/platformLabels.ts b/desktop/src/project/platformLabels.tsindex f9cfbf917..3e4a71f6b 100644--- a/desktop/src/project/platformLabels.ts+++ b/desktop/src/project/platformLabels.ts@@ -12,7 +12,7 @@* A project's own platform is not here (only the project knows its name);* callers pass the label the profile declared, and the id is the floor.*/-import { BUILTIN_PLATFORMS, type ExportPlatform } from '@/project/platforms';+import { BUILTIN_PLATFORMS, type ExportPlatform } from '../../../pipeline/src/project/platforms';import { t } from '@/i18n';const BUILTIN_LABEL: Record<string, string> = {diff --git a/desktop/src/settings/projectSettings.ts b/desktop/src/settings/projectSettings.tsindex a2408b1aa..e5598cd9e 100644--- a/desktop/src/settings/projectSettings.ts+++ b/desktop/src/settings/projectSettings.ts@@ -14,7 +14,7 @@ import { rgbaToHex8 } from '@/components/ColorControl';import { EngineHost } from '@/engine/EngineHost';import { Toasts } from '@/store/Toasts';import { useEditorMode } from '@/store/editorModeStore';-import { SORTING_LAYER_COUNT, type ScreenOrientation, type CameraScaleMode, type ScreenPreset } from '@/project/format';+import { SORTING_LAYER_COUNT, type ScreenOrientation, type CameraScaleMode, type ScreenPreset } from '../../../pipeline/src/project/format';import { t } from '@/i18n';/** Where a desktop build goes. A channel, not a platform — seediff --git a/desktop/src/settings/types.ts b/desktop/src/settings/types.tsindex bb77d6d2c..553295592 100644--- a/desktop/src/settings/types.ts+++ b/desktop/src/settings/types.ts@@ -11,7 +11,7 @@* - `effect` — for store-owned settings, push the value to runtime on set + on* hydrate (CSS variable, engine resource, …). Persisted by the store.*/-import type { ExportPlatform } from '@/project/platforms';+import type { ExportPlatform } from '../../../pipeline/src/project/platforms';/** Where a setting lives / persists. editor → per-user (localStorage). */export type SettingScope = 'editor' | 'project';diff --git a/desktop/tests/asset-importer.test.ts b/desktop/tests/asset-importer.test.tsindex e03ec24ed..96c7bf1ca 100644--- a/desktop/tests/asset-importer.test.ts+++ b/desktop/tests/asset-importer.test.ts@@ -8,13 +8,12 @@* from a `.meta` block, and dotted keys (sliceBorder.*) round-trip nested.*/import { describe, it, expect } from 'vitest';+import { buildImporterComponent, applyImporterEdit } from '../src/project/assetImporter';import {importerDefaults,- buildImporterComponent,- applyImporterEdit,hasImporterSettings,readTextureCookSettings,-} from '../src/project/assetImporter';+} from '../../pipeline/src/project/importSettings';describe('importerDefaults (import-time .meta)', () => {it('reproduces the texture defaults (incl. nested 9-slice)', () => {diff --git a/desktop/tests/export-game.test.ts b/desktop/tests/export-game.test.tsindex 37b16211f..a56bd849d 100644--- a/desktop/tests/export-game.test.ts+++ b/desktop/tests/export-game.test.ts@@ -8,7 +8,7 @@* proven separately by play:verify — gameHost reuses initPlayRealmRuntime.)*/import { describe, it, expect, beforeAll, afterAll } from 'vitest';-import { runtimeConfigOf } from '@/project/runtimeConfig';+import { runtimeConfigOf } from '../../pipeline/src/project/runtimeConfig';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { tmpdir } from 'node:os';diff --git a/desktop/tests/export-playable.test.ts b/desktop/tests/export-playable.test.tsindex c4964d945..c4ab0e352 100644--- a/desktop/tests/export-playable.test.ts+++ b/desktop/tests/export-playable.test.ts@@ -8,7 +8,7 @@* by the user in a browser / ad preview (no playable simulator here).*/import { describe, it, expect, beforeAll, afterAll } from 'vitest';-import { runtimeConfigOf } from '@/project/runtimeConfig';+import { runtimeConfigOf } from '../../pipeline/src/project/runtimeConfig';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';diff --git a/desktop/tests/export-wechat.test.ts b/desktop/tests/export-wechat.test.tsindex 0cd17717e..f770a74a5 100644--- a/desktop/tests/export-wechat.test.ts+++ b/desktop/tests/export-wechat.test.ts@@ -10,7 +10,7 @@* simulator here.)*/import { describe, it, expect, beforeAll, afterAll } from 'vitest';-import { runtimeConfigOf } from '@/project/runtimeConfig';+import { runtimeConfigOf } from '../../pipeline/src/project/runtimeConfig';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';diff --git a/desktop/tests/packaging-settings-home.test.ts b/desktop/tests/packaging-settings-home.test.tsindex 7611c61bd..8dcecba74 100644--- a/desktop/tests/packaging-settings-home.test.ts+++ b/desktop/tests/packaging-settings-home.test.ts@@ -13,7 +13,7 @@ import { describe, it, expect, afterEach } from 'vitest';import '@/settings';import { settingsRegistry } from '@/settings/registry';import { ProjectStore } from '@/project/ProjectStore';-import { BUILTIN_PLATFORMS } from '@/project/platforms';+import { BUILTIN_PLATFORMS } from '../../pipeline/src/project/platforms';import { platformLabel, unlabeledBuiltins } from '@/project/platformLabels';import type { EnumSetting, ObjectListSetting } from '@/settings/types';diff --git a/desktop/tests/platform-catalog.test.ts b/desktop/tests/platform-catalog.test.tsindex 9c39d669b..0d9d63d98 100644--- a/desktop/tests/platform-catalog.test.ts+++ b/desktop/tests/platform-catalog.test.ts@@ -17,7 +17,7 @@ import {listPlatforms, loadProjectPlatform, createProjectPlatform, PROJECT_PLATFORM_DIR,listPlayableNetworks, loadPlayableProfile,} from '../electron/platformCatalog';-import { BUILTIN_PLATFORMS } from '../src/project/platforms';+import { BUILTIN_PLATFORMS } from '../../pipeline/src/project/platforms';let root: string;let webDir: string;diff --git a/desktop/tests/project-acceptance.test.ts b/desktop/tests/project-acceptance.test.tsindex 5b6d62b64..113102e32 100644--- a/desktop/tests/project-acceptance.test.ts+++ b/desktop/tests/project-acceptance.test.ts@@ -8,7 +8,7 @@* silently never run, while the file said they were there.*/import { describe, it, expect } from 'vitest';-import { parseManifest } from '@/project/format';+import { parseManifest } from '../../pipeline/src/project/format';const project = (acceptance: unknown) =>parseManifest({ formatVersion: '1', name: 'Platformer', acceptance });diff --git a/desktop/tests/project-packaging.test.ts b/desktop/tests/project-packaging.test.tsindex fb47f4ed2..ebbc6050d 100644--- a/desktop/tests/project-packaging.test.ts+++ b/desktop/tests/project-packaging.test.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { describe, it, expect } from 'vitest';-import { parseManifest, resolveOrientation, orientationFromDesignResolution } from '../src/project/format';+import { parseManifest, resolveOrientation, orientationFromDesignResolution } from '../../pipeline/src/project/format';describe('parseManifest — packaging', () => {it('parses a valid packaging section', () => {diff --git a/desktop/tests/project-physics.test.ts b/desktop/tests/project-physics.test.tsindex 57079f584..da2efa6b6 100644--- a/desktop/tests/project-physics.test.ts+++ b/desktop/tests/project-physics.test.ts@@ -6,7 +6,7 @@* that invalid values are dropped/clamped.*/import { describe, it, expect } from 'vitest';-import { parseManifest } from '../src/project/format';+import { parseManifest } from '../../pipeline/src/project/format';describe('parseManifest — physics', () => {it('parses the full physics world config', () => {diff --git a/desktop/tests/project-rendering.test.ts b/desktop/tests/project-rendering.test.tsindex 3897a4896..1f496b409 100644--- a/desktop/tests/project-rendering.test.ts+++ b/desktop/tests/project-rendering.test.ts@@ -8,7 +8,7 @@import { describe, it, expect } from 'vitest';import {parseManifest, cameraScaleModeValue, resolveScreenFit, trimSortingLayers, SORTING_LAYER_COUNT,-} from '../src/project/format';+} from '../../pipeline/src/project/format';describe('parseManifest — rendering.colorSpace', () => {it("keeps 'linear'", () => {diff --git a/desktop/tests/project-scripts.test.ts b/desktop/tests/project-scripts.test.tsindex 7c4230169..37b893b9c 100644--- a/desktop/tests/project-scripts.test.ts+++ b/desktop/tests/project-scripts.test.ts@@ -14,7 +14,7 @@ import { cpSync, mkdtempSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import { fileURLToPath } from 'node:url';import path from 'node:path';-import { parseManifest, resolveScripts, DEFAULT_SCRIPTS } from '../src/project/format';+import { parseManifest, resolveScripts, DEFAULT_SCRIPTS } from '../../pipeline/src/project/format';import { extractProjectSchemas } from '../electron/extractSchemas';const EXAMPLES = fileURLToPath(new URL('../../examples', import.meta.url));diff --git a/desktop/tests/project-ui-theme.test.ts b/desktop/tests/project-ui-theme.test.tsindex 41aae0e01..08be0b21e 100644--- a/desktop/tests/project-ui-theme.test.ts+++ b/desktop/tests/project-ui-theme.test.ts@@ -7,7 +7,7 @@* disappears entirely.*/import { describe, it, expect } from 'vitest';-import { parseManifest } from '../src/project/format';+import { parseManifest } from '../../pipeline/src/project/format';describe('parseManifest — features.ui', () => {it("keeps theme 'light'; dark/junk = absence", () => {diff --git a/desktop/tests/runtime-config.test.ts b/desktop/tests/runtime-config.test.tsindex ed18babdf..590be48cd 100644--- a/desktop/tests/runtime-config.test.ts+++ b/desktop/tests/runtime-config.test.ts@@ -12,7 +12,7 @@import { describe, it, expect } from 'vitest';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, runtimeConfigOf,-} from '@/project/runtimeConfig';+} from '../../pipeline/src/project/runtimeConfig';describe('runtimeConfigOf', () => {it('answers with the engine defaults for a project that declares nothing', () => {diff --git a/desktop/tests/size-report.test.ts b/desktop/tests/size-report.test.tsindex 30ebbc3bf..b74365891 100644--- a/desktop/tests/size-report.test.ts+++ b/desktop/tests/size-report.test.ts@@ -21,7 +21,7 @@ import path from 'node:path';import {summarizeBuildFiles, bucketIndexFrom, kindOf, measureBuild, collectBuildFiles,} from '../electron/sizeReport';-import { resolveSizeBudgets, evaluateSizeBudget, formatBytes, PROJECT_BUDGET_NOTE } from '../src/project/sizeBudget';+import { resolveSizeBudgets, evaluateSizeBudget, formatBytes, PROJECT_BUDGET_NOTE } from '../../pipeline/src/project/sizeBudget';const MB = 1024 * 1024;diff --git a/desktop/tests/steam-settings.test.ts b/desktop/tests/steam-settings.test.tsindex afed48100..fb14f980c 100644--- a/desktop/tests/steam-settings.test.ts+++ b/desktop/tests/steam-settings.test.ts@@ -8,7 +8,7 @@* the depot ids the project had. That is the whole reason these setters exist.*/import { describe, it, expect } from 'vitest';-import { parseManifest, type SteamPackaging } from '@/project/format';+import { parseManifest, type SteamPackaging } from '../../pipeline/src/project/format';/** The merge, as the store performs it, over a plain object. */function mergeSteam(prev: SteamPackaging | undefined, patch: Partial<SteamPackaging>): SteamPackaging | undefined {diff --git a/desktop/tests/target-screen.test.ts b/desktop/tests/target-screen.test.tsindex 6e2860773..b9c288b92 100644--- a/desktop/tests/target-screen.test.ts+++ b/desktop/tests/target-screen.test.ts@@ -11,7 +11,7 @@import { describe, it, expect } from 'vitest';import { playHostAspectStyle, targetScreenLabel } from '@/mode/TargetScreen';import { deviceDims, screenPresets, screenPresetById, RESOLUTION_PRESETS } from '@/mode/resolutionPresets';-import { parseManifest } from '@/project/format';+import { parseManifest } from '../../pipeline/src/project/format';describe('play host sizing', () => {it('leaves the host unconstrained for the `design` sentinel', () => {diff --git a/desktop/tests/target-support.test.ts b/desktop/tests/target-support.test.tsindex 4e9523150..27013a802 100644--- a/desktop/tests/target-support.test.ts+++ b/desktop/tests/target-support.test.ts@@ -17,7 +17,7 @@ import path from 'node:path';import { fileURLToPath } from 'node:url';import {collectSubsystems, subsystemGapWarnings, targetGaps, SUBSYSTEM_CMAKE_FLAG, type Subsystem,-} from '../src/project/targetSupport';+} from '../../pipeline/src/project/targetSupport';import { exportGame } from '../electron/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));diff --git a/desktop/tests/templates.test.ts b/desktop/tests/templates.test.tsindex 0fcfc79bf..61439efb6 100644--- a/desktop/tests/templates.test.ts+++ b/desktop/tests/templates.test.ts@@ -5,7 +5,7 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';import { mkdtemp, rm } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';-import { parseManifest, resolveLayout, resolveScripts, isTransientProjectPath, PROJECT_MANIFEST_FILE } from '@/project/format';+import { parseManifest, resolveLayout, resolveScripts, isTransientProjectPath, PROJECT_MANIFEST_FILE } from '../../pipeline/src/project/format';import { scaffoldProjectFiles, npmPackageName } from '../electron/projectScaffold';// The bundled starter templates (shipped to resources/templates bydiff --git a/desktop/tests/video-asset.test.ts b/desktop/tests/video-asset.test.tsindex ef6fb406e..799ca2dac 100644--- a/desktop/tests/video-asset.test.ts+++ b/desktop/tests/video-asset.test.ts@@ -9,7 +9,7 @@import { describe, it, expect } from 'vitest';import { assetTypeOf } from '../src/project/assetTypes';import { metaTypeFor } from '../electron/assetMeta';-import { importerDefaults, hasImporterSettings } from '../src/project/assetImporter';+import { importerDefaults, hasImporterSettings } from '../../pipeline/src/project/importSettings';describe('video asset type', () => {it('classifies video containers as "video" in the content browser', () => {diff --git a/pipeline/package.json b/pipeline/package.jsonnew file mode 100644index 000000000..2506f6ba9--- /dev/null+++ b/pipeline/package.json@@ -0,0 +1,29 @@+{+ "name": "@estella/pipeline",+ "version": "0.0.0",+ "private": true,+ "description": "Turns a project directory into a shipped build. No window, no editor.",+ "license": "Apache-2.0",+ "type": "module",+ "exports": {+ ".": "./src/index.ts",+ "./package.json": "./package.json"+ },+ "scripts": {+ "typecheck": "tsc --noEmit",+ "test": "vitest run"+ },+ "dependencies": {+ "esbuild": "^0.27.0",+ "esengine": "workspace:*",+ "ffmpeg-static": "^5.3.0",+ "pngjs": "^7.0.0",+ "wasm-media-encoders": "^0.7.0"+ },+ "devDependencies": {+ "@types/node": "^25.9.3",+ "@types/pngjs": "^6.0.5",+ "typescript": "^6.0.3",+ "vitest": "^2.1.9"+ }+}diff --git a/pipeline/src/index.ts b/pipeline/src/index.tsnew file mode 100644index 000000000..24b6f8dd6--- /dev/null+++ b/pipeline/src/index.ts@@ -0,0 +1,14 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file The pipeline's public surface: what a project IS, and what turning one+ * into a build needs. Every consumer — the editor, the command line, CI —+ * comes through here, so there is one answer rather than one per host.+ */+export * from './project/format';+export * from './project/platforms';+export * from './project/runtimeConfig';+export * from './project/sizeBudget';+export * from './project/targetSupport';+export * from './project/importSettings';+export * from './project/pluginPaths';diff --git a/desktop/src/project/format.ts b/pipeline/src/project/format.tssimilarity index 100%rename from desktop/src/project/format.tsrename to pipeline/src/project/format.tsdiff --git a/pipeline/src/project/importSettings.ts b/pipeline/src/project/importSettings.tsnew file mode 100644index 000000000..b4ca34927--- /dev/null+++ b/pipeline/src/project/importSettings.ts@@ -0,0 +1,252 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file importSettings.ts+ * @brief Single source of truth for per-type asset import settings (the `.meta`+ * `importer` block). One registry produces both the import-time defaults+ * and the fields an editor offers, so the two can't drift.+ *+ * The specs carry their own presentation vocabulary rather than the+ * editor's `InspectorField`: what a setting IS belongs to the project, and+ * a build that never opens a window still has to read it. An editor maps+ * a spec onto whatever control it renders.+ */++/** What an import setting can hold. Anything richer belongs in the asset, not here. */+export type ImporterValue = number | boolean | string;++/** The control kinds import settings need — a subset of what an inspector can render. */+export type ImporterFieldType = 'number' | 'bool' | 'string' | 'enum' | 'select';++/** A named choice for an `enum` field: the label shown, the value stored. A+ * choice is never a flag — a two-state setting is a `bool`. */+export interface ImporterEnumOption {+ label: string;+ value: string | number;+}++/** One import setting: where it lives in the `importer` block, and how to offer it. */+export interface ImporterFieldSpec {+ /** Dotted path within the `importer` block (`sliceBorder.left`). */+ key: string;+ label: string;+ type: ImporterFieldType;+ /** Written into a fresh `.meta`, and the reset target of an editor's field. */+ default: ImporterValue;+ category?: string;+ tooltip?: string;+ /** Rarely edited — an editor may fold it away. */+ advanced?: boolean;+ min?: number;+ max?: number;+ step?: number;+ /** For `type: 'enum'`. */+ options?: ImporterEnumOption[];+ /** For `type: 'select'`. */+ selectOptions?: string[];+}++const powerOfTwo = [256, 512, 1024, 2048, 4096, 8192];++const TEXTURE: ImporterFieldSpec[] = [+ {+ key: 'maxSize', label: 'Max Size', type: 'enum', default: 2048, category: 'Texture',+ options: powerOfTwo.map((n) => ({ label: String(n), value: n })),+ tooltip: 'Downscale cap applied at cook (power of two). A source larger than this on '+ + 'its longest side is box-filtered down; smaller sources are untouched.',+ },+ {+ key: 'compress', label: 'Compress', type: 'bool', default: true, category: 'Texture',+ tooltip: 'GPU-compress this texture to KTX2 (Basis Universal) at cook — it stays '+ + 'compressed in VRAM and transcodes per device. Turn OFF to ship the raw image '+ + '(crisp UI, smooth gradients). Only applies when the build compresses assets.',+ },+ {+ key: 'compressFormat', label: 'Compress Format', type: 'select', default: 'uastc',+ category: 'Texture', advanced: true, selectOptions: ['uastc', 'etc1s'],+ tooltip: 'UASTC — high quality, larger. ETC1S — much smaller, lower quality '+ + '(good for photographic / low-frequency art). Only used when Compress is on.',+ },+ {+ key: 'filterMode', label: 'Filter', type: 'select', default: 'linear', category: 'Texture',+ selectOptions: ['nearest', 'linear'],+ tooltip: 'Texture sampling filter. Nearest keeps pixels crisp; Linear smooths.',+ },+ {+ key: 'wrapMode', label: 'Wrap', type: 'select', default: 'repeat', category: 'Texture',+ selectOptions: ['repeat', 'clamp', 'mirror'],+ tooltip: 'How UVs outside [0,1] are addressed.',+ },+ {+ key: 'premultiplyAlpha', label: 'Premultiply Alpha', type: 'bool', default: false,+ category: 'Texture', advanced: true,+ },+ {+ key: 'sRGB', label: 'sRGB Color', type: 'bool', default: true, category: 'Texture', advanced: true,+ tooltip: 'The image stores sRGB-encoded color (albedo/UI). Disable for authored-linear '+ + 'data like normal maps and masks — only meaningful when the project renders in linear color.',+ },+ { key: 'sliceBorder.left', label: 'Border Left', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },+ { key: 'sliceBorder.right', label: 'Border Right', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },+ { key: 'sliceBorder.top', label: 'Border Top', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },+ { key: 'sliceBorder.bottom', label: 'Border Bottom', type: 'number', default: 0, min: 0, category: '9-Slice', advanced: true },+];++const SPINE: ImporterFieldSpec[] = [+ { key: 'scale', label: 'Scale', type: 'number', default: 1, min: 0, step: 0.01, category: 'Spine' },+ { key: 'defaultSkin', label: 'Default Skin', type: 'string', default: 'default', category: 'Spine' },+ { key: 'premultiplyAlpha', label: 'Premultiply Alpha', type: 'bool', default: false, category: 'Spine', advanced: true },+];++// A DragonBones file is a project: it can hold several armatures, so which one an+// entity gets is an import-time default rather than something derived from the+// file. Spine needs no equivalent — its file IS one skeleton.+const DRAGONBONES: ImporterFieldSpec[] = [+ { key: 'scale', label: 'Scale', type: 'number', default: 1, min: 0, step: 0.01, category: 'DragonBones' },+ {+ key: 'defaultArmature', label: 'Default Armature', type: 'string', default: '', category: 'DragonBones',+ tooltip: 'Armature used when an entity does not name one. Empty picks the first in the file.',+ },+ {+ key: 'defaultAnimation', label: 'Default Animation', type: 'string', default: '', category: 'DragonBones',+ tooltip: 'Played on spawn. Empty leaves the armature in its setup pose.',+ },+];++const AUDIO: ImporterFieldSpec[] = [+ {+ key: 'compress', label: 'Compress', type: 'bool', default: true, category: 'Audio',+ tooltip: 'Re-encode WAV to MP3 at cook (already-compressed formats pass through). '+ + 'MP3 has a small encoder delay — disable for seamless-loop clips.',+ },+ {+ key: 'bitrateKbps', label: 'Bitrate', type: 'enum', default: 128, category: 'Audio',+ options: [96, 128, 192].map((n) => ({ label: `${n} kbps`, value: n })),+ tooltip: 'MP3 bitrate for cooked WAV sources.',+ },+];++const VIDEO: ImporterFieldSpec[] = [+ {+ key: 'loop', label: 'Loop', type: 'bool', default: true, category: 'Video',+ tooltip: 'Suggested loop state when this clip is assigned to a Video component.',+ },+ { key: 'autoplay', label: 'Autoplay', type: 'bool', default: true, category: 'Video' },+ {+ key: 'muted', label: 'Muted', type: 'bool', default: true, category: 'Video',+ tooltip: 'Muted clips can autoplay; unmuted autoplay is blocked until a user gesture.',+ },+ {+ key: 'quality', label: 'Cook Quality', type: 'number', default: 4, min: 2, max: 31, step: 1,+ category: 'Video', advanced: true,+ tooltip: 'MPEG-1 quantizer for targets on the wasm decode path (WeChat): '+ + '2 = near-lossless (largest file), 31 = smallest. Web targets ship the source untouched.',+ },+ {+ key: 'audioBitrateKbps', label: 'Cook Audio Bitrate', type: 'enum', default: 128,+ category: 'Video', advanced: true,+ options: [96, 128, 192].map((n) => ({ label: `${n} kbps`, value: n })),+ tooltip: 'AAC bitrate for the audio track demuxed at cook (wasm decode path).',+ },+];++const SCENELIKE: ImporterFieldSpec[] = [+ {+ key: 'autoMigrate', label: 'Auto Migrate', type: 'bool', default: true, category: 'Import',+ tooltip: 'Upgrade this asset to the current schema version when it loads.',+ },+];++/** type → its import-setting field specs. Types absent here have no import+ * settings (only metadata) and get an empty defaults object. */+export const IMPORTER_SCHEMAS: Record<string, ImporterFieldSpec[]> = {+ texture: TEXTURE,+ sprite: TEXTURE,+ spine: SPINE,+ dragonbones: DRAGONBONES,+ audio: AUDIO,+ video: VIDEO,+ scene: SCENELIKE,+ prefab: SCENELIKE,+};++/** Cook-facing audio import settings, tolerant of hand-edited `.meta` blocks. */+export function readAudioImportSettings(importer: Record<string, unknown> | undefined): {+ compress: boolean; bitrateKbps: number;+} {+ const compress = importer?.compress;+ const bitrate = importer?.bitrateKbps;+ return {+ compress: typeof compress === 'boolean' ? compress : true,+ bitrateKbps: bitrate === 96 || bitrate === 128 || bitrate === 192 ? bitrate : 128,+ };+}++export const getImporterValueByPath = (obj: Record<string, unknown>, path: string): unknown =>+ path.split('.').reduce<unknown>((o, k) => (o && typeof o === 'object' ? (o as Record<string, unknown>)[k] : undefined), obj);++export function setImporterValueByPath(obj: Record<string, unknown>, path: string, value: unknown): void {+ const keys = path.split('.');+ let cur = obj;+ for (let i = 0; i < keys.length - 1; i++) {+ const k = keys[i];+ if (!cur[k] || typeof cur[k] !== 'object') cur[k] = {};+ cur = cur[k] as Record<string, unknown>;+ }+ cur[keys[keys.length - 1]] = value;+}++/** The `importer` block written into a fresh `.meta` at import time — derived from+ * the same specs an editor offers, so the two never drift. */+export function importerDefaults(type: string): Record<string, unknown> {+ const specs = IMPORTER_SCHEMAS[type];+ if (!specs) return {};+ const out: Record<string, unknown> = {};+ for (const s of specs) setImporterValueByPath(out, s.key, s.default);+ return out;+}++/** True when a type exposes editable import settings. */+export const hasImporterSettings = (type: string): boolean => (IMPORTER_SCHEMAS[type]?.length ?? 0) > 0;++/** The texture cook settings a platform may override: size cap + whether/how to+ * compress. sRGB is intrinsic to the asset's color rather than the target, so it+ * is not overridable. `enabled` is the per-platform switch — an override applies+ * only when it is on. */+export interface TexturePlatformOverride {+ enabled?: boolean;+ maxSize?: number;+ compress?: boolean;+ compressFormat?: 'uastc' | 'etc1s';+}++/** Cook-facing texture settings, tolerant of hand-edited `.meta` blocks: each+ * texture decides its own KTX2 format, opt-out and size cap. An ENABLED+ * `importer.overrides[platform]` wins per field; an unset field inherits the+ * default. Defaults match a fresh `.meta`. */+export function readTextureCookSettings(importer: Record<string, unknown> | undefined, platform?: string): {+ compress: boolean; format: 'uastc' | 'etc1s'; maxSize: number; srgb: boolean;+} {+ const compress = importer?.compress;+ const format = importer?.compressFormat;+ const maxSize = importer?.maxSize;+ const srgb = importer?.sRGB;+ const resolved = {+ compress: typeof compress === 'boolean' ? compress : true,+ format: (format === 'etc1s' ? 'etc1s' : 'uastc') as 'uastc' | 'etc1s',+ maxSize: typeof maxSize === 'number' && maxSize > 0 ? maxSize : 2048,+ srgb: typeof srgb === 'boolean' ? srgb : true,+ };+ const overrides = importer?.overrides as Record<string, TexturePlatformOverride> | undefined;+ const ov = platform ? overrides?.[platform] : undefined;+ if (ov?.enabled) {+ if (typeof ov.compress === 'boolean') resolved.compress = ov.compress;+ if (ov.compressFormat === 'etc1s' || ov.compressFormat === 'uastc') resolved.format = ov.compressFormat;+ if (typeof ov.maxSize === 'number' && ov.maxSize > 0) resolved.maxSize = ov.maxSize;+ }+ return resolved;+}++// Load-time settings (sampler + 9-slice border) are parsed by the SDK's+// `textureImportSettingsFrom`, not here: one reader for the editor and the+// shipped build, or the two disagree.diff --git a/desktop/src/project/platforms.ts b/pipeline/src/project/platforms.tssimilarity index 100%rename from desktop/src/project/platforms.tsrename to pipeline/src/project/platforms.tsdiff --git a/desktop/src/plugins/paths.ts b/pipeline/src/project/pluginPaths.tssimilarity index 100%rename from desktop/src/plugins/paths.tsrename to pipeline/src/project/pluginPaths.tsdiff --git a/desktop/src/project/runtimeConfig.ts b/pipeline/src/project/runtimeConfig.tssimilarity index 100%rename from desktop/src/project/runtimeConfig.tsrename to pipeline/src/project/runtimeConfig.tsdiff --git a/desktop/src/project/sizeBudget.ts b/pipeline/src/project/sizeBudget.tssimilarity index 100%rename from desktop/src/project/sizeBudget.tsrename to pipeline/src/project/sizeBudget.tsdiff --git a/desktop/src/project/targetSupport.ts b/pipeline/src/project/targetSupport.tssimilarity index 100%rename from desktop/src/project/targetSupport.tsrename to pipeline/src/project/targetSupport.tsdiff --git a/pipeline/tsconfig.json b/pipeline/tsconfig.jsonnew file mode 100644index 000000000..1bca0f9b6--- /dev/null+++ b/pipeline/tsconfig.json@@ -0,0 +1,21 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "module": "ESNext",+ "lib": ["ES2022", "DOM"],+ "types": ["node"],+ "moduleResolution": "bundler",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "moduleDetection": "force",+ "noEmit": true,+ "strict": true,+ "noUnusedLocals": true,+ "noUnusedParameters": true,+ "noFallthroughCasesInSwitch": true,+ "verbatimModuleSyntax": true,+ "skipLibCheck": true,+ "forceConsistentCasingInFileNames": true+ },+ "include": ["src", "tests"]+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4e1ad78ab..b59a31d3b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -113,6 +113,37 @@ importers:specifier: ^2.1.0version: 2.1.9(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])([email protected])+ pipeline:+ dependencies:+ esbuild:+ specifier: ^0.27.0+ version: 0.27.7+ esengine:+ specifier: workspace:*+ version: link:../sdk+ ffmpeg-static:+ specifier: ^5.3.0+ version: 5.3.0+ pngjs:+ specifier: ^7.0.0+ version: 7.0.0+ wasm-media-encoders:+ specifier: ^0.7.0+ version: 0.7.0+ devDependencies:+ '@types/node':+ specifier: ^25.9.3+ version: 25.9.3+ '@types/pngjs':+ specifier: ^6.0.5+ version: 6.0.5+ typescript:+ specifier: ^6.0.3+ version: 6.0.3+ vitest:+ specifier: ^2.1.9+ version: 2.1.9(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])([email protected])+plugins/audio-mixer:devDependencies:'@types/react':diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 25116438a..ddc1b1ad8 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -1,5 +1,6 @@packages:- 'sdk'+ - 'pipeline'- 'desktop'- 'plugins/*'onlyBuiltDependencies:diff --git a/tools/check-pipeline-boundary.mjs b/tools/check-pipeline-boundary.mjsnew file mode 100644index 000000000..d249a8cec--- /dev/null+++ b/tools/check-pipeline-boundary.mjs@@ -0,0 +1,87 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file check-pipeline-boundary.mjs — the build does not need a window.+ *+ * Cooking a project and packaging it is what a build server does, so the+ * pipeline has to run where there is no Electron, no React and no editor state.+ * Nothing in the language stops one import of the editor's store from sneaking+ * in; the day it does, the CLI and CI stop being able to build at all, and the+ * failure shows up as a module resolution error nobody reads as an architecture+ * decision.+ *+ * So the direction is checked instead: the pipeline may reach DOWN (the engine's+ * sources, the packaging utilities) and never UP.+ *+ * node tools/check-pipeline-boundary.mjs+ */+import { readdirSync, readFileSync } from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const PIPELINE = path.join(ROOT, 'pipeline');+const SOURCE = /\.(ts|mts|js|mjs)$/;++/** Repo areas the pipeline is allowed to read: the engine it packages, and the+ * format writers it packages with. */+const REACHABLE = ['sdk/src', 'build-tools', 'tools'];++/** Packages that only exist inside a running editor. */+const HOST_ONLY = new Set(['electron', 'react', 'react-dom', 'react-dom/client', 'zustand', 'dockview']);++const SPECIFIERS = [+ /\bfrom\s+['"]([^'"]+)['"]/g,+ /\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g,+ /\brequire\s*\(\s*['"]([^'"]+)['"]\s*\)/g,+];++/** Why this specifier is something a windowless build cannot have, or null. */+function problem(spec, file) {+ if (spec.startsWith('.')) {+ const target = path.resolve(path.dirname(file), spec);+ if (target === PIPELINE || target.startsWith(PIPELINE + path.sep)) return null;+ const rel = path.relative(ROOT, target).split(path.sep).join('/');+ if (REACHABLE.some((area) => rel === area || rel.startsWith(area + '/'))) return null;+ return `reaches ${rel} — the pipeline may read ${REACHABLE.join(', ')}, nothing else`;+ }+ if (spec.startsWith('@/')) return "the editor's path alias — the pipeline has no editor to alias into";+ if (HOST_ONLY.has(spec)) return `${spec} only exists inside the editor process`;+ return null;+}++function walk(dir, out = []) {+ for (const entry of readdirSync(dir, { withFileTypes: true })) {+ if (entry.name === 'node_modules' || entry.name.startsWith('.')) continue;+ const full = path.join(dir, entry.name);+ if (entry.isDirectory()) walk(full, out);+ else if (SOURCE.test(entry.name)) out.push(full);+ }+ return out;+}++const files = walk(PIPELINE);+const findings = [];+for (const file of files) {+ const lines = readFileSync(file, 'utf8').split('\n');+ for (let i = 0; i < lines.length; i++) {+ for (const re of SPECIFIERS) {+ re.lastIndex = 0;+ let m;+ while ((m = re.exec(lines[i])) !== null) {+ const why = problem(m[1], file);+ if (why) findings.push({ file: path.relative(ROOT, file), line: i + 1, spec: m[1], why });+ }+ }+ }+}++if (findings.length === 0) {+ console.log(`check-pipeline-boundary: ${files.length} file(s) — the pipeline reaches nothing above it.`);+ process.exit(0);+}+for (const f of findings) {+ console.error(`${f.file}:${f.line} "${f.spec}" ${f.why}`);+}+console.error(`\ncheck-pipeline-boundary: ${findings.length} finding(s). Move the shared piece down, or keep the caller up.`);+process.exit(1);diff --git a/tools/gates.mjs b/tools/gates.mjsindex 23b13a280..20c3b7019 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -47,7 +47,8 @@ export const GATES = [// editor's own type-check and the examples all resolve `esengine` from dist.{ id: 'sdk-build', run: 'pnpm --filter ./sdk build' },{ id: 'api-surface-dts', run: 'node tools/api-surface.mjs --check-dts' },- // The editor imports `esengine` — it reads dist, not the SDK's sources.+ // Both read `esengine` from dist, and the editor reads the pipeline.+ { id: 'tsc-pipeline', run: 'pnpm --filter @estella/pipeline exec tsc --noEmit' },{ id: 'tsc-editor', run: 'pnpm --filter @estella/editor exec tsc --noEmit' },// The shipped plugins type-check against the editor's LIVE plugin API surface// (types.ts, the file authors are handed), so a change to it that no plugin@@ -56,6 +57,9 @@ export const GATES = [{ id: 'plugin-tests', run: 'pnpm -r --filter "./plugins/*" test' },// The plugins we ship prove the public API only if they are held to it.{ id: 'plugin-boundary', run: 'node tools/check-plugin-boundary.mjs' },+ // Same shape of rule, other direction: what builds a project may not need the+ // process that edits one.+ { id: 'pipeline-boundary', run: 'node tools/check-pipeline-boundary.mjs' },{ id: 'cycles', run: 'node tools/check-cycles.mjs' },{ id: 'layers', run: 'node tools/check-layers.mjs' },{ id: 'project-settings', run: 'node tools/check-project-settings.mjs' },