Skip to content

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.

feat(pipeline): every bundle of a project's scripts resolves the official packages

esengine1642237e1db1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee218b733..3470527e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ published separately; it ships inside the editor.
### Fixed
+- **Sharing, in-game purchase, the friends leaderboard and the recorder can be used at all.** They live in `estella-plugin-minigame-services`, which every doc page said to `npm install` — and it is on no registry, so the command failed and a project that imported it failed to build, in play and in every export. The editor already carried the package; now every bundle of a project's scripts resolves `estella-plugin-*` to that copy (play, web, desktop, native, WeChat, Douyin, playable, the open data context and component extraction), and the editor's script checking and the built-in agent see its types. A copy the project installs into its own `node_modules` still takes precedence, and an unknown `estella-plugin-*` names the ones that do ship.
- The agent drawer's History button shows it is open with a grey press again, not the accent colour 0.71 gave it.
## [0.71.0] - 2026-09-23
diff --git a/desktop b/desktop
index 16fead3d7..f4428e854 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 16fead3d76ad8b8bd2edef538eafe34e6aef4813
+Subproject commit f4428e854a72836bf5e1c0483274a3d5927f0992
diff --git a/docs/astro/src/content/docs/publishing/ads-sharing.mdx b/docs/astro/src/content/docs/publishing/ads-sharing.mdx
index 5584bf146..6d15920bf 100644
--- a/docs/astro/src/content/docs/publishing/ads-sharing.mdx
+++ b/docs/astro/src/content/docs/publishing/ads-sharing.mdx
@@ -69,11 +69,9 @@ installed provider. Use it to hide the "watch ad" button honestly:
## Sharing
Sharing and [in-game purchase](#in-game-purchase) ship as a package rather than
-inside the engine — most games open neither:
-
-```bash
-npm install estella-plugin-minigame-services
-```
+inside the engine — most games open neither. The editor carries it, so there is
+nothing to install: import it, in play and in every export. (A copy the project
+installs into its own `node_modules` takes precedence over the editor's.)
```typescript title="src/main.ts"
import { addPlugin } from 'esengine';
@@ -167,12 +165,9 @@ host starts beside your game, with no engine, no WebGL and no wasm in it — and
there is no channel back from that runtime to yours. So the board is drawn
*over there* and arrives here as pixels.
-It ships as a package rather than in the engine, because a game that never opens
-one should not carry a renderer for it:
-
-```bash
-npm install estella-plugin-minigame-services
-```
+It ships in the same package as sharing (which the editor carries — nothing to
+install), rather than in the engine, because a game that never opens one should
+not carry a renderer for it.
The API says the host's constraint out loud rather than hiding it:
diff --git a/docs/astro/src/content/docs/zh-cn/publishing/ads-sharing.mdx b/docs/astro/src/content/docs/zh-cn/publishing/ads-sharing.mdx
index d39c6ff74..ddcee7718 100644
--- a/docs/astro/src/content/docs/zh-cn/publishing/ads-sharing.mdx
+++ b/docs/astro/src/content/docs/zh-cn/publishing/ads-sharing.mdx
@@ -61,11 +61,9 @@ const reviveSystem = defineSystem([Res(Ads), GetWorld()], (ads, world) => {
## 分享
-分享和[内购](#内购)以包的形式发布,不在引擎里——大多数游戏两个都不会打开:
-
-```bash
-npm install estella-plugin-minigame-services
-```
+分享和[内购](#内购)以包的形式发布,不在引擎里——大多数游戏两个都不会打开。这个包由
+编辑器自带,不用安装:直接 import,Play 和所有导出都能解析到。(项目自己装进
+`node_modules` 的副本优先于编辑器自带的。)
```typescript title="src/main.ts"
import { addPlugin } from 'esengine';
@@ -150,12 +148,8 @@ if (recorder.canShare) await recorder.share({ title: '看我这一局' });
WebGL、也没有 wasm——而且它没有回到你这边的通道。所以榜是**在那边画的**,到你
这边时已经是像素。
-它以**包**的形式发布而不是待在引擎里:一个从不开排行榜的游戏,不该背着一份榜的
-渲染器。
-
-```bash
-npm install estella-plugin-minigame-services
-```
+它和分享在同一个包里(编辑器自带,不用安装),而不是待在引擎里:一个从不开排行榜的
+游戏,不该背着一份榜的渲染器。
API 把宿主的这条约束直说,而不是遮掩:
diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjs
index 1454f67f1..ad7d3421c 100644
--- a/pipeline/bin/estella.mjs
+++ b/pipeline/bin/estella.mjs
@@ -787,6 +787,7 @@ try {
entryScene,
scriptsEntry,
hostsDir: path.join(PIPELINE, 'src', 'runtime'),
+ packagesDir: path.join(REPO, 'plugins'),
sdkDistDir: path.join(REPO, 'sdk', 'dist'),
wasmDir: opts.wasm ? path.resolve(opts.wasm) : engineRuntimeDir(platform),
outDir,
diff --git a/pipeline/src/bundle/buildOpenData.ts b/pipeline/src/bundle/buildOpenData.ts
index 525c45475..7face2f2e 100644
--- a/pipeline/src/bundle/buildOpenData.ts
+++ b/pipeline/src/bundle/buildOpenData.ts
@@ -14,6 +14,7 @@
import { existsSync } from 'node:fs';
import path from 'node:path';
import { loadEsbuild } from './esbuildRuntime';
+import { officialPackagesPlugin } from './officialPackages';
import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';
/** Same directory name the exporter reads, and the same entry candidates. */
@@ -36,7 +37,7 @@ export interface BuildOpenDataResult {
* A project with no context directory is `ok` with a null path — most games have
* none, and that is not a failure. Never throws.
*/
-export async function buildOpenDataContext(root: string): Promise<BuildOpenDataResult> {
+export async function buildOpenDataContext(root: string, opts: { packagesDir: string }): Promise<BuildOpenDataResult> {
const entry = ENTRIES
.map((f) => path.join(root, OPEN_DATA_DIR, f))
.find((f) => existsSync(f));
@@ -54,6 +55,7 @@ export async function buildOpenDataContext(root: string): Promise<BuildOpenDataR
format: 'iife',
platform: 'browser',
target: 'es2020',
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
outfile: outputPath,
sourcemap: false,
write: true,
diff --git a/pipeline/src/bundle/buildScripts.ts b/pipeline/src/bundle/buildScripts.ts
index 68a549a49..2a93974f0 100644
--- a/pipeline/src/bundle/buildScripts.ts
+++ b/pipeline/src/bundle/buildScripts.ts
@@ -17,6 +17,7 @@ import { existsSync } from 'node:fs';
import path from 'node:path';
import { loadEsbuild } from './esbuildRuntime';
import { explainBundleErrors, type BundleMessage } from './bundleDiagnostics';
+import { officialPackagesPlugin } from './officialPackages';
/** esengine and any subpath import are left for the realm's import map to resolve. */
const EXTERNAL = ['esengine', 'esengine/*'];
@@ -41,9 +42,9 @@ export interface BuildScriptsResult {
*/
export async function buildProjectScripts(
root: string,
- opts?: { entry?: string },
+ opts: { entry?: string; packagesDir: string },
): Promise<BuildScriptsResult> {
- const entryPath = path.join(root, opts?.entry ?? DEFAULT_ENTRY);
+ const entryPath = path.join(root, opts.entry ?? DEFAULT_ENTRY);
if (!existsSync(entryPath)) {
return { ok: false, outputPath: null, errors: [`script entry not found: ${entryPath}`], warnings: [] };
}
@@ -57,6 +58,7 @@ export async function buildProjectScripts(
platform: 'browser',
target: 'es2020',
external: EXTERNAL,
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
outfile: outputPath,
sourcemap: true,
write: true,
diff --git a/pipeline/src/bundle/officialPackages.ts b/pipeline/src/bundle/officialPackages.ts
new file mode 100644
index 000000000..57c8668ad
--- /dev/null
+++ b/pipeline/src/bundle/officialPackages.ts
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file The official runtime packages (`estella-plugin-*`) resolve to the copy
+ * the editor ships, for every bundle a project's scripts go into.
+ *
+ * They are not on any registry: the editor carries `plugins/` beside itself, so
+ * `import … from 'estella-plugin-minigame-services'` has to be answered here or
+ * nowhere. A copy the project installed into its own node_modules still wins —
+ * that is a choice someone made, and the built-in one is only the default.
+ */
+import { existsSync, readdirSync, readFileSync } from 'node:fs';
+import path from 'node:path';
+import type { Plugin } from 'esbuild';
+
+const OFFICIAL = /^(estella-plugin-[^/]+)(\/.+)?$/;
+
+/** A package name → its export subpath ('.', './open-data') → absolute entry file. */
+export type OfficialPackages = ReadonlyMap<string, ReadonlyMap<string, string>>;
+
+const cache = new Map<string, OfficialPackages>();
+
+export function readOfficialPackages(packagesDir: string): OfficialPackages {
+ const hit = cache.get(packagesDir);
+ if (hit) return hit;
+ const out = new Map<string, Map<string, string>>();
+ const entries = existsSync(packagesDir) ? readdirSync(packagesDir, { withFileTypes: true }) : [];
+ for (const entry of entries) {
+ if (!entry.isDirectory()) continue;
+ const dir = path.join(packagesDir, entry.name);
+ const manifest = path.join(dir, 'package.json');
+ if (!existsSync(manifest)) continue;
+ const pkg = JSON.parse(readFileSync(manifest, 'utf8')) as {
+ name?: string; main?: string; exports?: string | Record<string, string>;
+ };
+ if (!pkg.name || !OFFICIAL.test(pkg.name)) continue;
+ const exportsMap = typeof pkg.exports === 'string' ? { '.': pkg.exports }
+ : pkg.exports ?? (pkg.main ? { '.': pkg.main } : {});
+ const subpaths = new Map<string, string>();
+ for (const [sub, rel] of Object.entries(exportsMap)) subpaths.set(sub, path.join(dir, rel));
+ out.set(pkg.name, subpaths);
+ }
+ cache.set(packagesDir, out);
+ return out;
+}
+
+const SKIP = Symbol('official-packages:skip');
+
+/** esbuild plugin: `estella-plugin-*` from the project's node_modules if it has
+ * one, otherwise from `packagesDir`. */
+export function officialPackagesPlugin(packagesDir: string): Plugin {
+ return {
+ name: 'estella-official-packages',
+ setup(build) {
+ build.onResolve({ filter: OFFICIAL }, async (args) => {
+ if (args.pluginData === SKIP) return undefined;
+ const own = await build.resolve(args.path, {
+ kind: args.kind, importer: args.importer, resolveDir: args.resolveDir, pluginData: SKIP,
+ });
+ if (own.errors.length === 0) return { path: own.path, external: own.external, sideEffects: own.sideEffects };
+
+ const [, name, rest] = OFFICIAL.exec(args.path)!;
+ const packages = readOfficialPackages(packagesDir);
+ const subpaths = packages.get(name);
+ if (!subpaths) {
+ return { errors: [{ text: `"${name}" is not one of the packages the editor ships (${[...packages.keys()].join(', ') || 'none found'}), and the project has not installed it` }] };
+ }
+ const entry = subpaths.get(rest ? `.${rest}` : '.');
+ if (!entry) {
+ return { errors: [{ text: `"${name}" exports no "${rest ? `.${rest}` : '.'}" — it exports ${[...subpaths.keys()].join(', ')}` }] };
+ }
+ return { path: entry };
+ });
+ },
+ };
+}
diff --git a/pipeline/src/export/exportGame.ts b/pipeline/src/export/exportGame.ts
index 5492c2716..aebc50ba7 100644
--- a/pipeline/src/export/exportGame.ts
+++ b/pipeline/src/export/exportGame.ts
@@ -48,6 +48,7 @@ import { exportPlayable } from './exportPlayable';
import { genericPlayableProfile, type PlayableAdProfile } from './playableAdProfile';
import type { OnExportProgress } from './exportProgress';
import { ESENGINE_EXTERNAL, ESENGINE_SUBPATHS } from '../bundle/esengineResolve';
+import { officialPackagesPlugin } from '../bundle/officialPackages';
import { buildCompiledSystems, type BuildMode } from '../bundle/buildCompiledSystems';
import { resolveEmcc, runEmcc } from '../bundle/emccPath';
import { findHostCC } from '../../../compiler/src/hostCC';
@@ -418,6 +419,9 @@ export interface ExportGameOptions {
/** Where every runtime host is (runtimeHosts.ts): `pipeline/src/runtime`, or the
* tree an editor prebuilt from it, since a packaged app ships no sources. */
hostsDir: string;
+ /** The official `estella-plugin-*` packages the editor ships (`plugins/`);
+ * a project's scripts resolve them from here. */
+ packagesDir: string;
/** Project-relative startup entry (e.g. src/main.ts) → bundled to scripts.mjs. */
scriptsEntry?: string;
sdkDistDir: string;
@@ -670,6 +674,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
wasmDir: opts.wasmDir,
outDir: opts.outDir,
hostsDir: opts.hostsDir,
+ packagesDir: opts.packagesDir,
title,
appid: opts.miniGameAppid,
features: opts.features,
@@ -704,6 +709,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
wasmDir: opts.wasmDir,
outDir: opts.outDir,
hostsDir: opts.hostsDir,
+ packagesDir: opts.packagesDir,
title,
appid: opts.miniGameAppid,
features: opts.features,
@@ -731,6 +737,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
entryScene: opts.entryScene,
scriptsEntry: opts.scriptsEntry,
hostsDir: opts.hostsDir,
+ packagesDir: opts.packagesDir,
sdkDir: opts.sdkDistDir,
wasmDir: opts.wasmDir,
outDir: opts.outDir,
@@ -786,6 +793,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
platform: 'browser',
target: 'es2020',
external: ESENGINE_EXTERNAL,
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
minify: opts.minify ?? false,
sourcemap: sourceMaps,
write: true,
@@ -884,7 +892,8 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
progress({ phase: 'Bundling project scripts' });
const proj = nativeContent
? await build({
- ...common, format: 'iife', external: [], plugins: [esengineGlobalPlugin()],
+ ...common, format: 'iife', external: [],
+ plugins: [esengineGlobalPlugin(), officialPackagesPlugin(opts.packagesDir)],
entryPoints: [scriptsAbs], outfile: path.join(payloadDir, 'scripts.js'),
})
: await build({ ...common, entryPoints: [scriptsAbs], outfile: path.join(payloadDir, 'scripts.mjs') });
diff --git a/pipeline/src/export/exportMiniGame.ts b/pipeline/src/export/exportMiniGame.ts
index 8b3c0c23c..b06b52e60 100644
--- a/pipeline/src/export/exportMiniGame.ts
+++ b/pipeline/src/export/exportMiniGame.ts
@@ -45,6 +45,7 @@ import type { OnExportProgress } from './exportProgress';
import { runtimeHostEntry } from '../bundle/runtimeHosts';
import { breakdownOf, type ModuleBytes } from './bundleBreakdown';
import { esengineAlias } from '../bundle/esengineResolve';
+import { officialPackagesPlugin } from '../bundle/officialPackages';
import { explainBundleErrors, type BundleMessage } from '../bundle/bundleDiagnostics';
import { scanSideModuleIds, sideModuleFiles, textureDecoderBytes } from '../bundle/sideModuleScan';
import { OPEN_DATA_DIR, isEsModule } from './miniGameExportProfile';
@@ -254,6 +255,9 @@ export async function exportMiniGame(profile: MiniGameExportProfile, opts: {
/** Where the runtime hosts live — sources in dev, a prebuilt tree in a packaged
* editor. A built-in vendor's platform profile is resolved against it. */
hostsDir: string;
+ /** The official `estella-plugin-*` packages the editor ships (`plugins/`);
+ * a project's scripts resolve them from here. */
+ packagesDir: string;
title?: string;
/** MiniGame appid (Project Settings) → project config. */
appid?: string;
@@ -531,6 +535,7 @@ export async function exportMiniGame(profile: MiniGameExportProfile, opts: {
// devtools accepts it; es2017 down-levels those while keeping async/await.
target: profile.esTarget,
alias: esengineAlias(opts.sdkDir, lean ? leanEntry! : profile.sdkEntryFile),
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
minify: opts.minify ?? false,
sourcemap: false,
outfile: path.join(absOut, 'game-bundle.js'),
@@ -575,6 +580,7 @@ export async function exportMiniGame(profile: MiniGameExportProfile, opts: {
// Same syntax floor as the game bundle: the host compiles EVERY .js in
// the package, this one included.
target: profile.esTarget,
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
minify: opts.minify ?? false,
sourcemap: false,
outfile: path.join(absOut, OPEN_DATA_DIR, 'index.js'),
diff --git a/pipeline/src/export/exportPlayable.ts b/pipeline/src/export/exportPlayable.ts
index 3a82cd131..46125b11b 100644
--- a/pipeline/src/export/exportPlayable.ts
+++ b/pipeline/src/export/exportPlayable.ts
@@ -30,6 +30,7 @@ import path from 'node:path';
import { cookAssets } from '../assets/cookAssets';
import type { OnExportProgress } from './exportProgress';
import { esengineAlias } from '../bundle/esengineResolve';
+import { officialPackagesPlugin } from '../bundle/officialPackages';
import { explainBundleErrors, type BundleMessage } from '../bundle/bundleDiagnostics';
import type { ScreenOrientation } from './orientationHtml';
import { genericPlayableProfile, playableAdInjection, type PlayableAdProfile } from './playableAdProfile';
@@ -192,6 +193,9 @@ export async function exportPlayable(opts: {
entryScene: string;
scriptsEntry?: string;
hostsDir: string;
+ /** The official `estella-plugin-*` packages the editor ships (`plugins/`);
+ * a project's scripts resolve them from here. */
+ packagesDir: string;
/** Web SDK dist dir — `esengine` is INLINED for playable (no import map), so the
* bundle aliases it here (the project root has no esengine to resolve). */
sdkDir: string;
@@ -301,6 +305,7 @@ export async function exportPlayable(opts: {
// esengine is INLINED (single-file, no import map) → resolve it from the SDK
// dist; the project root has no esengine installed.
alias: esengineAlias(opts.sdkDir),
+ plugins: [officialPackagesPlugin(opts.packagesDir)],
minify: opts.minify ?? true,
write: false,
outfile: 'game-bundle.js',
diff --git a/pipeline/tests/build-scripts.test.ts b/pipeline/tests/build-scripts.test.ts
index 4d3552499..7cca110d3 100644
--- a/pipeline/tests/build-scripts.test.ts
+++ b/pipeline/tests/build-scripts.test.ts
@@ -11,6 +11,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync
import { tmpdir } from 'node:os';
import path from 'node:path';
import { buildProjectScripts } from '../src/bundle/buildScripts';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
@@ -38,7 +39,7 @@ afterAll(() => {
describe('buildProjectScripts (E8-1)', () => {
it('bundles src/main.ts with esengine external and local modules inlined', async () => {
- const res = await buildProjectScripts(root);
+ const res = await buildProjectScripts(root, { packagesDir: OFFICIAL_PACKAGES });
expect(res.ok).toBe(true);
expect(res.errors).toEqual([]);
expect(res.outputPath).toBe(path.join(root, '.esengine/cache/scripts.mjs'));
@@ -80,7 +81,7 @@ describe('buildProjectScripts (E8-1)', () => {
`import { DemoService } from 'estella-plugin-demo';\nvoid DemoService;\n`,
);
- const res = await buildProjectScripts(proj);
+ const res = await buildProjectScripts(proj, { packagesDir: OFFICIAL_PACKAGES });
expect(res.errors).toEqual([]);
expect(res.ok).toBe(true);
const out = readFileSync(res.outputPath!, 'utf8');
@@ -94,7 +95,7 @@ describe('buildProjectScripts (E8-1)', () => {
it('reports a clean failure when the entry is missing', async () => {
const empty = mkdtempSync(path.join(tmpdir(), 'estella-empty-'));
try {
- const res = await buildProjectScripts(empty);
+ const res = await buildProjectScripts(empty, { packagesDir: OFFICIAL_PACKAGES });
expect(res.ok).toBe(false);
expect(res.outputPath).toBeNull();
expect(res.errors.join(' ')).toMatch(/entry not found/);
diff --git a/pipeline/tests/cooked-verify-fixture.test.ts b/pipeline/tests/cooked-verify-fixture.test.ts
index 28aacb659..c2718f65d 100644
--- a/pipeline/tests/cooked-verify-fixture.test.ts
+++ b/pipeline/tests/cooked-verify-fixture.test.ts
@@ -11,6 +11,7 @@ import { mkdirSync, writeFileSync, copyFileSync, rmSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const OUT = path.resolve(HERE, '..', '.cooked-verify');
@@ -124,7 +125,7 @@ describe.skipIf(!process.env.ESTELLA_COOK_FIXTURE)('cooked-verify fixture', () =
const res = await exportGame({
root: SRC,
entryScene: 'scenes/main.esscene',
- hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'),
+ hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'), packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.resolve(HERE, '..', '..', 'sdk', 'dist'),
wasmDir: path.resolve(HERE, '..', '..', 'build', 'wasm', 'web'),
@@ -139,7 +140,7 @@ describe.skipIf(!process.env.ESTELLA_COOK_FIXTURE)('cooked-verify fixture', () =
const interp = await exportGame({
root: SRC,
entryScene: 'scenes/main.esscene',
- hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'),
+ hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'), packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.resolve(HERE, '..', '..', 'sdk', 'dist'),
wasmDir: path.resolve(HERE, '..', '..', 'build', 'wasm', 'web'),
diff --git a/pipeline/tests/export-aot.test.ts b/pipeline/tests/export-aot.test.ts
index 4ad1f673d..efcb583bd 100644
--- a/pipeline/tests/export-aot.test.ts
+++ b/pipeline/tests/export-aot.test.ts
@@ -16,6 +16,7 @@ import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
import { emccPath } from '../../build-tools/utils/emscripten.js';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
@@ -73,7 +74,7 @@ function setup(files: Record<string, string>): { root: string; out: string } {
}
const run = (f: { root: string; out: string }) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out,
diff --git a/pipeline/tests/export-compiled-systems.test.ts b/pipeline/tests/export-compiled-systems.test.ts
index 8b80a8e9a..27431beb5 100644
--- a/pipeline/tests/export-compiled-systems.test.ts
+++ b/pipeline/tests/export-compiled-systems.test.ts
@@ -23,6 +23,7 @@ import { resolveEmcc } from '../src/bundle/emccPath';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
import { miniGameSdkStub } from './fixtures/miniGameSdkStub';
import { wechatExportProfile } from '../src/export/miniGameExportProfile';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', 'src', 'runtime');
@@ -87,7 +88,7 @@ function project(source: string | null): { root: string; out: string } {
}
const run = (f: { root: string; out: string }) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out,
@@ -97,7 +98,7 @@ const config = (out: string): PackagedGameConfig =>
JSON.parse(readFileSync(path.join(out, 'game.config.json'), 'utf8')) as PackagedGameConfig;
const runWeChat = (f: { root: string; out: string }) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: 'unused-for-wechat',
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts', platform: 'wechat', miniGameAppid: 'wxTEST0123456789',
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out,
diff --git a/pipeline/tests/export-desktop.test.ts b/pipeline/tests/export-desktop.test.ts
index 30175b12b..2894521c8 100644
--- a/pipeline/tests/export-desktop.test.ts
+++ b/pipeline/tests/export-desktop.test.ts
@@ -15,6 +15,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime');
@@ -63,7 +64,7 @@ function fakeTemplate(os: 'macos' | 'windows'): string {
const desktopExport = (outDir: string) => ({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
@@ -77,7 +78,7 @@ describe('exportGame (desktop)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
@@ -188,7 +189,7 @@ describe('exportGame (desktop)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
diff --git a/pipeline/tests/export-douyin.test.ts b/pipeline/tests/export-douyin.test.ts
index f1caf6cd7..bf9c88294 100644
--- a/pipeline/tests/export-douyin.test.ts
+++ b/pipeline/tests/export-douyin.test.ts
@@ -15,6 +15,7 @@ import { tmpdir } from 'node:os';
import path from 'node:path';
import { exportGame } from '../src/export/exportGame';
import { builtinSizeBudgets } from '../src/project/sizeBudget';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
let out: string;
@@ -58,7 +59,7 @@ describe('exportGame (douyin)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: path.resolve(__dirname, '../src/runtime'),
+ hostsDir: path.resolve(__dirname, '../src/runtime'), packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
outDir: out,
@@ -114,7 +115,7 @@ describe('exportGame (douyin)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: path.resolve(__dirname, '../src/runtime'),
+ hostsDir: path.resolve(__dirname, '../src/runtime'), packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: esmRoot,
outDir: path.join(root, 'dist-douyin-esm'),
diff --git a/pipeline/tests/export-engine-installs.test.ts b/pipeline/tests/export-engine-installs.test.ts
index 9355f530f..c04b36366 100644
--- a/pipeline/tests/export-engine-installs.test.ts
+++ b/pipeline/tests/export-engine-installs.test.ts
@@ -18,6 +18,7 @@ import { exportGame } from '../src/export/exportGame';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
import type { ModuleChoice } from '../src/project/format';
import { moduleOfComponent } from '../src/project/targetSupport';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', 'src', 'runtime');
@@ -52,7 +53,7 @@ function setup(components: string[]): { root: string; out: string } {
}
const run = (f: { root: string; out: string }) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out,
});
@@ -140,7 +141,7 @@ describe('a web package whose project excluded a module', () => {
...setup(components), features: { modules },
});
const runWith = (f: ReturnType<typeof withChoice>) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out, features: f.features,
});
diff --git a/pipeline/tests/export-native.test.ts b/pipeline/tests/export-native.test.ts
index 41f706aa8..dac23f415 100644
--- a/pipeline/tests/export-native.test.ts
+++ b/pipeline/tests/export-native.test.ts
@@ -14,6 +14,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime');
@@ -50,7 +51,7 @@ afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retr
describe('exportGame (native app content)', () => {
it('ships content only — cooked assets, manifests, scene, config', async () => {
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'), outDir: out,
platform: 'android', title: 'NativeGame',
});
diff --git a/pipeline/tests/export-playable.test.ts b/pipeline/tests/export-playable.test.ts
index f4575b896..5cf734459 100644
--- a/pipeline/tests/export-playable.test.ts
+++ b/pipeline/tests/export-playable.test.ts
@@ -19,6 +19,7 @@ import { exportGame } from '../src/export/exportGame';
import { runtimeHostPrebuild } from '../src/bundle/runtimeHosts';
import { build } from 'esbuild';
import { inflateRaw } from '../src/runtime/inflate';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
/**
* Read an inlined payload back out of the page, the way the host does.
@@ -93,7 +94,7 @@ describe('exportGame (playable)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
@@ -155,7 +156,7 @@ describe('exportGame (playable)', () => {
await build({ ...runtimeHostPrebuild(HOSTS, prebuilt), logLevel: 'silent' });
const dir = path.join(root, 'dist-prebuilt');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: prebuilt, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: prebuilt, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: dir, platform: 'playable', minify: false,
});
@@ -175,7 +176,7 @@ describe('exportGame (playable)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
@@ -198,7 +199,7 @@ describe('exportGame (playable)', () => {
it('injects the ad network profile head + CTA bridge, and warns against ITS limit', async () => {
const o = path.join(root, 'dist-playable-network');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: o, platform: 'playable',
playableAdProfile: {
@@ -233,7 +234,7 @@ describe('exportGame (playable)', () => {
it('writes playable.zip for a zip-delivery network and measures that', async () => {
const o = path.join(root, 'dist-playable-zip');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: o, platform: 'playable',
playableAdProfile: {
@@ -265,7 +266,7 @@ describe('exportGame (playable)', () => {
it('injects nothing and keeps the default cap with no network selected', async () => {
const o = path.join(root, 'dist-playable-generic');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: o, platform: 'playable',
});
@@ -285,7 +286,7 @@ describe('exportGame (playable)', () => {
it('inlines the project camera fit as __GAME_SCREENFIT__ (only when opted in)', async () => {
const o = path.join(root, 'dist-playable-fit');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: o, platform: 'playable',
runtime: runtimeConfigOf({
@@ -308,7 +309,7 @@ describe('exportGame (playable)', () => {
it('does not pin the page even when the project is portrait', async () => {
const o = path.join(root, 'dist-playable-portrait');
const res = await exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, scriptsEntry: 'src/main.ts',
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES, scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir: o, title: 'Playable Demo', platform: 'playable', orientation: 'portrait',
playableAdProfile: {
@@ -356,7 +357,7 @@ export function packagedRuntimeInit(c){return c;}\n`);
}
const run = (r: string, o: string) => exportGame({
- root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(r, '_sdk'), wasmDir: path.join(r, '_wasm'), outDir: o, platform: 'playable',
});
@@ -369,7 +370,7 @@ export function packagedRuntimeInit(c){return c;}\n`);
writeFileSync(path.join(r, 'scenes', 'main.esscene'),
JSON.stringify({ version: '1.0', name: 'Main', entities: [{ id: 0, components: [] }] }));
const res = await exportGame({
- root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(r, '_sdk'), wasmDir: path.join(r, '_wasm'), outDir: o, platform: 'playable',
// The project's declaration, which is what the build reads; `runtime` is
// the packaged game's copy of the same manifest, not a second authority.
@@ -460,7 +461,7 @@ export function packagedRuntimeInit(c){return c;}\n`);
}
const run = (r: string, o: string) => exportGame({
- root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: r, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(r, '_sdk'), wasmDir: path.join(r, '_wasm'), outDir: o, platform: 'playable',
});
diff --git a/pipeline/tests/export-progress.test.ts b/pipeline/tests/export-progress.test.ts
index e42e59aa9..68c5fbd8f 100644
--- a/pipeline/tests/export-progress.test.ts
+++ b/pipeline/tests/export-progress.test.ts
@@ -12,6 +12,7 @@ import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import type { ExportProgress } from '../src/export/exportProgress';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime');
@@ -46,7 +47,7 @@ describe('export progress', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
@@ -71,7 +72,7 @@ describe('export progress', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: HOSTS,
+ hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
diff --git a/pipeline/tests/export-project-platform.test.ts b/pipeline/tests/export-project-platform.test.ts
index de533c188..2a4db0954 100644
--- a/pipeline/tests/export-project-platform.test.ts
+++ b/pipeline/tests/export-project-platform.test.ts
@@ -17,6 +17,7 @@ import { tmpdir } from 'node:os';
import path from 'node:path';
import { exportGame } from '../src/export/exportGame';
import { loadProjectPlatform } from '../src/export/platformCatalog';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const TEX = '11111111-1111-4111-8111-111111111111';
const SCN = '22222222-2222-4222-8222-222222222222';
@@ -91,7 +92,7 @@ describe('exportGame — a platform the project defines', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused',
+ hostsDir: 'unused', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: platform!.wasmDir,
outDir: out,
@@ -140,7 +141,7 @@ describe('exportGame — a platform the project defines', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused',
+ hostsDir: 'unused', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
outDir: outBare,
diff --git a/pipeline/tests/export-side-modules.test.ts b/pipeline/tests/export-side-modules.test.ts
index a72d02a19..35f02f8da 100644
--- a/pipeline/tests/export-side-modules.test.ts
+++ b/pipeline/tests/export-side-modules.test.ts
@@ -12,6 +12,7 @@ import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import { runtimeConfigOf } from '../src/project/runtimeConfig';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime');
@@ -53,7 +54,7 @@ const run = (
runtime?: Parameters<typeof exportGame>[0]['runtime'],
features?: Parameters<typeof exportGame>[0]['features'],
) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out, ...(runtime ? { runtime } : {}), ...(features ? { features } : {}),
});
diff --git a/pipeline/tests/export-source-maps.test.ts b/pipeline/tests/export-source-maps.test.ts
index 9218d6ddb..b9b0541c1 100644
--- a/pipeline/tests/export-source-maps.test.ts
+++ b/pipeline/tests/export-source-maps.test.ts
@@ -11,6 +11,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const HOSTS = path.join(HERE, '..', '..', 'pipeline', 'src', 'runtime');
@@ -41,7 +42,7 @@ function setup(): { root: string; out: string } {
}
const run = (f: { root: string; out: string }, sourcemap?: boolean) => exportGame({
- root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root: f.root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(f.root, '_sdk'), wasmDir: path.join(f.root, '_wasm'),
outDir: f.out, ...(sourcemap === undefined ? {} : { sourcemap }),
});
diff --git a/pipeline/tests/export-splash.test.ts b/pipeline/tests/export-splash.test.ts
index df7f50a75..3c81a1ad7 100644
--- a/pipeline/tests/export-splash.test.ts
+++ b/pipeline/tests/export-splash.test.ts
@@ -15,6 +15,7 @@ import { exportGame } from '../src/export/exportGame';
import { runtimeConfigOf } from '../src/project/runtimeConfig';
import type { ProjectPackaging } from '../src/project/format';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
const TEX = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
@@ -54,7 +55,7 @@ async function page(splash?: ProjectPackaging['splash']): Promise<{ html: string
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: path.resolve(__dirname, '../src/runtime'),
+ hostsDir: path.resolve(__dirname, '../src/runtime'), packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wasm'),
outDir,
diff --git a/pipeline/tests/export-wechat-audio-src.test.ts b/pipeline/tests/export-wechat-audio-src.test.ts
index c3286b2df..b91d15fc9 100644
--- a/pipeline/tests/export-wechat-audio-src.test.ts
+++ b/pipeline/tests/export-wechat-audio-src.test.ts
@@ -18,6 +18,7 @@ import { extractUuid } from '../../sdk/src/asset/AssetRegistry';
import type { AddressableManifest } from '../../sdk/src/asset/AddressableManifest';
import { miniGameSdkStub } from './fixtures/miniGameSdkStub';
import { wechatExportProfile } from '../src/export/miniGameExportProfile';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
let out: string;
@@ -73,7 +74,7 @@ describe('the source a cooked mini-game hands its audio player', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
outDir: out,
diff --git a/pipeline/tests/export-wechat-read-paths.test.ts b/pipeline/tests/export-wechat-read-paths.test.ts
index dcf2ce0bc..58afdecaa 100644
--- a/pipeline/tests/export-wechat-read-paths.test.ts
+++ b/pipeline/tests/export-wechat-read-paths.test.ts
@@ -26,6 +26,7 @@ import { exportGame } from '../src/export/exportGame';
import { ManifestModel, type AddressableManifest } from '../../sdk/src/asset/AddressableManifest';
import { miniGameSdkStub } from './fixtures/miniGameSdkStub';
import { wechatExportProfile } from '../src/export/miniGameExportProfile';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const TEX = 'dddddddd-dddd-dddd-dddd-dddddddddddd';
const MAT = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee';
@@ -87,7 +88,7 @@ describe('exportGame (wechat) — every asset resolves to a file the package car
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
diff --git a/pipeline/tests/export-wechat-subpackage.test.ts b/pipeline/tests/export-wechat-subpackage.test.ts
index 055a1d58b..8b21153fe 100644
--- a/pipeline/tests/export-wechat-subpackage.test.ts
+++ b/pipeline/tests/export-wechat-subpackage.test.ts
@@ -17,6 +17,7 @@ import path from 'node:path';
import { exportGame } from '../src/export/exportGame';
import { miniGameSdkStub } from './fixtures/miniGameSdkStub';
import { wechatExportProfile } from '../src/export/miniGameExportProfile';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
let out: string;
@@ -62,7 +63,7 @@ describe('WeChat 分包 declared through asset-groups.json', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -124,7 +125,7 @@ describe('WeChat 分包 declared through asset-groups.json', () => {
const res = await exportGame({
root: root2,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root2, '_sdk'),
wasmDir: path.join(root2, '_wxwasm'),
outDir: out2,
@@ -180,7 +181,7 @@ describe('WeChat 分包 declared through asset-groups.json', () => {
const res = await exportGame({
root: root2,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root2, '_sdk'),
wasmDir: path.join(root2, '_wxwasm'),
outDir: out2,
diff --git a/pipeline/tests/export-wechat.test.ts b/pipeline/tests/export-wechat.test.ts
index 5763bb6a4..8e2869e8c 100644
--- a/pipeline/tests/export-wechat.test.ts
+++ b/pipeline/tests/export-wechat.test.ts
@@ -17,6 +17,7 @@ import path from 'node:path';
import { exportGame } from '../src/export/exportGame';
import { miniGameSdkStub } from './fixtures/miniGameSdkStub';
import { wechatExportProfile } from '../src/export/miniGameExportProfile';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
let root: string;
let out: string;
@@ -67,7 +68,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -151,7 +152,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: wxDir,
@@ -192,7 +193,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -227,7 +228,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -267,7 +268,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -287,7 +288,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_no-such-wasm'),
@@ -324,7 +325,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-spine/spine.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: wxDir,
@@ -350,7 +351,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-spine/spine.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'), // engine only — no spine42
@@ -383,7 +384,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-ktx2/ktx2.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: wxDir,
@@ -411,7 +412,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-ktx2/ktx2.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'), // engine only — no basis
@@ -436,7 +437,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -454,7 +455,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -498,7 +499,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-multi/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -535,7 +536,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -571,7 +572,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes-spine/spine.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: wxDir,
@@ -601,7 +602,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -623,7 +624,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -690,7 +691,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -712,7 +713,7 @@ describe('exportGame (wechat)', () => {
const res = await exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
@@ -784,7 +785,7 @@ describe('exportGame (wechat) — open data context', () => {
const exportIt = (root: string, out: string) => exportGame({
root,
entryScene: 'scenes/main.esscene',
- hostsDir: 'unused-for-wechat',
+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'),
wasmDir: path.join(root, '_wxwasm'),
outDir: out,
@@ -886,7 +887,7 @@ describe('two assets, one staged file', () => {
const outDir = path.join(dir, 'dist-wechat');
const res = await exportGame({
- root: dir, entryScene: 'scenes/main.esscene', hostsDir: 'unused-for-wechat',
+ root: dir, entryScene: 'scenes/main.esscene', hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(dir, '_sdk'), wasmDir: path.join(dir, '_wxwasm'),
outDir, platform: 'wechat', contentAddressed: true,
});
diff --git a/pipeline/tests/hotupdate-verify-fixture.test.ts b/pipeline/tests/hotupdate-verify-fixture.test.ts
index c7edfc936..ce6924589 100644
--- a/pipeline/tests/hotupdate-verify-fixture.test.ts
+++ b/pipeline/tests/hotupdate-verify-fixture.test.ts
@@ -15,6 +15,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { exportGame } from '../src/export/exportGame';
import { solidPng } from './fixtures/solidPng.mjs';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const EXAMPLE = path.resolve(HERE, '..', '..', 'examples', 'hot-update-demo');
@@ -26,7 +27,7 @@ const REDSRC = path.join(ROOT, 'red-src');
const opts = (root: string, outDir: string) => ({
root,
entryScene: 'assets/scenes/main.esscene',
- hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'),
+ hostsDir: path.resolve(HERE, '..', '..', 'pipeline', 'src', 'runtime'), packagesDir: OFFICIAL_PACKAGES,
scriptsEntry: 'src/main.ts',
sdkDistDir: path.resolve(HERE, '..', '..', 'sdk', 'dist'),
wasmDir: path.resolve(HERE, '..', '..', 'build', 'wasm', 'web'),
diff --git a/pipeline/tests/official-packages.test.ts b/pipeline/tests/official-packages.test.ts
new file mode 100644
index 000000000..07c65147a
--- /dev/null
+++ b/pipeline/tests/official-packages.test.ts
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file `estella-plugin-*` resolves to the copy the editor ships.
+ *
+ * None of them is on a registry, so a project that imports one — as every doc
+ * page for them says to — had nothing to resolve it from: the import failed in
+ * play and in every export. The claims are that each bundle a project's scripts
+ * go into finds the shipped copy, that a copy the project installed itself still
+ * wins, and that a miss names what does ship.
+ */
+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 { buildProjectScripts } from '../src/bundle/buildScripts';
+import { buildOpenDataContext } from '../src/bundle/buildOpenData';
+import { exportGame } from '../src/export/exportGame';
+import { runtimeConfigOf } from '../src/project/runtimeConfig';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
+
+let work: string;
+let shipped: string;
+
+function project(name: string, main: string): string {
+ const root = path.join(work, name);
+ mkdirSync(path.join(root, 'src'), { recursive: true });
+ writeFileSync(path.join(root, 'src', 'main.ts'), main);
+ return root;
+}
+
+function fakePackage(dir: string, name: string, marker: string): void {
+ mkdirSync(path.join(dir, 'src'), { recursive: true });
+ writeFileSync(path.join(dir, 'package.json'), JSON.stringify({
+ name, type: 'module', exports: { '.': './src/index.ts', './extra': './src/extra.ts' },
+ }));
+ writeFileSync(path.join(dir, 'src', 'index.ts'),
+ `import { installMiniGamePlatform } from 'esengine';\nexport const where = '${marker}';\nexport const hook = installMiniGamePlatform;\n`);
+ writeFileSync(path.join(dir, 'src', 'extra.ts'), `export const extra = '${marker}-extra';\n`);
+}
+
+beforeAll(() => {
+ work = mkdtempSync(path.join(tmpdir(), 'estella-official-'));
+ shipped = path.join(work, 'shipped');
+ fakePackage(path.join(shipped, 'fake'), 'estella-plugin-fake', 'SHIPPED_COPY');
+});
+
+afterAll(() => rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));
+
+describe('an official package in play', () => {
+ it('bundles the shipped copy, with the engine left to the realm', async () => {
+ const root = project('play', `import { where, hook } from 'estella-plugin-fake';\nconsole.log(where, hook);\n`);
+ const res = await buildProjectScripts(root, { packagesDir: shipped });
+ expect(res.errors).toEqual([]);
+ const out = readFileSync(res.outputPath!, 'utf8');
+ expect(out).toContain('SHIPPED_COPY');
+ expect(out).toMatch(/from\s*["']esengine["']/);
+ });
+
+ it('resolves an exported subpath, and refuses one the package does not export', async () => {
+ const ok = project('sub', `import { extra } from 'estella-plugin-fake/extra';\nconsole.log(extra);\n`);
+ expect(readFileSync((await buildProjectScripts(ok, { packagesDir: shipped })).outputPath!, 'utf8'))
+ .toContain('SHIPPED_COPY-extra');
+ const bad = project('badsub', `import { x } from 'estella-plugin-fake/nope';\nconsole.log(x);\n`);
+ const res = await buildProjectScripts(bad, { packagesDir: shipped });
+ expect(res.errors.join('\n')).toContain('exports no "./nope"');
+ });
+
+ it('prefers the copy the project installed itself', async () => {
+ const root = project('own', `import { where } from 'estella-plugin-fake';\nconsole.log(where);\n`);
+ fakePackage(path.join(root, 'node_modules', 'estella-plugin-fake'), 'estella-plugin-fake', 'PROJECT_COPY');
+ const out = readFileSync((await buildProjectScripts(root, { packagesDir: shipped })).outputPath!, 'utf8');
+ expect(out).toContain('PROJECT_COPY');
+ expect(out).not.toContain('SHIPPED_COPY');
+ });
+
+ it('names what does ship when a package is neither shipped nor installed', async () => {
+ const root = project('miss', `import { x } from 'estella-plugin-nothing';\nconsole.log(x);\n`);
+ const res = await buildProjectScripts(root, { packagesDir: shipped });
+ expect(res.ok).toBe(false);
+ expect(res.errors.join('\n')).toContain('estella-plugin-fake');
+ });
+
+ it('bundles the real minigame services, main entry and friends board', async () => {
+ const root = project('real', `import { Recorder, miniGameServicesPlugin } from 'estella-plugin-minigame-services';\nconsole.log(Recorder, miniGameServicesPlugin);\n`);
+ const res = await buildProjectScripts(root, { packagesDir: OFFICIAL_PACKAGES });
+ expect(res.errors).toEqual([]);
+ expect(readFileSync(res.outputPath!, 'utf8')).toContain('RecorderAPI');
+
+ mkdirSync(path.join(root, 'open-data'), { recursive: true });
+ writeFileSync(path.join(root, 'open-data', 'index.ts'),
+ `import 'estella-plugin-minigame-services/open-data';\n`);
+ const ctx = await buildOpenDataContext(root, { packagesDir: OFFICIAL_PACKAGES });
+ expect(ctx.errors).toEqual([]);
+ // A side-effect import is the whole entry; one that bundled to nothing
+ // would still report no errors.
+ expect(readFileSync(ctx.outputPath!, 'utf8')).toContain('onMessage');
+ });
+});
+
+describe('an official package in an export', () => {
+ const fixture = (name: string): string => {
+ const root = project(name, `import { where } from 'estella-plugin-fake';\nconsole.log(where);\n`);
+ mkdirSync(path.join(root, 'scenes'), { recursive: true });
+ writeFileSync(path.join(root, 'scenes', 'main.esscene'), JSON.stringify({ version: '1.0', name: 'Main', entities: [] }));
+ writeFileSync(path.join(root, 'scenes', 'main.esscene.meta'),
+ JSON.stringify({ uuid: 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', version: '2.0', type: 'scene', importer: {} }));
+ mkdirSync(path.join(root, '_sdk', 'douyin'), { recursive: true });
+ writeFileSync(path.join(root, '_sdk', 'index.minigame.js'),
+ 'export function initMiniGameRuntime(){return Promise.resolve();}\nexport function installMiniGamePlatform(){}\n');
+ writeFileSync(path.join(root, '_sdk', 'douyin', 'index.js'), 'export const douyinProfile = { id: "douyin" };\n');
+ mkdirSync(path.join(root, '_wasm'), { recursive: true });
+ writeFileSync(path.join(root, '_wasm', 'esengine.wxgame.js'), 'module.exports = () => Promise.resolve({});');
+ writeFileSync(path.join(root, '_wasm', 'esengine.wxgame.wasm'), 'wasm');
+ return root;
+ };
+
+ it('inlines the shipped copy into a mini-game package', async () => {
+ const root = fixture('douyin');
+ const out = path.join(root, 'dist');
+ const res = await exportGame({
+ root, entryScene: 'scenes/main.esscene', scriptsEntry: 'src/main.ts',
+ hostsDir: path.resolve(__dirname, '../src/runtime'), packagesDir: shipped,
+ sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'), outDir: out,
+ platform: 'douyin', miniGameAppid: 'tt0123456789abcdef',
+ runtime: runtimeConfigOf({ designResolution: { width: 1280, height: 720 } }),
+ });
+ expect(res.ok, res.errors.join('\n')).toBe(true);
+ expect(readFileSync(path.join(out, 'game-bundle.js'), 'utf8')).toContain('SHIPPED_COPY');
+ });
+});
diff --git a/pipeline/tests/officialPackagesDir.ts b/pipeline/tests/officialPackagesDir.ts
new file mode 100644
index 000000000..2b05b5cf1
--- /dev/null
+++ b/pipeline/tests/officialPackagesDir.ts
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file The repo's `plugins/`, which is what a packaged editor ships as its
+ * official packages.
+ */
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+export const OFFICIAL_PACKAGES = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'plugins');
diff --git a/pipeline/tests/streamed-world-targets.test.ts b/pipeline/tests/streamed-world-targets.test.ts
index e70ab972e..a3a9d89b9 100644
--- a/pipeline/tests/streamed-world-targets.test.ts
+++ b/pipeline/tests/streamed-world-targets.test.ts
@@ -11,6 +11,7 @@ import { describe, it, expect } from 'vitest';
import { mkdtemp, mkdir, writeFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const SIZE = 1000;
@@ -38,7 +39,7 @@ describe('targets that cannot ship a cut world', () => {
entryScene: 'assets/scenes/main.esscene',
outDir: path.join(project, 'out'),
platform: 'playable',
- hostsDir: path.join(project, 'hosts'),
+ hostsDir: path.join(project, 'hosts'), packagesDir: OFFICIAL_PACKAGES,
// Never reached: the refusal happens before anything is staged.
sdkDistDir: path.join(project, 'sdk'),
wasmDir: path.join(project, 'wasm'),
diff --git a/pipeline/tests/target-support.test.ts b/pipeline/tests/target-support.test.ts
index df1fa9b4b..62e7c0ba3 100644
--- a/pipeline/tests/target-support.test.ts
+++ b/pipeline/tests/target-support.test.ts
@@ -20,6 +20,7 @@ import {
} from '../src/project/targetSupport';
import { exportGame } from '../src/export/exportGame';
import { writeFakeSdkDist } from './fixtures/fakeSdkDist';
+import { OFFICIAL_PACKAGES } from './officialPackagesDir';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const REPO = path.resolve(HERE, '..', '..');
@@ -133,7 +134,7 @@ describe('exportGame warns about content the target cannot render', () => {
afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));
const run = (platform: 'android' | 'web', outDir: string) => exportGame({
- root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS,
+ root, entryScene: 'scenes/main.esscene', hostsDir: HOSTS, packagesDir: OFFICIAL_PACKAGES,
sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wasm'),
outDir, platform, title: 'Game',
});
diff --git a/plugins/ldtk/README.md b/plugins/ldtk/README.md
index 15b012112..20f33d041 100644
--- a/plugins/ldtk/README.md
+++ b/plugins/ldtk/README.md
@@ -3,12 +3,9 @@
Import [LDtk](https://ldtk.io) levels into Estella as Tiled maps, which the engine
loads natively.
-```bash
-npm install estella-plugin-ldtk
-```
-
-The editor lists it in **Window ▸ Plugins**, where it needs your approval before
-it runs — like any plugin, and again after an update.
+**Ships with the Estella editor**, listed in **Window ▸ Plugins**. Arriving with
+the app is what trusts it; a copy a project installs itself asks for approval
+like any other plugin, and again after an update.
## What it does
diff --git a/plugins/minigame-services/README.md b/plugins/minigame-services/README.md
index 99259d2dc..c093320b6 100644
--- a/plugins/minigame-services/README.md
+++ b/plugins/minigame-services/README.md
@@ -5,9 +5,9 @@ leaderboard** and **screen recorder**, as Estella services. The first three
used to ship inside the engine; they live here because most games open none of them, and because a service is
exactly the shape a plugin should be.
-```bash
-npm install estella-plugin-minigame-services
-```
+**Ships with the Estella editor** — import it; play and every export resolve it
+to the editor's copy. A copy the project installs into its own `node_modules`
+takes precedence.
```ts title="src/main.ts"
import { addPlugin } from 'esengine';
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 385f8e704..e1e44b737 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -968,6 +968,10 @@ export const NOTED = {
{ note: 'A UI node can keep clear of WeChat\'s capsule menu, which the safe area does not cover.' },
'feat(services): a game can record a run and share the clip':
{ note: 'A game can record a run and share the clip.' },
+ 'feat(pipeline): every bundle of a project\'s scripts resolves the official packages':
+ { note: 'Sharing, in-game purchase, the friends leaderboard and the recorder can be used at all.' },
+ 'feat(editor): a project resolves and type-checks the official packages the editor ships':
+ { note: 'Sharing, in-game purchase, the friends leaderboard and the recorder can be used at all.' },
'fix(agent): the history toggle presses grey again, not the accent':
{ note: "The agent drawer's History button shows it is open with a grey press again, not the accent colour 0.71 gave it." },
};