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): the exporters, the bundler and the game host leave the editor
esengine6a160e3e87c2
diff --git a/desktop/electron/buildPlayRealm.ts b/desktop/electron/buildPlayRealm.tsindex f013d4d95..d92425977 100644--- a/desktop/electron/buildPlayRealm.ts+++ b/desktop/electron/buildPlayRealm.ts@@ -23,31 +23,12 @@*/import { cp, mkdir, rm, writeFile, readFile, stat, readdir } from 'node:fs/promises';import { existsSync } from 'node:fs';-import { createHash } from 'node:crypto';import path from 'node:path';-import { loadProjectModules, sideModuleDeclarations, stageProjectModules } from './projectModules';+import { loadProjectModules, sideModuleDeclarations, stageProjectModules } from '../../pipeline/src/export/projectModules';+import { IMPORT_MAP_JSON, IMPORT_MAP_CSP_HASH } from '../../pipeline/src/bundle/importMap';const PLAY_DIR = '.esengine/play';-// Subpath exports can't be a single `esengine/` → `./sdk/` mapping (import maps-// don't append /index.js for directories), so list the real files (mirrors-// sdk/package.json `exports`).-// The realm + the shipped game share this import map (esengine → ./sdk) and the-// CSP hash for the inline <script type=importmap>. Subpath exports are listed-// explicitly (import maps don't append /index.js for a directory).-export const IMPORT_MAP = {- imports: {- esengine: './sdk/index.js',- 'esengine/spine': './sdk/spine/index.js',- 'esengine/dragonbones': './sdk/dragonbones/index.js',- 'esengine/physics': './sdk/physics/index.js',- 'esengine/wasm': './sdk/wasm.js',- 'esengine/factory': './sdk/webAppFactory.js',- },-};-export const IMPORT_MAP_JSON = JSON.stringify(IMPORT_MAP);-export const IMPORT_MAP_CSP_HASH = `sha256-${createHash('sha256').update(IMPORT_MAP_JSON).digest('base64')}`;-// The inline import map is an inline <script>, so CSP must allow it — by HASH// (not 'unsafe-inline', which would permit any inline script). 'unsafe-eval' is// for the emscripten glue; `blob:` in script-src lets an optional native module'sdiff --git a/desktop/electron/extractSchemas.ts b/desktop/electron/extractSchemas.tsindex 480ab9b41..86c6055c7 100644--- a/desktop/electron/extractSchemas.ts+++ b/desktop/electron/extractSchemas.ts@@ -21,8 +21,8 @@* reusable; the IPC wiring lives in main.ts.*/import type { Plugin } from 'esbuild';-import { loadEsbuild } from './esbuildRuntime';-import { esengineAlias } from './esengineResolve';+import { loadEsbuild } from '../../pipeline/src/bundle/esbuildRuntime';+import { esengineAlias } from '../../pipeline/src/bundle/esengineResolve';import { existsSync, mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';diff --git a/desktop/electron/main.ts b/desktop/electron/main.tsindex 466676f85..9beb79e26 100644--- a/desktop/electron/main.ts+++ b/desktop/electron/main.ts@@ -28,19 +28,18 @@ 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';-import { buildProjectScripts } from './buildScripts';-import { buildOpenDataContext } from './buildOpenData';+import { buildProjectScripts } from '../../pipeline/src/bundle/buildScripts';+import { buildOpenDataContext } from '../../pipeline/src/bundle/buildOpenData';import { extractProjectSchemas } from './extractSchemas';import { scaffoldScript, type ScriptKind } from './scriptScaffold';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';+import { exportGame } from '../../pipeline/src/export/exportGame';import {iosSourcesFromTemplate, resolveNativeTemplate, installNativeTemplate, listNativeTemplates,- removeNativeTemplate, downloadNativeTemplate, type TemplatePlatform,-} from './nativeTemplates';+ removeNativeTemplate, downloadNativeTemplate, } from '../../pipeline/src/export/nativeTemplates';import { isTemplatePlatform } from '../../build-tools/utils/nativeTemplate.js';import { DESKTOP_OSES } from '../../pipeline/src/project/platforms';import { loopbackServer, closeAllLoopbackServers } from './loopbackServer';@@ -81,10 +80,11 @@ import {listPlatforms, loadProjectPlatform, createProjectPlatform, setPlatformTrustGate,listPlayableNetworks, loadPlayableProfile,type PlatformRuntimeDirs, type ProjectPlatformKind,-} from './platformCatalog';+} from '../../pipeline/src/export/platformCatalog';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';+import type { TemplatePlatform } from '../../pipeline/src/project/platforms';// 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/pluginHost.ts b/desktop/electron/pluginHost.tsindex 810d5b492..0e1df7192 100644--- a/desktop/electron/pluginHost.ts+++ b/desktop/electron/pluginHost.ts@@ -32,10 +32,10 @@import { existsSync } from 'node:fs';import { readdir, readFile } from 'node:fs/promises';import path from 'node:path';-import { loadEsbuild } from './esbuildRuntime';+import { loadEsbuild } from '../../pipeline/src/bundle/esbuildRuntime';import { validateManifest, type PluginManifest } from '../src/plugins/manifest';import { PROJECT_PLUGIN_REL } from '../../pipeline/src/project/pluginPaths';-import { PROJECT_PLATFORM_DIR, platformTrustId } from './platformCatalog';+import { PROJECT_PLATFORM_DIR, platformTrustId } from '../../pipeline/src/export/platformCatalog';/** Where a project keeps its own plugins (sibling of `.esengine/platforms/`),* resolved to this OS's separator from the one shared spelling. */diff --git a/desktop/electron/preload.ts b/desktop/electron/preload.tsindex f3cc74cf0..3e2ff359f 100644--- a/desktop/electron/preload.ts+++ b/desktop/electron/preload.ts@@ -2,16 +2,16 @@// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { contextBridge, ipcRenderer, webUtils } from 'electron';import type { OpenedProject, WorkspaceState, DirEntry, RecentEntry, TemplateEntry, ExportPlatform } from '../../pipeline/src/project/format';-import type { BuildScriptsResult } from './buildScripts';+import type { BuildScriptsResult } from '../../pipeline/src/bundle/buildScripts';import type { ExtractSchemasResult } from './extractSchemas';import type { ScaffoldScriptResult, ScriptKind } from './scriptScaffold';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 { ExportGameResult } from '../../pipeline/src/export/exportGame';import type { RevertResult } from './fileJournal';import type {PlatformStatus, CreatePlatformResult, PlayableNetworkOption, ProjectPlatformKind,-} from './platformCatalog';+} from '../../pipeline/src/export/platformCatalog';import type { PlayRealmResult } from './buildPlayRealm';import type { AvailableUpdate, DownloadProgress, UpdateStatus } from './autoUpdate';import type { LaunchError } from './externalProgram';@@ -19,12 +19,13 @@ import type { DetectedEditor } from './editorCatalog';import type { DiscoveredPlugin, CompiledPlugin } from './pluginHost';import type { ScaffoldPluginOptions, ScaffoldPluginResult } from './pluginScaffold';import type { PluginPackageInfo, InstallPluginResult } from './pluginPackage';-import type { NativeTemplateEntry, InstallResult, TemplatePlatform } from './nativeTemplates';+import type { NativeTemplateEntry, InstallResult } from '../../pipeline/src/export/nativeTemplates';import type { McpEndpointStatus } from './mcpEndpoint';import type { SecretStatus } from './secrets';import type { AgentStatus, AgentMessage } from './agent/host';import type { AgentEvent, ConfirmAnswer, UserImage } from './agent/types';import type { ConversationSummary } from './agent/store';+import type { TemplatePlatform } from '../../pipeline/src/project/platforms';// The privileged bridge the renderer is allowed to touch. Keep this surface small// and explicit — anything the editor needs from the OS or Node goes through here.diff --git a/desktop/scripts/export-project.mjs b/desktop/scripts/export-project.mjsindex 507a3c883..2cc3e4fcb 100644--- a/desktop/scripts/export-project.mjs+++ b/desktop/scripts/export-project.mjs@@ -37,6 +37,7 @@ import { installedTemplateDir, iosTemplateSources } from '../../build-tools/utilconst HERE = path.dirname(fileURLToPath(import.meta.url));const DESKTOP = path.join(HERE, '..');const REPO = path.join(DESKTOP, '..');+const PIPELINE = path.join(REPO, 'pipeline');function parseArgs(argv) {const [projectDir, ...rest] = argv;@@ -79,23 +80,23 @@ const fileUrl = (p) => `file:///${p.replace(/\\/g, '/')}`;// (pngjs). esbuild itself stays external: the module resolves it at runtime the// same way the electron main process does.async function loadExportGame() {- const require = createRequire(path.join(DESKTOP, 'package.json'));+ const require = createRequire(path.join(PIPELINE, 'package.json'));const esbuild = require('esbuild');- // Inside desktop/, so the bundle's own `import 'esbuild'` resolves through- // desktop/node_modules the way it does for the electron main process.- const dir = mkdtempSync(path.join(DESKTOP, '.export-'));+ // Inside the pipeline package, so the bundle's own `import 'esbuild'` resolves+ // the way it does for the module being bundled.+ const dir = mkdtempSync(path.join(PIPELINE, 'src', '.export-'));const outfile = path.join(dir, 'exportGame.mjs');await esbuild.build({- entryPoints: [path.join(DESKTOP, 'electron', 'exportGame.ts')],+ entryPoints: [path.join(PIPELINE, 'src', 'export', 'exportGame.ts')],outfile, bundle: true, format: 'esm', platform: 'node', target: 'node20',// The Basis encoder finds its own .cjs/.wasm through `import.meta.url`,// so inlining it makes it look beside the BUNDLE. External keeps the- // specifier, and the temp dir is as deep under desktop/ as electron/ is.- external: ['esbuild', 'electron', 'sharp', '../../build-tools/basis/encoder.mjs'],+ // specifier, and the temp dir sits as deep in the package as the cook does.+ external: ['esbuild', 'electron', 'sharp', '../../../build-tools/basis/encoder.mjs'],logLevel: 'error',banner: {js: "import { createRequire as __esCreateRequire } from 'node:module';\n"- + `const require = __esCreateRequire('${fileUrl(path.join(DESKTOP, 'package.json'))}');\n`,+ + `const require = __esCreateRequire('${fileUrl(path.join(PIPELINE, 'package.json'))}');\n`,},});const mod = await import(fileUrl(outfile));@@ -111,17 +112,17 @@ async function loadExportGame() {* project packaged landscape — a 600x1080 shmup included.*/async function loadProjectFormat() {- const require = createRequire(path.join(DESKTOP, 'package.json'));+ const require = createRequire(path.join(PIPELINE, 'package.json'));const esbuild = require('esbuild');- const dir = mkdtempSync(path.join(DESKTOP, '.format-'));+ const dir = mkdtempSync(path.join(PIPELINE, '.format-'));const outfile = path.join(dir, 'format.mjs');await esbuild.build({// runtimeConfig re-exports nothing of format's, so both entries are bundled// 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 '../pipeline/src/project/format';\nexport * from '../pipeline/src/project/runtimeConfig';\n",- resolveDir: DESKTOP,+ contents: "export * from './src/project/format';\nexport * from './src/project/runtimeConfig';\n",+ resolveDir: PIPELINE,sourcefile: 'projectFormat.ts',loader: 'ts',},@@ -215,7 +216,7 @@ try {root: opts.projectDir,entryScene,scriptsEntry,- gameHostEntry: path.join(DESKTOP, 'src', 'gameHost.ts'),+ gameHostEntry: path.join(DESKTOP, '..', 'pipeline', 'src', 'runtime', 'gameHost.ts'),sdkDistDir: path.join(REPO, 'sdk', 'dist'),wasmDir,outDir,diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsxindex d7ccf6d36..0d2fa15f0 100644--- a/desktop/src/components/BuildDialog.tsx+++ b/desktop/src/components/BuildDialog.tsx@@ -35,9 +35,8 @@ import {} from 'lucide-react';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 type { PlayableNetworkOption } from '../../../pipeline/src/export/platformCatalog';+import type { BuildSizeReport } from '../../../pipeline/src/export/sizeReport';import { formatBytes } from '../../../pipeline/src/project/sizeBudget';import { BuildSizePanel } from '@/components/BuildSizePanel';import { Modal } from '@/components/Modal';@@ -52,6 +51,7 @@ import { cookOptionsOf } from '../../../pipeline/src/project/runtimeConfig';import { AssetRegistry } from '@/project/AssetRegistry';import { useEditorStore } from '@/store/editorStore';import { t } from '@/i18n';+import type { TemplatePlatform } from '../../../pipeline/src/project/platforms';type Phase = 'idle' | 'running' | 'done' | 'error';type Config = 'development' | 'shipping';diff --git a/desktop/src/components/BuildSizePanel.tsx b/desktop/src/components/BuildSizePanel.tsxindex 761b8edfb..0a9231121 100644--- a/desktop/src/components/BuildSizePanel.tsx+++ b/desktop/src/components/BuildSizePanel.tsx@@ -18,7 +18,7 @@*/import { useState } from 'react';import { ChevronRight } from 'lucide-react';-import type { BuildSizeReport, SizeBucket, SizeKind } from '../../electron/sizeReport';+import type { BuildSizeReport, SizeBucket, SizeKind } from '../../../pipeline/src/export/sizeReport';import type { BudgetScope, SizeVerdict } from '../../../pipeline/src/project/sizeBudget';import { formatBytes, PROJECT_BUDGET_NOTE } from '../../../pipeline/src/project/sizeBudget';import { t } from '@/i18n';diff --git a/desktop/tests/build-scripts.test.ts b/desktop/tests/build-scripts.test.tsindex a604916ce..60060d9b1 100644--- a/desktop/tests/build-scripts.test.ts+++ b/desktop/tests/build-scripts.test.ts@@ -10,7 +10,7 @@ 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 { buildProjectScripts } from '../electron/buildScripts';+import { buildProjectScripts } from '../../pipeline/src/bundle/buildScripts';let root: string;diff --git a/desktop/tests/bundle-diagnostics.test.ts b/desktop/tests/bundle-diagnostics.test.tsindex c6f5fddef..13d58762b 100644--- a/desktop/tests/bundle-diagnostics.test.ts+++ b/desktop/tests/bundle-diagnostics.test.ts@@ -14,7 +14,7 @@* appended to a real compile error costs more than the explanation is worth.*/import { describe, it, expect } from 'vitest';-import { explainBundleError, explainBundleErrors, isNodeBuiltin } from '../electron/bundleDiagnostics';+import { explainBundleError, explainBundleErrors, isNodeBuiltin } from '../../pipeline/src/bundle/bundleDiagnostics';describe('recognizing a Node built-in', () => {it('knows the built-ins in both spellings', () => {diff --git a/desktop/tests/cooked-verify-fixture.test.ts b/desktop/tests/cooked-verify-fixture.test.tsindex 2f4538e8d..4e2e5f8b0 100644--- a/desktop/tests/cooked-verify-fixture.test.ts+++ b/desktop/tests/cooked-verify-fixture.test.ts@@ -10,7 +10,7 @@ import { describe, it, expect } from 'vitest';import { mkdirSync, writeFileSync, copyFileSync, rmSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));const OUT = path.resolve(HERE, '..', '.cooked-verify');@@ -83,7 +83,7 @@ describe.skipIf(!process.env.ESTELLA_COOK_FIXTURE)('cooked-verify fixture', () =const res = await exportGame({root: SRC,entryScene: 'scenes/main.esscene',- gameHostEntry: path.resolve(HERE, '..', 'src', 'gameHost.ts'),+ gameHostEntry: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts'),scriptsEntry: 'src/main.ts',sdkDistDir: path.resolve(HERE, '..', '..', 'sdk', 'dist'),wasmDir: path.resolve(HERE, '..', '..', 'build', 'wasm', 'web'),diff --git a/desktop/tests/export-desktop.test.ts b/desktop/tests/export-desktop.test.tsindex 835e18d8e..854713905 100644--- a/desktop/tests/export-desktop.test.ts+++ b/desktop/tests/export-desktop.test.ts@@ -13,10 +13,10 @@ import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, readdiimport { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));-const GAME_HOST = path.join(HERE, '..', 'src', 'gameHost.ts');+const GAME_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts');let root: string;let out: string;diff --git a/desktop/tests/export-game.test.ts b/desktop/tests/export-game.test.tsindex a56bd849d..79a62a9a3 100644--- a/desktop/tests/export-game.test.ts+++ b/desktop/tests/export-game.test.ts@@ -14,10 +14,10 @@ import { createHash } from 'node:crypto';import { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));-const GAME_HOST = path.join(HERE, '..', 'src', 'gameHost.ts');+const GAME_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts');/** A solid RGBA PNG of an exact size — block alignment is what decides whether* the cook may compress it, so a fixture has to say which it is. */diff --git a/desktop/tests/export-native.test.ts b/desktop/tests/export-native.test.tsindex 3eb7f9d0b..9f760a574 100644--- a/desktop/tests/export-native.test.ts+++ b/desktop/tests/export-native.test.ts@@ -12,10 +12,10 @@ import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, rmSyncimport { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));-const GAME_HOST = path.join(HERE, '..', 'src', 'gameHost.ts');+const GAME_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts');let root: string;let out: string;diff --git a/desktop/tests/export-playable.test.ts b/desktop/tests/export-playable.test.tsindex c4ab0e352..69e5de01a 100644--- a/desktop/tests/export-playable.test.ts+++ b/desktop/tests/export-playable.test.ts@@ -14,10 +14,10 @@ import { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';import { execFileSync } from 'node:child_process';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));-const PLAYABLE_HOST = path.join(HERE, '..', 'src', 'playableHost.ts');+const PLAYABLE_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'playableHost.ts');let root: string;let out: string;diff --git a/desktop/tests/export-progress.test.ts b/desktop/tests/export-progress.test.tsindex 230036155..7648d0e17 100644--- a/desktop/tests/export-progress.test.ts+++ b/desktop/tests/export-progress.test.ts@@ -9,11 +9,11 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';-import type { ExportProgress } from '../electron/exportProgress';+import { exportGame } from '../../pipeline/src/export/exportGame';+import type { ExportProgress } from '../../pipeline/src/export/exportProgress';const HERE = path.dirname(fileURLToPath(import.meta.url));-const GAME_HOST = path.join(HERE, '..', 'src', 'gameHost.ts');+const GAME_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts');let root: string;const TEX = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';diff --git a/desktop/tests/export-project-platform.test.ts b/desktop/tests/export-project-platform.test.tsindex 7cf563e9c..5ac5465ed 100644--- a/desktop/tests/export-project-platform.test.ts+++ b/desktop/tests/export-project-platform.test.ts@@ -15,8 +15,8 @@ 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 { exportGame } from '../electron/exportGame';-import { loadProjectPlatform } from '../electron/platformCatalog';+import { exportGame } from '../../pipeline/src/export/exportGame';+import { loadProjectPlatform } from '../../pipeline/src/export/platformCatalog';const TEX = '11111111-1111-4111-8111-111111111111';const SCN = '22222222-2222-4222-8222-222222222222';diff --git a/desktop/tests/export-wechat.test.ts b/desktop/tests/export-wechat.test.tsindex f770a74a5..2db801cc9 100644--- a/desktop/tests/export-wechat.test.ts+++ b/desktop/tests/export-wechat.test.ts@@ -14,7 +14,7 @@ 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';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';let root: string;let out: string;diff --git a/desktop/tests/hotupdate-verify-fixture.test.ts b/desktop/tests/hotupdate-verify-fixture.test.tsindex 5c98c9ebd..a6389ebb9 100644--- a/desktop/tests/hotupdate-verify-fixture.test.ts+++ b/desktop/tests/hotupdate-verify-fixture.test.ts@@ -13,7 +13,7 @@ import { describe, it, expect } from 'vitest';import { writeFileSync, cpSync, rmSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';import { solidPng } from '../scripts/solidPng.mjs';const HERE = path.dirname(fileURLToPath(import.meta.url));@@ -26,7 +26,7 @@ const REDSRC = path.join(ROOT, 'red-src');const opts = (root: string, outDir: string) => ({root,entryScene: 'assets/scenes/main.esscene',- gameHostEntry: path.resolve(HERE, '..', 'src', 'gameHost.ts'),+ gameHostEntry: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts'),scriptsEntry: 'src/main.ts',sdkDistDir: path.resolve(HERE, '..', '..', 'sdk', 'dist'),wasmDir: path.resolve(HERE, '..', '..', 'build', 'wasm', 'web'),diff --git a/desktop/tests/native-template.test.ts b/desktop/tests/native-template.test.tsindex f5563fd4b..de7cea43d 100644--- a/desktop/tests/native-template.test.ts+++ b/desktop/tests/native-template.test.ts@@ -17,8 +17,8 @@ import path from 'node:path';import {resolveNativeTemplate, iosSourcesFromTemplate, installNativeTemplate,listNativeTemplates, removeNativeTemplate, downloadNativeTemplate,-} from '../electron/nativeTemplates';-import { listPlatforms } from '../electron/platformCatalog';+} from '../../pipeline/src/export/nativeTemplates';+import { listPlatforms } from '../../pipeline/src/export/platformCatalog';import {requiredTemplateFiles, templateLayout, installedTemplateDir, parseTemplateIndex,missingTemplateEntries, isTemplatePlatform,diff --git a/desktop/tests/open-data-rehearsal.test.ts b/desktop/tests/open-data-rehearsal.test.tsindex 6b947204f..3c6b2c308 100644--- a/desktop/tests/open-data-rehearsal.test.ts+++ b/desktop/tests/open-data-rehearsal.test.ts@@ -11,7 +11,7 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach } fromimport { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';-import { buildOpenDataContext } from '../electron/buildOpenData';+import { buildOpenDataContext } from '../../pipeline/src/bundle/buildOpenData';import { rehearseOpenData } from '@/engine/openDataRehearsal';let root: string;diff --git a/desktop/tests/platform-catalog.test.ts b/desktop/tests/platform-catalog.test.tsindex 0d9d63d98..5b6505dd1 100644--- a/desktop/tests/platform-catalog.test.ts+++ b/desktop/tests/platform-catalog.test.ts@@ -16,7 +16,7 @@ import path from 'node:path';import {listPlatforms, loadProjectPlatform, createProjectPlatform, PROJECT_PLATFORM_DIR,listPlayableNetworks, loadPlayableProfile,-} from '../electron/platformCatalog';+} from '../../pipeline/src/export/platformCatalog';import { BUILTIN_PLATFORMS } from '../../pipeline/src/project/platforms';let root: string;diff --git a/desktop/tests/platform-trust.test.ts b/desktop/tests/platform-trust.test.tsindex 11465838f..8f33ffa68 100644--- a/desktop/tests/platform-trust.test.ts+++ b/desktop/tests/platform-trust.test.ts@@ -16,7 +16,7 @@ import path from 'node:path';import {listPlatforms, listPlayableNetworks, loadProjectPlatform, setPlatformTrustGate,platformTrustId, PROJECT_PLATFORM_DIR,-} from '../electron/platformCatalog';+} from '../../pipeline/src/export/platformCatalog';import { discoverPlugins } from '../electron/pluginHost';let root: string;diff --git a/desktop/tests/project-modules.test.ts b/desktop/tests/project-modules.test.tsindex 89ca5a88f..990bac978 100644--- a/desktop/tests/project-modules.test.ts+++ b/desktop/tests/project-modules.test.ts@@ -22,7 +22,7 @@ import { tmpdir } from 'node:os';import path from 'node:path';import {loadProjectModules, sideModuleDeclarations, stageProjectModules, PROJECT_MODULES_DIR,-} from '../electron/projectModules';+} from '../../pipeline/src/export/projectModules';let root: string;diff --git a/desktop/tests/release-mirror.test.ts b/desktop/tests/release-mirror.test.tsindex 9a00e29a0..6d4a82ffc 100644--- a/desktop/tests/release-mirror.test.ts+++ b/desktop/tests/release-mirror.test.ts@@ -11,7 +11,7 @@ import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync } from 'node:fimport { createHash } from 'node:crypto';import { tmpdir } from 'node:os';import path from 'node:path';-import { downloadNativeTemplate } from '../electron/nativeTemplates';+import { downloadNativeTemplate } from '../../pipeline/src/export/nativeTemplates';import { checkForUpdate } from '../electron/updateCheck';import {releaseAssetBase, releaseAssetBases, releaseMirrors, RELEASE_MIRROR_ENV,diff --git a/desktop/tests/size-report.test.ts b/desktop/tests/size-report.test.tsindex b74365891..879f3d9e7 100644--- a/desktop/tests/size-report.test.ts+++ b/desktop/tests/size-report.test.ts@@ -20,7 +20,7 @@ import { tmpdir } from 'node:os';import path from 'node:path';import {summarizeBuildFiles, bucketIndexFrom, kindOf, measureBuild, collectBuildFiles,-} from '../electron/sizeReport';+} from '../../pipeline/src/export/sizeReport';import { resolveSizeBudgets, evaluateSizeBudget, formatBytes, PROJECT_BUDGET_NOTE } from '../../pipeline/src/project/sizeBudget';const MB = 1024 * 1024;diff --git a/desktop/tests/target-support.test.ts b/desktop/tests/target-support.test.tsindex 27013a802..26d348aa3 100644--- a/desktop/tests/target-support.test.ts+++ b/desktop/tests/target-support.test.ts@@ -18,11 +18,11 @@ import { fileURLToPath } from 'node:url';import {collectSubsystems, subsystemGapWarnings, targetGaps, SUBSYSTEM_CMAKE_FLAG, type Subsystem,} from '../../pipeline/src/project/targetSupport';-import { exportGame } from '../electron/exportGame';+import { exportGame } from '../../pipeline/src/export/exportGame';const HERE = path.dirname(fileURLToPath(import.meta.url));const REPO = path.resolve(HERE, '..', '..');-const GAME_HOST = path.join(HERE, '..', 'src', 'gameHost.ts');+const GAME_HOST = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime', 'gameHost.ts');describe('collectSubsystems', () => {it('sees components wherever they sit in the document', () => {diff --git a/desktop/vite.config.ts b/desktop/vite.config.tsindex 29cf91b1a..9925fbaa0 100644--- a/desktop/vite.config.ts+++ b/desktop/vite.config.ts@@ -5,23 +5,23 @@ import { fileURLToPath, URL } from 'node:url';import react from '@vitejs/plugin-react';import electron from 'vite-plugin-electron/simple';import { context as esbuildContext, type BuildContext } from 'esbuild';-import { ESENGINE_EXTERNAL } from './electron/esengineResolve';+import { ESENGINE_EXTERNAL } from '../pipeline/src/bundle/esengineResolve';/**- * Realm hosts (src/playHost.ts, src/gameHost.ts, src/playableHost.ts) are editor- * code that runs in a browser realm outside Vite — the play iframe and exported- * games load them over their own import maps. They're bundled HERE, at editor- * build time, into dist-electron/hosts/; the runtime stages the artifacts by- * copy (play realm) or re-bundles them with the per-export shipping config- * (exports). Never bundled from src/ at runtime: a packaged app ships no- * sources, and esbuild — a native subprocess — cannot read app.asar. Dev serve- * keeps an esbuild watch so host edits rebuild live.+ * Realm hosts run in a browser realm outside Vite, loaded over their own import+ * maps. Bundled HERE, at editor build time, into dist-electron/hosts/ — never+ * from sources at runtime, since a packaged app ships none and esbuild (a native+ * subprocess) cannot read app.asar.*/function realmHosts(): Plugin {let ctx: BuildContext | null = null;const create = () =>esbuildContext({- entryPoints: ['src/playHost.ts', 'src/gameHost.ts', 'src/playableHost.ts'],+ entryPoints: [+ { in: 'src/playHost.ts', out: 'playHost' },+ { in: '../pipeline/src/runtime/gameHost.ts', out: 'gameHost' },+ { in: '../pipeline/src/runtime/playableHost.ts', out: 'playableHost' },+ ],outdir: 'dist-electron/hosts',bundle: true,format: 'esm',diff --git a/desktop/electron/buildOpenData.ts b/pipeline/src/bundle/buildOpenData.tssimilarity index 100%rename from desktop/electron/buildOpenData.tsrename to pipeline/src/bundle/buildOpenData.tsdiff --git a/desktop/electron/buildScripts.ts b/pipeline/src/bundle/buildScripts.tssimilarity index 100%rename from desktop/electron/buildScripts.tsrename to pipeline/src/bundle/buildScripts.tsdiff --git a/desktop/electron/bundleDiagnostics.ts b/pipeline/src/bundle/bundleDiagnostics.tssimilarity index 100%rename from desktop/electron/bundleDiagnostics.tsrename to pipeline/src/bundle/bundleDiagnostics.tsdiff --git a/desktop/electron/esbuildRuntime.ts b/pipeline/src/bundle/esbuildRuntime.tssimilarity index 100%rename from desktop/electron/esbuildRuntime.tsrename to pipeline/src/bundle/esbuildRuntime.tsdiff --git a/desktop/electron/esengineResolve.ts b/pipeline/src/bundle/esengineResolve.tssimilarity index 100%rename from desktop/electron/esengineResolve.tsrename to pipeline/src/bundle/esengineResolve.tsdiff --git a/pipeline/src/bundle/importMap.ts b/pipeline/src/bundle/importMap.tsnew file mode 100644index 000000000..5cf48fb77--- /dev/null+++ b/pipeline/src/bundle/importMap.ts@@ -0,0 +1,28 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file How `esengine` resolves inside a staged realm — the editor's play page+ * and every shipped game share this one map, so a game runs against the+ * layout it was previewed on.+ *+ * Subpath exports are listed file by file: an import map does not append+ * `/index.js` for a directory. Mirrors the SDK's `exports`.+ */+import { createHash } from 'node:crypto';++export const IMPORT_MAP = {+ imports: {+ esengine: './sdk/index.js',+ 'esengine/spine': './sdk/spine/index.js',+ 'esengine/dragonbones': './sdk/dragonbones/index.js',+ 'esengine/physics': './sdk/physics/index.js',+ 'esengine/wasm': './sdk/wasm.js',+ 'esengine/factory': './sdk/webAppFactory.js',+ },+};++export const IMPORT_MAP_JSON = JSON.stringify(IMPORT_MAP);++/** The inline `<script type=importmap>` is an inline script, so a page's CSP has+ * to allow it by hash rather than by `unsafe-inline`. */+export const IMPORT_MAP_CSP_HASH = `sha256-${createHash('sha256').update(IMPORT_MAP_JSON).digest('base64')}`;diff --git a/desktop/electron/sideModuleScan.ts b/pipeline/src/bundle/sideModuleScan.tssimilarity index 100%rename from desktop/electron/sideModuleScan.tsrename to pipeline/src/bundle/sideModuleScan.tsdiff --git a/desktop/electron/exportGame.ts b/pipeline/src/export/exportGame.tssimilarity index 96%rename from desktop/electron/exportGame.tsrename to pipeline/src/export/exportGame.tsindex 2e9cb7c85..ab63ca2a8 100644--- a/desktop/electron/exportGame.ts+++ b/pipeline/src/export/exportGame.ts@@ -20,41 +20,41 @@* Pure Node (esbuild + fs) — IPC wiring is in main.ts.*/import type { BuildOptions, Plugin } from 'esbuild';-import { loadEsbuild } from './esbuildRuntime';+import { loadEsbuild } from '../bundle/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 '../../pipeline/src/assets/cookAssets';-import { buildAddressableManifest } from '../../pipeline/src/assets/addressableManifest';-import { activeRemoteRoot } from '../../sdk/src/asset/assetGroups';+import { cookAssets, loadAssetGroups } from '../assets/cookAssets';+import { buildAddressableManifest } from '../assets/addressableManifest';+import { activeRemoteRoot } from '../../../sdk/src/asset/assetGroups';import type { PackagedGameConfig } from 'esengine';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../../pipeline/src/project/runtimeConfig';-import { IMPORT_MAP_JSON, IMPORT_MAP_CSP_HASH } from './buildPlayRealm';+} from '../project/runtimeConfig';+import { IMPORT_MAP_JSON, IMPORT_MAP_CSP_HASH } from '../bundle/importMap';import { exportWeChat } from './exportWeChat';import { exportMiniGame } from './exportMiniGame';import type { MiniGameExportProfile } from './miniGameExportProfile';import { exportPlayable } from './exportPlayable';import { genericPlayableProfile, type PlayableAdProfile } from './playableAdProfile';import type { OnExportProgress } from './exportProgress';-import { ESENGINE_EXTERNAL } from './esengineResolve';-import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';+import { ESENGINE_EXTERNAL } from '../bundle/esengineResolve';+import { explainBundleErrors, type BundleMessage } from '../bundle/bundleDiagnostics';import { orientationCss, orientationOverlayHtml, orientationLockScript, orientationLockCspHash, type ScreenOrientation } from './orientationHtml';-import { emitIosXcodeProject, type IosProjectSources } from '../../build-tools/utils/iosProject.js';-import { emitAndroidGradleProject } from '../../build-tools/utils/gradleProject.js';-import { androidTemplateSources } from '../../build-tools/utils/nativeTemplate.js';-import { assembleApk, apkFileName } from '../../build-tools/utils/apk.js';-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 '../../pipeline/src/project/platforms';-import type { DesktopPackaging, SteamPackaging } from '../../pipeline/src/project/format';-import type { SizeBudget } from '../../pipeline/src/project/sizeBudget';+import { emitIosXcodeProject, type IosProjectSources } from '../../../build-tools/utils/iosProject.js';+import { emitAndroidGradleProject } from '../../../build-tools/utils/gradleProject.js';+import { androidTemplateSources } from '../../../build-tools/utils/nativeTemplate.js';+import { assembleApk, apkFileName } from '../../../build-tools/utils/apk.js';+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 '../project/platforms';+import type { DesktopPackaging, SteamPackaging } from '../project/format';+import type { SizeBudget } from '../project/sizeBudget';import { measureBuild, type BuildSizeReport } from './sizeReport';import { loadProjectModules, sideModuleDeclarations, stageProjectModules } from './projectModules';-import { collectSubsystems, subsystemGapWarnings, targetGaps, type Subsystem } from '../../pipeline/src/project/targetSupport';+import { collectSubsystems, subsystemGapWarnings, targetGaps, type Subsystem } from '../project/targetSupport';export type { ExportPlatform };/**diff --git a/desktop/electron/exportMiniGame.ts b/pipeline/src/export/exportMiniGame.tssimilarity index 98%rename from desktop/electron/exportMiniGame.tsrename to pipeline/src/export/exportMiniGame.tsindex d744c8112..ed188247b 100644--- a/desktop/electron/exportMiniGame.ts+++ b/pipeline/src/export/exportMiniGame.ts@@ -28,23 +28,23 @@* have no import maps and a different module/asset model, so this is its* own path. Pure Node (esbuild + fs) — IPC wiring is in main.ts.*/-import { loadEsbuild } from './esbuildRuntime';+import { loadEsbuild } from '../bundle/esbuildRuntime';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../../pipeline/src/project/runtimeConfig';+} from '../project/runtimeConfig';import { writeFile, mkdir, cp, readFile, rename, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { cookAssets } from '../../pipeline/src/assets/cookAssets';-import { buildAddressableManifest } from '../../pipeline/src/assets/addressableManifest';+import { cookAssets } from '../assets/cookAssets';+import { buildAddressableManifest } from '../assets/addressableManifest';import type { ExportScene } from './exportGame';import type { OnExportProgress } from './exportProgress';-import { esengineAlias } from './esengineResolve';-import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';+import { esengineAlias } from '../bundle/esengineResolve';+import { explainBundleErrors, type BundleMessage } from '../bundle/bundleDiagnostics';import {sceneUsesPhysics, sceneUsesVideo, sceneUsesDragonBones, detectSpineVersion, detectSpineVersionJson,spineModuleId, SIDE_MODULE_FILE,-} from './sideModuleScan';+} from '../bundle/sideModuleScan';import { OPEN_DATA_DIR } from './miniGameExportProfile';import { loadProjectModules, sideModuleDeclarations, stageProjectModules } from './projectModules';import type { MiniGameExportProfile, MiniGameVendor } from './miniGameExportProfile';diff --git a/desktop/electron/exportPlayable.ts b/pipeline/src/export/exportPlayable.tssimilarity index 97%rename from desktop/electron/exportPlayable.tsrename to pipeline/src/export/exportPlayable.tsindex c16b4fc6d..2b32e556a 100644--- a/desktop/electron/exportPlayable.ts+++ b/pipeline/src/export/exportPlayable.ts@@ -16,24 +16,24 @@* here — runtime is validated in a browser / ad preview). Pure Node (esbuild* + fs); IPC wiring in main.ts.*/-import { loadEsbuild } from './esbuildRuntime';+import { loadEsbuild } from '../bundle/esbuildRuntime';import {DEFAULT_RUNTIME_CONFIG, packagedRuntimeFields, type RuntimeProjectConfig,-} from '../../pipeline/src/project/runtimeConfig';+} from '../project/runtimeConfig';import { writeFile, mkdir, readFile, stat, rm } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';-import { cookAssets } from '../../pipeline/src/assets/cookAssets';+import { cookAssets } from '../assets/cookAssets';import type { OnExportProgress } from './exportProgress';-import { esengineAlias } from './esengineResolve';-import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';+import { esengineAlias } from '../bundle/esengineResolve';+import { explainBundleErrors, type BundleMessage } from '../bundle/bundleDiagnostics';import type { ScreenOrientation } from './orientationHtml';import { genericPlayableProfile, playableAdInjection, type PlayableAdProfile } from './playableAdProfile';-import { makeZip } from '../../build-tools/utils/zip.js';+import { makeZip } from '../../../build-tools/utils/zip.js';import {sceneUsesPhysics, sceneUsesDragonBones, detectSpineVersion, detectSpineVersionJson,spineModuleId, SIDE_MODULE_FILE, type SpineVersion,-} from './sideModuleScan';+} from '../bundle/sideModuleScan';export interface ExportPlayableResult {ok: boolean;diff --git a/desktop/electron/exportProgress.ts b/pipeline/src/export/exportProgress.tssimilarity index 100%rename from desktop/electron/exportProgress.tsrename to pipeline/src/export/exportProgress.tsdiff --git a/desktop/electron/exportWeChat.ts b/pipeline/src/export/exportWeChat.tssimilarity index 100%rename from desktop/electron/exportWeChat.tsrename to pipeline/src/export/exportWeChat.tsdiff --git a/desktop/electron/miniGameExportProfile.ts b/pipeline/src/export/miniGameExportProfile.tssimilarity index 98%rename from desktop/electron/miniGameExportProfile.tsrename to pipeline/src/export/miniGameExportProfile.tsindex b14d3cedb..31c92222f 100644--- a/desktop/electron/miniGameExportProfile.ts+++ b/pipeline/src/export/miniGameExportProfile.ts@@ -11,8 +11,8 @@** Adding a vendor = one profile object, not a fork of the pipeline.*/-import { WECHAT_MODULE_BUILD_TARGET } from './sideModuleScan';-import type { SizeBudget } from '../../pipeline/src/project/sizeBudget';+import { WECHAT_MODULE_BUILD_TARGET } from '../bundle/sideModuleScan';+import type { SizeBudget } from '../project/sizeBudget';/*** A mini-game vendor's id. Open on purpose: the value is identity — the cook'sdiff --git a/desktop/electron/nativeTemplates.ts b/pipeline/src/export/nativeTemplates.tssimilarity index 98%rename from desktop/electron/nativeTemplates.tsrename to pipeline/src/export/nativeTemplates.tsindex 92a2b0b3d..25e7c0a77 100644--- a/desktop/electron/nativeTemplates.ts+++ b/pipeline/src/export/nativeTemplates.ts@@ -24,10 +24,10 @@ import {templateStoreDir, iosTemplateSources, releaseAssetBases, parseTemplateIndex,TEMPLATE_INDEX,type TemplatePlatform, type NativeTemplateManifest,-} from '../../build-tools/utils/nativeTemplate.js';-import { extractZip } from '../../build-tools/utils/zip.js';+} from '../../../build-tools/utils/nativeTemplate.js';+import { extractZip } from '../../../build-tools/utils/zip.js';-export type { TemplatePlatform, NativeTemplateManifest };+export type { NativeTemplateManifest };/** A template this editor can actually use, with where it came from. */export interface UsableTemplate {diff --git a/desktop/electron/orientationHtml.ts b/pipeline/src/export/orientationHtml.tssimilarity index 97%rename from desktop/electron/orientationHtml.tsrename to pipeline/src/export/orientationHtml.tsindex 2d5972332..f3fb40875 100644--- a/desktop/electron/orientationHtml.ts+++ b/pipeline/src/export/orientationHtml.ts@@ -15,8 +15,9 @@* and desktop sizes its own window.*/import { createHash } from 'node:crypto';+import type { ScreenOrientation } from '../project/format';-export type ScreenOrientation = 'portrait' | 'landscape';+export type { ScreenOrientation };/** CSS pinning the canvas to `orientation`: the `#rotate-hint` overlay replaces the* canvas whenever the device is turned the wrong way. */diff --git a/desktop/electron/platformCatalog.ts b/pipeline/src/export/platformCatalog.tssimilarity index 99%rename from desktop/electron/platformCatalog.tsrename to pipeline/src/export/platformCatalog.tsindex 139d49b7b..62fb7cc97 100644--- a/desktop/electron/platformCatalog.ts+++ b/pipeline/src/export/platformCatalog.ts@@ -30,9 +30,9 @@ import {BUILTIN_PLAYABLE_PROFILES, builtinPlayableProfile, genericPlayableProfile,type PlayableAdProfile,} from './playableAdProfile';-import { BUILTIN_PLATFORMS, DESKTOP_OSES, desktopTemplateFor, type PlatformPrereq } from '../../pipeline/src/project/platforms';+import { BUILTIN_PLATFORMS, DESKTOP_OSES, desktopTemplateFor, type PlatformPrereq } from '../project/platforms';import { resolveNativeTemplate } from './nativeTemplates';-import { templateId } from '../../build-tools/utils/nativeTemplate.js';+import { templateId } from '../../../build-tools/utils/nativeTemplate.js';import type { MiniGameExportProfile, MiniGameConfigContext } from './miniGameExportProfile';/** Where a project keeps its own platform profiles. */diff --git a/desktop/electron/playableAdProfile.ts b/pipeline/src/export/playableAdProfile.tssimilarity index 100%rename from desktop/electron/playableAdProfile.tsrename to pipeline/src/export/playableAdProfile.tsdiff --git a/desktop/electron/projectModules.ts b/pipeline/src/export/projectModules.tssimilarity index 98%rename from desktop/electron/projectModules.tsrename to pipeline/src/export/projectModules.tsindex ff07b63b0..5f288afc7 100644--- a/desktop/electron/projectModules.ts+++ b/pipeline/src/export/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 '../../pipeline/src/project/platforms';+import { isNativePlatform, type ExportPlatform } from '../project/platforms';/** Where a project keeps them. */export const PROJECT_MODULES_DIR = path.join('.esengine', 'modules');diff --git a/desktop/electron/sizeReport.ts b/pipeline/src/export/sizeReport.tssimilarity index 99%rename from desktop/electron/sizeReport.tsrename to pipeline/src/export/sizeReport.tsindex 6f6a02f89..faf7721e4 100644--- a/desktop/electron/sizeReport.ts+++ b/pipeline/src/export/sizeReport.ts@@ -25,11 +25,11 @@*/import { readFile, stat, readdir } from 'node:fs/promises';import path from 'node:path';-import type { ExportPlatform } from '../../pipeline/src/project/platforms';+import type { ExportPlatform } from '../project/platforms';import {evaluateSizeBudget, resolveSizeBudgets,type SizeBudget, type SizeVerdict,-} from '../../pipeline/src/project/sizeBudget';+} from '../project/sizeBudget';/** Where a file sits in the delivery model — see the file header. */export type SizeBucket = 'initial' | 'lazy' | 'remote';diff --git a/pipeline/src/index.ts b/pipeline/src/index.tsindex e1fc60080..20a01e742 100644--- a/pipeline/src/index.ts+++ b/pipeline/src/index.ts@@ -19,3 +19,18 @@ export * from './assets/assetMeta';export * from './assets/assetDb';export * from './assets/cookAssets';export * from './assets/addressableManifest';+export * from './bundle/importMap';+export * from './bundle/esengineResolve';+export * from './bundle/bundleDiagnostics';+export * from './bundle/buildScripts';+export * from './bundle/buildOpenData';+export * from './bundle/sideModuleScan';+export * from './export/exportGame';+export * from './export/exportProgress';+export * from './export/platformCatalog';+export * from './export/projectModules';+export * from './export/miniGameExportProfile';+export * from './export/playableAdProfile';+export * from './export/orientationHtml';+export * from './export/nativeTemplates';+export * from './export/sizeReport';diff --git a/desktop/src/gameHost.ts b/pipeline/src/runtime/gameHost.tssimilarity index 100%rename from desktop/src/gameHost.tsrename to pipeline/src/runtime/gameHost.tsdiff --git a/desktop/src/playableHost.ts b/pipeline/src/runtime/playableHost.tssimilarity index 98%rename from desktop/src/playableHost.tsrename to pipeline/src/runtime/playableHost.tsindex 8fdfc6851..8591b36be 100644--- a/desktop/src/playableHost.ts+++ b/pipeline/src/runtime/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 '../../pipeline/src/project/runtimeConfig';+import type { PackagedRuntimeFields } from '../project/runtimeConfig';type EngineFactory = (opts?: Record<string, unknown>) => Promise<EngineModule>;// Inlined by exportPlayable as <script> globals (kept out of the bundle so the