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): cooking a project stops being an editor feature
esengineb58f13bdbb9e
diff --git a/desktop/electron/exportGame.ts b/desktop/electron/exportGame.tsindex 1273d0fb8..2e9cb7c85 100644--- a/desktop/electron/exportGame.ts+++ b/desktop/electron/exportGame.ts@@ -24,8 +24,8 @@ import { loadEsbuild } from './esbuildRuntime';import { writeFile, readFile, mkdir, cp, readdir, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { cookAssets, loadAssetGroups } from './cookAssets';-import { buildAddressableManifest } from './addressableManifest';+import { cookAssets, loadAssetGroups } from '../../pipeline/src/assets/cookAssets';+import { buildAddressableManifest } from '../../pipeline/src/assets/addressableManifest';import { activeRemoteRoot } from '../../sdk/src/asset/assetGroups';import type { PackagedGameConfig } from 'esengine';import {diff --git a/desktop/electron/exportMiniGame.ts b/desktop/electron/exportMiniGame.tsindex 098ff7bc8..d744c8112 100644--- a/desktop/electron/exportMiniGame.ts+++ b/desktop/electron/exportMiniGame.ts@@ -35,8 +35,8 @@ import {import { writeFile, mkdir, cp, readFile, rename, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { cookAssets } from './cookAssets';-import { buildAddressableManifest } from './addressableManifest';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';+import { buildAddressableManifest } from '../../pipeline/src/assets/addressableManifest';import type { ExportScene } from './exportGame';import type { OnExportProgress } from './exportProgress';import { esengineAlias } from './esengineResolve';diff --git a/desktop/electron/exportPlayable.ts b/desktop/electron/exportPlayable.tsindex 7ce872eaf..c16b4fc6d 100644--- a/desktop/electron/exportPlayable.ts+++ b/desktop/electron/exportPlayable.ts@@ -23,7 +23,7 @@ import {import { writeFile, mkdir, readFile, stat, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { cookAssets } from './cookAssets';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';import type { OnExportProgress } from './exportProgress';import { esengineAlias } from './esengineResolve';import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';diff --git a/desktop/electron/fileJournal.ts b/desktop/electron/fileJournal.tsindex 743f0d83f..d0b395958 100644--- a/desktop/electron/fileJournal.ts+++ b/desktop/electron/fileJournal.ts@@ -32,8 +32,8 @@ import { existsSync } from 'node:fs';import { randomUUID } from 'node:crypto';import { tmpdir } from 'node:os';import path from 'node:path';-import { META_EXT } from './contentPolicy';-import { resolveInside } from './pathSandbox';+import { META_EXT } from '../../pipeline/src/assets/contentPolicy';+import { resolveInside } from '../../pipeline/src/fs/pathSandbox';const HOLDING_DIR = path.join(tmpdir(), 'estella-agent-journal');diff --git a/desktop/electron/importAssets.ts b/desktop/electron/importAssets.tsindex d318a7e2f..4f17e08de 100644--- a/desktop/electron/importAssets.ts+++ b/desktop/electron/importAssets.ts@@ -10,10 +10,10 @@import { copyFile, mkdir, writeFile } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { isInsideRoot } from './pathSandbox';+import { isInsideRoot } from '../../pipeline/src/fs/pathSandbox';import { resolveInRoot, META_EXT } from './projectFs';import { capture } from './fileJournal';-import { EXT_TO_TYPE, metaTypeFor, metaTypeForFile, mintMeta, writeMeta, adoptOrphan } from './assetMeta';+import { EXT_TO_TYPE, metaTypeFor, metaTypeForFile, mintMeta, writeMeta, adoptOrphan } from '../../pipeline/src/assets/assetMeta';import { CONTENT_TYPED_EXTENSIONS } from '../../tools/assetMetaTable.js';/** The supported import extensions (no leading dot) — used by the file dialog filter.diff --git a/desktop/electron/loopbackServer.ts b/desktop/electron/loopbackServer.tsindex edccc386a..8a0754064 100644--- a/desktop/electron/loopbackServer.ts+++ b/desktop/electron/loopbackServer.ts@@ -25,7 +25,7 @@ import http from 'node:http';import { readFile } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { isInsideRoot } from './pathSandbox';+import { isInsideRoot } from '../../pipeline/src/fs/pathSandbox';import { httpContentType } from './mimeTypes';/** Served root (absolute) → its running loopback server + URL. */diff --git a/desktop/electron/main.ts b/desktop/electron/main.tsindex 6a586a244..466676f85 100644--- a/desktop/electron/main.ts+++ b/desktop/electron/main.ts@@ -24,7 +24,7 @@ import {META_EXT,} from './projectFs';import { PROJECT_MANIFEST_FILE, type AcceptanceCriterion } from '../../pipeline/src/project/format';-import { isInsideRoot } from './pathSandbox';+import { isInsideRoot } from '../../pipeline/src/fs/pathSandbox';import * as journal from './fileJournal';import { syncAutosave, listAutosave, restoreAutosave, clearAutosave, type AutosaveEntry } from './autosave';import { listRecents, addRecent, removeRecent, listTemplates, createFromTemplate } from './launcher';@@ -32,8 +32,8 @@ import { buildProjectScripts } from './buildScripts';import { buildOpenDataContext } from './buildOpenData';import { extractProjectSchemas } from './extractSchemas';import { scaffoldScript, type ScriptKind } from './scriptScaffold';-import { scanAssetDatabase, readCachedAssetIndex, updateAssetIndex } from './assetDb';-import { cookAssets } from './cookAssets';+import { scanAssetDatabase, readCachedAssetIndex, updateAssetIndex } from '../../pipeline/src/assets/assetDb';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';import { startProjectWatch, stopProjectWatch } from './projectWatcher';import { importAssets, createAsset, IMPORT_EXTENSIONS } from './importAssets';import { exportGame } from './exportGame';diff --git a/desktop/electron/preload.ts b/desktop/electron/preload.tsindex c34f91836..f3cc74cf0 100644--- a/desktop/electron/preload.ts+++ b/desktop/electron/preload.ts@@ -5,8 +5,8 @@ import type { OpenedProject, WorkspaceState, DirEntry, RecentEntry, TemplateEntrimport type { BuildScriptsResult } from './buildScripts';import type { ExtractSchemasResult } from './extractSchemas';import type { ScaffoldScriptResult, ScriptKind } from './scriptScaffold';-import type { ScanAssetsResult, AssetIndex, IncrementalScanResult } from './assetDb';-import type { CookResult } from './cookAssets';+import type { ScanAssetsResult, AssetIndex, IncrementalScanResult } from '../../pipeline/src/assets/assetDb';+import type { CookResult } from '../../pipeline/src/assets/cookAssets';import type { ExportGameResult } from './exportGame';import type { RevertResult } from './fileJournal';import type {diff --git a/desktop/electron/projectFs.ts b/desktop/electron/projectFs.tsindex dd84328ba..273be7aa6 100644Binary files a/desktop/electron/projectFs.ts and b/desktop/electron/projectFs.ts differdiff --git a/desktop/electron/projectWatcher.ts b/desktop/electron/projectWatcher.tsindex 01cb1573a..57779763f 100644--- a/desktop/electron/projectWatcher.ts+++ b/desktop/electron/projectWatcher.ts@@ -16,7 +16,7 @@*/import { watch, type FSWatcher } from 'node:fs';import type { WebContents } from 'electron';-import { isWatchedPath } from './contentPolicy';+import { isWatchedPath } from '../../pipeline/src/assets/contentPolicy';// Our own cache writes (assets.json / schemas.json / scripts.mjs under// `.esengine`) MUST be ignored — refreshing on them would loop; contentPolicy'sdiff --git a/desktop/tests/addressable-manifest.test.ts b/desktop/tests/addressable-manifest.test.tsindex 5cd89fbea..131367c39 100644--- a/desktop/tests/addressable-manifest.test.ts+++ b/desktop/tests/addressable-manifest.test.ts@@ -13,7 +13,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';import { mkdtemp, rm, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';-import { buildAddressableManifest } from '../electron/addressableManifest';+import { buildAddressableManifest } from '../../pipeline/src/assets/addressableManifest';import type { AddressableManifest } from '../../sdk/src/asset/AddressableManifest';const SLICED = {diff --git a/desktop/tests/asset-db-incremental.test.ts b/desktop/tests/asset-db-incremental.test.tsindex 56ffe10d9..d58d179dd 100644--- a/desktop/tests/asset-db-incremental.test.ts+++ b/desktop/tests/asset-db-incremental.test.ts@@ -13,7 +13,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { scanAssetDatabase, updateAssetIndex, INCREMENTAL_PATH_LIMIT } from '../electron/assetDb';+import { scanAssetDatabase, updateAssetIndex, INCREMENTAL_PATH_LIMIT } from '../../pipeline/src/assets/assetDb';let root: string;diff --git a/desktop/tests/asset-db.test.ts b/desktop/tests/asset-db.test.tsindex 76c26988c..6055fbf5d 100644--- a/desktop/tests/asset-db.test.ts+++ b/desktop/tests/asset-db.test.ts@@ -11,7 +11,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync, statSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { scanAssetDatabase, type AssetIndex } from '../electron/assetDb';+import { scanAssetDatabase, type AssetIndex } from '../../pipeline/src/assets/assetDb';let root: string;diff --git a/desktop/tests/asset-meta-table.test.ts b/desktop/tests/asset-meta-table.test.tsindex 5ea9ae28a..7e07b8735 100644--- a/desktop/tests/asset-meta-table.test.ts+++ b/desktop/tests/asset-meta-table.test.ts@@ -8,7 +8,7 @@// editor; `.esanimator` had no CLI entry, so an imported animator controller// never got a `.meta`).import { describe, it, expect } from 'vitest';-import { EXT_TO_TYPE, metaTypeFor } from '../electron/assetMeta';+import { EXT_TO_TYPE, metaTypeFor } from '../../pipeline/src/assets/assetMeta';import {EXT_TO_TYPE as SHARED, metaTypeForContent, needsContentType, isProjectPlumbing,} from '../../tools/assetMetaTable.js';diff --git a/desktop/tests/asset-symlink-escape.test.ts b/desktop/tests/asset-symlink-escape.test.tsindex 405278295..6e700ba60 100644--- a/desktop/tests/asset-symlink-escape.test.ts+++ b/desktop/tests/asset-symlink-escape.test.ts@@ -16,8 +16,8 @@ import { describe, it, expect } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, symlinkSync, rmSync, readFileSync, existsSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { scanAssetDatabase } from '../electron/assetDb';-import { cookAssets } from '../electron/cookAssets';+import { scanAssetDatabase } from '../../pipeline/src/assets/assetDb';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';const SECRET = 'SECRET-BYTES-NOT-IN-THE-PROJECT';const LEAK_UUID = '33333333-3333-4333-8333-333333333333';diff --git a/desktop/tests/atlas-packer.test.ts b/desktop/tests/atlas-packer.test.tsindex e8da7d8cf..ad9ba2ddb 100644--- a/desktop/tests/atlas-packer.test.ts+++ b/desktop/tests/atlas-packer.test.ts@@ -4,7 +4,7 @@* @file Atlas packer — deterministic shelf packing + page composition.*/import { describe, it, expect } from 'vitest';-import { packAtlas, decodePngImage, encodePagePng, encodeRgbaPng, downscaleRgba, type AtlasInputImage } from '../electron/atlasPacker';+import { packAtlas, decodePngImage, encodePagePng, encodeRgbaPng, downscaleRgba, type AtlasInputImage } from '../../pipeline/src/assets/atlasPacker';function solid(key: string, width: number, height: number, rgba: [number, number, number, number]): AtlasInputImage {const data = new Uint8Array(width * height * 4);diff --git a/desktop/tests/audio-cook.test.ts b/desktop/tests/audio-cook.test.tsindex 4b1e21ac6..8db14c2e4 100644--- a/desktop/tests/audio-cook.test.ts+++ b/desktop/tests/audio-cook.test.ts@@ -5,7 +5,7 @@* chunks) and the WAV→MP3 transcode through the real LAME wasm encoder.*/import { describe, it, expect } from 'vitest';-import { parseWav, encodeWavToMp3, audioImportSettings } from '../electron/audioCook';+import { parseWav, encodeWavToMp3, audioImportSettings } from '../../pipeline/src/assets/audioCook';/** Build a minimal RIFF/WAVE file. */function makeWav(opts: {diff --git a/desktop/tests/content-policy.test.ts b/desktop/tests/content-policy.test.tsindex 639c87c2e..dd8d6cbf7 100644--- a/desktop/tests/content-policy.test.ts+++ b/desktop/tests/content-policy.test.ts@@ -12,7 +12,7 @@* those would make the editor retrigger itself forever.*/import { describe, it, expect } from 'vitest';-import { isContentDir, isContentFile, isNonContentPath, isPluginSourcePath, isWatchedPath } from '../electron/contentPolicy';+import { isContentDir, isContentFile, isNonContentPath, isPluginSourcePath, isWatchedPath } from '../../pipeline/src/assets/contentPolicy';describe('content classification', () => {it('excludes dot entries, dependency and build dirs', () => {diff --git a/desktop/tests/cook-assets.test.ts b/desktop/tests/cook-assets.test.tsindex 077133bb0..036869461 100644--- a/desktop/tests/cook-assets.test.ts+++ b/desktop/tests/cook-assets.test.ts@@ -9,8 +9,8 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { cookAssets } from '../electron/cookAssets';-import { decodePngImage } from '../electron/atlasPacker';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';+import { decodePngImage } from '../../pipeline/src/assets/atlasPacker';import { contentHashHex } from '../../sdk/src/asset/contentHash';interface AssetManifest {diff --git a/desktop/tests/scale/assets.scale.ts b/desktop/tests/scale/assets.scale.tsindex 21886396a..7dd790f9b 100644--- a/desktop/tests/scale/assets.scale.ts+++ b/desktop/tests/scale/assets.scale.ts@@ -18,7 +18,7 @@ import {updateAssetIndex,readCachedAssetIndex,type AssetIndex,-} from '../../electron/assetDb';+} from '../../../pipeline/src/assets/assetDb';import { collectAssetUsagesOfAll } from '../../src/project/assetRefs';import { budgeted, calibrate, corpusDir } from './harness';diff --git a/desktop/tests/spine-cook-deps.test.ts b/desktop/tests/spine-cook-deps.test.tsindex 4d934f6af..0b36ffc7d 100644--- a/desktop/tests/spine-cook-deps.test.ts+++ b/desktop/tests/spine-cook-deps.test.ts@@ -10,8 +10,8 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { scanAssetDatabase } from '../electron/assetDb';-import { cookAssets } from '../electron/cookAssets';+import { scanAssetDatabase } from '../../pipeline/src/assets/assetDb';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';let root: string;diff --git a/desktop/tests/tilemap-cook-deps.test.ts b/desktop/tests/tilemap-cook-deps.test.tsindex a5012c07d..8982e867f 100644--- a/desktop/tests/tilemap-cook-deps.test.ts+++ b/desktop/tests/tilemap-cook-deps.test.ts@@ -10,7 +10,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { cookAssets } from '../electron/cookAssets';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';let root: string;diff --git a/desktop/tests/video-asset.test.ts b/desktop/tests/video-asset.test.tsindex 799ca2dac..544b0cbb6 100644--- a/desktop/tests/video-asset.test.ts+++ b/desktop/tests/video-asset.test.ts@@ -8,7 +8,7 @@*/import { describe, it, expect } from 'vitest';import { assetTypeOf } from '../src/project/assetTypes';-import { metaTypeFor } from '../electron/assetMeta';+import { metaTypeFor } from '../../pipeline/src/assets/assetMeta';import { importerDefaults, hasImporterSettings } from '../../pipeline/src/project/importSettings';describe('video asset type', () => {diff --git a/desktop/tests/video-cook.test.ts b/desktop/tests/video-cook.test.tsindex 39274c847..a726cd5bc 100644--- a/desktop/tests/video-cook.test.ts+++ b/desktop/tests/video-cook.test.ts@@ -14,8 +14,8 @@ import { existsSync, readFileSync } from 'node:fs';import { mkdtemp } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';-import { resolveFfmpeg, transcodeVideoForWasm, videoImportSettings } from '../electron/videoCook';-import { cookAssets } from '../electron/cookAssets';+import { resolveFfmpeg, transcodeVideoForWasm, videoImportSettings } from '../../pipeline/src/assets/videoCook';+import { cookAssets } from '../../pipeline/src/assets/cookAssets';const execFileAsync = promisify(execFile);diff --git a/desktop/electron/addressableManifest.ts b/pipeline/src/assets/addressableManifest.tssimilarity index 98%rename from desktop/electron/addressableManifest.tsrename to pipeline/src/assets/addressableManifest.tsindex 26f883ee9..f5dbc7048 100644--- a/desktop/electron/addressableManifest.ts+++ b/pipeline/src/assets/addressableManifest.ts@@ -17,8 +17,8 @@*/import { readFile, stat } from 'node:fs/promises';import path from 'node:path';-import { deriveManifestRevision, type AddressableManifest } from '../../sdk/src/asset/AddressableManifest';-import { textureImportSettingsFrom, type ParsedTextureImportSettings } from '../../sdk/src/asset/textureImportSettings';+import { deriveManifestRevision, type AddressableManifest } from '../../../sdk/src/asset/AddressableManifest';+import { textureImportSettingsFrom, type ParsedTextureImportSettings } from '../../../sdk/src/asset/textureImportSettings';/** The flat v1.0 cook manifest this reads (see cookAssets `CookManifestEntry`). */interface FlatManifest {diff --git a/desktop/electron/assetDb.ts b/pipeline/src/assets/assetDb.tssimilarity index 98%rename from desktop/electron/assetDb.tsrename to pipeline/src/assets/assetDb.tsindex d66b0bda8..53da43234 100644--- a/desktop/electron/assetDb.ts+++ b/pipeline/src/assets/assetDb.ts@@ -21,17 +21,17 @@ import type { Dirent } from 'node:fs';import { existsSync } from 'node:fs';import { randomUUID } from 'node:crypto';import path from 'node:path';-import { readTextInRoot } from './projectFs';-import { isInsideRoot } from './pathSandbox';+import { readTextInRoot } from '../project/readProject';+import { isInsideRoot } from '../fs/pathSandbox';import { META_EXT, isContentDir, isContentFile, isNonContentPath } from './contentPolicy';import { adoptOrphan } from './assetMeta';// The runtime's tileset-path resolver (a dependency-free leaf) — shared so the dep scan// discovers a tilemap's tileset images the same way the loader will later request them.-import { resolveRelativePath } from '../../sdk/src/tilemap/tiledPath';+import { resolveRelativePath } from '../../../sdk/src/tilemap/tiledPath';// The spine-atlas page parser (a dependency-free leaf) — shared with the runtime loaders// so the dep scan discovers an atlas's texture pages the same way they will be requested.-import { parseSpineAtlasPages } from '../../sdk/src/spine/atlasPages';-import { getEditorType } from '../../sdk/src/assetTypes';+import { parseSpineAtlasPages } from '../../../sdk/src/spine/atlasPages';+import { getEditorType } from '../../../sdk/src/assetTypes';/** Local, gitignored cache inside the project (next to workspace.json). */const CACHE_DIR = '.esengine/cache';diff --git a/desktop/electron/assetMeta.ts b/pipeline/src/assets/assetMeta.tssimilarity index 96%rename from desktop/electron/assetMeta.tsrename to pipeline/src/assets/assetMeta.tsindex 3f80517f7..f4d1a2b82 100644--- a/desktop/electron/assetMeta.ts+++ b/pipeline/src/assets/assetMeta.ts@@ -14,10 +14,10 @@ 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 '../../pipeline/src/project/importSettings';+import { importerDefaults } from '../project/importSettings';import {EXT_TO_TYPE, metaTypeForExt, metaTypeForContent, needsContentType, CONTENT_SNIFF_BYTES,-} from '../../tools/assetMetaTable.js';+} from '../../../tools/assetMetaTable.js';export const META_VERSION = '2.0';diff --git a/desktop/electron/atlasPacker.ts b/pipeline/src/assets/atlasPacker.tssimilarity index 99%rename from desktop/electron/atlasPacker.tsrename to pipeline/src/assets/atlasPacker.tsindex 9e56302c8..03138a062 100644--- a/desktop/electron/atlasPacker.ts+++ b/pipeline/src/assets/atlasPacker.ts@@ -11,7 +11,7 @@* pixel fixtures.*/import { PNG } from 'pngjs';-import { ShelfPacker } from '../../sdk/src/util/shelfPack';+import { ShelfPacker } from '../../../sdk/src/util/shelfPack';export interface AtlasInputImage {/** Stable identity (the project-relative texture path). */diff --git a/desktop/electron/audioCook.ts b/pipeline/src/assets/audioCook.tssimilarity index 100%rename from desktop/electron/audioCook.tsrename to pipeline/src/assets/audioCook.tsdiff --git a/desktop/electron/contentPolicy.ts b/pipeline/src/assets/contentPolicy.tssimilarity index 97%rename from desktop/electron/contentPolicy.tsrename to pipeline/src/assets/contentPolicy.tsindex 5137d535c..c03eeb0db 100644--- a/desktop/electron/contentPolicy.ts+++ b/pipeline/src/assets/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 '../../pipeline/src/project/pluginPaths';+import { PROJECT_PLUGIN_REL } from '../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/pipeline/src/assets/cookAssets.tssimilarity index 98%rename from desktop/electron/cookAssets.tsrename to pipeline/src/assets/cookAssets.tsindex ffc635ddb..4e4bac77e 100644--- a/desktop/electron/cookAssets.ts+++ b/pipeline/src/assets/cookAssets.ts@@ -18,22 +18,22 @@* This is the reachability + manifest + staging core they all build on.*/import { writeFile, mkdir, readFile } from 'node:fs/promises';-import { isInsideRoot } from './pathSandbox';+import { isInsideRoot } from '../fs/pathSandbox';import path from 'node:path';import { scanAssetDatabase, type AssetEntry } from './assetDb';import { packAtlas, decodePngImage, encodePagePng, encodeRgbaPng, downscaleRgba, type AtlasInputImage } from './atlasPacker';// 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 '../../pipeline/src/project/importSettings';+import { readTextureCookSettings } from '../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';-import { resolveRelativePath } from '../../sdk/src/tilemap/tiledPath';+import { contentHashHex } from '../../../sdk/src/asset/contentHash';+import { resolveRelativePath } from '../../../sdk/src/tilemap/tiledPath';// Single source for the folder→delivery-group model, shared with the editor Play// realm (sdk/src/asset/assetGroups.ts) so cook and editor never disagree.-import { resolveAssetGroup, resolveAtlas, type AssetGroupsConfig } from '../../sdk/src/asset/assetGroups';-import type { BundleMode } from '../../sdk/src/asset/AddressableManifest';+import { resolveAssetGroup, resolveAtlas, type AssetGroupsConfig } from '../../../sdk/src/asset/assetGroups';+import type { BundleMode } from '../../../sdk/src/asset/AddressableManifest';const MANIFEST = 'assets.manifest.json';@@ -351,7 +351,7 @@ export async function cookAssets(let encodePng: ((png: Uint8Array) => Promise<Uint8Array>) | null = null;let textureEnc: BasisEncoderModule | null = null;if (compressTextures) {- textureEnc = await import('../../build-tools/basis/encoder.mjs') as unknown as BasisEncoderModule;+ textureEnc = await import('../../../build-tools/basis/encoder.mjs') as unknown as BasisEncoderModule;encodePng = (png) => textureEnc!.encodePngToKtx2(png, { mode: 'uastc' });}// WAV → MP3 (LAME wasm) rides the same lazy pattern; per-asset importerdiff --git a/desktop/electron/videoCook.ts b/pipeline/src/assets/videoCook.tssimilarity index 100%rename from desktop/electron/videoCook.tsrename to pipeline/src/assets/videoCook.tsdiff --git a/desktop/electron/pathSandbox.ts b/pipeline/src/fs/pathSandbox.tssimilarity index 100%rename from desktop/electron/pathSandbox.tsrename to pipeline/src/fs/pathSandbox.tsdiff --git a/pipeline/src/index.ts b/pipeline/src/index.tsindex 24b6f8dd6..e1fc60080 100644--- a/pipeline/src/index.ts+++ b/pipeline/src/index.ts@@ -12,3 +12,10 @@ export * from './project/sizeBudget';export * from './project/targetSupport';export * from './project/importSettings';export * from './project/pluginPaths';+export * from './project/readProject';+export * from './fs/pathSandbox';+export * from './assets/contentPolicy';+export * from './assets/assetMeta';+export * from './assets/assetDb';+export * from './assets/cookAssets';+export * from './assets/addressableManifest';diff --git a/pipeline/src/project/readProject.ts b/pipeline/src/project/readProject.tsnew file mode 100644index 000000000..b0d5b68ef--- /dev/null+++ b/pipeline/src/project/readProject.ts@@ -0,0 +1,56 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file Opening a project: the manifest, and the workspace beside it.+ *+ * The first thing any build does, and the first thing the editor does. One+ * reader, so a headless build and an open window agree on what the project says.+ */+import { readFile } from 'node:fs/promises';+import { existsSync } from 'node:fs';+import path from 'node:path';+import {+ PROJECT_MANIFEST_FILE,+ WORKSPACE_DIR,+ WORKSPACE_FILE,+ parseManifest,+ type ProjectManifest,+ type OpenedProject,+ type WorkspaceState,+} from './format';++/**+ * Read a project file as text, without the byte-order mark. A BOM is an encoding+ * hint that `JSON.parse` treats as a syntax error, and any Windows tool can+ * leave one. Stripped at this door rather than at each parse — the parses are+ * many and the door is one.+ */+export async function readTextInRoot(abs: string): Promise<string> {+ const text = await readFile(abs, 'utf8');+ return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;+}++/** Require + parse a project's `project.esproject` manifest (no workspace load). */+export async function readManifest(root: string): Promise<ProjectManifest> {+ const manifestPath = path.join(root, PROJECT_MANIFEST_FILE);+ if (!existsSync(manifestPath)) {+ throw new Error(`not an Estella project (missing ${PROJECT_MANIFEST_FILE}): ${root}`);+ }+ return parseManifest(JSON.parse(await readTextInRoot(manifestPath)));+}++/** Open a project: require + parse `project.esproject`, load workspace if present. */+export async function openProject(root: string): Promise<OpenedProject> {+ const manifest = await readManifest(root);++ let workspace: WorkspaceState = {};+ const wsPath = path.join(root, WORKSPACE_DIR, WORKSPACE_FILE);+ if (existsSync(wsPath)) {+ try {+ workspace = JSON.parse(await readTextInRoot(wsPath)) as WorkspaceState;+ } catch {+ // A corrupt workspace file is non-fatal — start clean.+ }+ }+ return { root, manifest, workspace };+}diff --git a/tools/check-path-sandbox.mjs b/tools/check-path-sandbox.mjsindex e9b32b4a8..676af4914 100644--- a/tools/check-path-sandbox.mjs+++ b/tools/check-path-sandbox.mjs@@ -17,8 +17,8 @@ import path from 'node:path';import { fileURLToPath } from 'node:url';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');-const HOME = 'desktop/electron/pathSandbox.ts';-const SCOPE = /^desktop\/(electron|src)\/.*\.tsx?$/;+const HOME = 'pipeline/src/fs/pathSandbox.ts';+const SCOPE = /^(desktop\/(electron|src)|pipeline\/src)\/.*\.tsx?$/;// The two spellings of lexical containment, which is the check that is not one.const IDIOMS = [