@seriousgaming/sdk-tools 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/guidance.md +350 -0
- package/dist/bundling/ui-bundler.d.ts +12 -0
- package/dist/cli-25RWY5BQ.js +41 -0
- package/dist/cli-2BH7FX27.js +52 -0
- package/dist/cli-2GZYGRVL.js +36 -0
- package/dist/cli-2NU2LPEE.js +97 -0
- package/dist/cli-3BRC32CP.js +132 -0
- package/dist/cli-3D3ZXWOV.js +111 -0
- package/dist/cli-3ZKWV3PN.js +96 -0
- package/dist/cli-45OCBG53.js +60 -0
- package/dist/cli-4LKXZQ2B.js +48 -0
- package/dist/cli-4PXNOJQX.js +81 -0
- package/dist/cli-4SIWLHQO.js +717 -0
- package/dist/cli-4UWFQNGF.js +54 -0
- package/dist/cli-4VFZHLDG.js +202 -0
- package/dist/cli-4YB3ROVR.js +78 -0
- package/dist/cli-5ACDPCXI.js +21 -0
- package/dist/cli-5IAW3LIF.js +38 -0
- package/dist/cli-5SM367K7.js +30 -0
- package/dist/cli-64AB62PM.js +25 -0
- package/dist/cli-6K3VQQUS.js +307 -0
- package/dist/cli-6QB2VFPY.js +80 -0
- package/dist/cli-6SGCYEEC.js +649 -0
- package/dist/cli-6UTPHWRQ.js +207 -0
- package/dist/cli-6VNKQ3OX.js +391 -0
- package/dist/cli-72XDEFU3.js +61 -0
- package/dist/cli-7A6MKCUJ.js +463 -0
- package/dist/cli-7XLHO2FE.js +226 -0
- package/dist/cli-AV2FYC5G.js +225 -0
- package/dist/cli-B6YHEKIJ.js +248 -0
- package/dist/cli-BJMS3VX3.js +1837 -0
- package/dist/cli-BUQI5UU4.js +43 -0
- package/dist/cli-BWX5E7TQ.js +23 -0
- package/dist/cli-BYCHKSSH.js +1331 -0
- package/dist/cli-C3CMJSNL.js +89 -0
- package/dist/cli-C47GJATR.js +42 -0
- package/dist/cli-C5QOJJWX.js +46 -0
- package/dist/cli-C6ZLPK2U.js +124 -0
- package/dist/cli-CD5CIJZI.js +72 -0
- package/dist/cli-DDJYUKQG.js +36 -0
- package/dist/cli-DFBTZEBX.js +167 -0
- package/dist/cli-DOXRQ3S5.js +60 -0
- package/dist/cli-EVI36HEM.js +79 -0
- package/dist/cli-F2D4GGUA.js +549 -0
- package/dist/cli-FQRVFGN6.js +0 -0
- package/dist/cli-FWFRKQNE.js +11 -0
- package/dist/cli-G6CANSPL.js +88 -0
- package/dist/cli-GFNDW2DL.js +124 -0
- package/dist/cli-HCRTYQQS.js +16 -0
- package/dist/cli-HFX3YPUL.js +76 -0
- package/dist/cli-HKORECAG.js +53 -0
- package/dist/cli-HOE3WLFH.js +73 -0
- package/dist/cli-HSIHDN6K.js +187 -0
- package/dist/cli-HW53ICZC.js +89 -0
- package/dist/cli-IDVUHGKG.js +218 -0
- package/dist/cli-IEMKI7J7.js +1387 -0
- package/dist/cli-ILFDANBR.js +101 -0
- package/dist/cli-ILKCQNM6.js +8 -0
- package/dist/cli-IP4RXGHM.js +2847 -0
- package/dist/cli-IUS2YCD3.js +31 -0
- package/dist/cli-J4DKUUTK.js +138 -0
- package/dist/cli-J4UBELKF.js +37 -0
- package/dist/cli-JJSWBW4H.js +89 -0
- package/dist/cli-JVI24FI6.js +68 -0
- package/dist/cli-JZCLIT3O.js +135 -0
- package/dist/cli-JZOZOEZM.js +131 -0
- package/dist/cli-KGM6RRQW.js +185 -0
- package/dist/cli-KGT5L7VZ.js +13641 -0
- package/dist/cli-KOGRWFN7.js +89 -0
- package/dist/cli-KSGB2ZLK.js +101 -0
- package/dist/cli-L7VYSXQK.js +243 -0
- package/dist/cli-LK3V4RI5.js +36 -0
- package/dist/cli-LQOHATY2.js +126 -0
- package/dist/cli-MJUYJIEP.js +13 -0
- package/dist/cli-MJV47HKI.js +143 -0
- package/dist/cli-MMN4BPO4.js +145 -0
- package/dist/cli-MOPSZ3CS.js +88 -0
- package/dist/cli-MU5LB43S.js +136 -0
- package/dist/cli-MYJGMA6U.js +40 -0
- package/dist/cli-N24OHSAN.js +36 -0
- package/dist/cli-N45DREM4.js +99 -0
- package/dist/cli-N6H6T2E2.js +616 -0
- package/dist/cli-NROTDF5Y.js +182 -0
- package/dist/cli-O5ABH2WK.js +226 -0
- package/dist/cli-OMWC75CC.js +256 -0
- package/dist/cli-OXAUOWCN.js +50 -0
- package/dist/cli-PGCIHPU7.js +143 -0
- package/dist/cli-Q6ZBZYK2.js +35 -0
- package/dist/cli-QUNIRH7A.js +57 -0
- package/dist/cli-QUSCIUOM.js +142 -0
- package/dist/cli-QVASWX2A.js +187 -0
- package/dist/cli-QWQMPCL6.js +253 -0
- package/dist/cli-QY5NZAR7.js +97 -0
- package/dist/cli-R2MUZQE2.js +62 -0
- package/dist/cli-RCIWBCXD.js +36 -0
- package/dist/cli-RLEGRWFM.js +81 -0
- package/dist/cli-RSW6EBBD.js +89 -0
- package/dist/cli-RZITKPJX.js +367 -0
- package/dist/cli-S5IVGDDD.js +32 -0
- package/dist/cli-SRHBXZCN.js +159 -0
- package/dist/cli-TDSQSCX4.js +131 -0
- package/dist/cli-TIDQ4WUE.js +257 -0
- package/dist/cli-TT36JCU5.js +370 -0
- package/dist/cli-TTKICM5P.js +100 -0
- package/dist/cli-TTMBBEJC.js +131 -0
- package/dist/cli-UMEBPAZQ.js +16 -0
- package/dist/cli-UNAJ2OTE.js +15 -0
- package/dist/cli-UZZFNXRX.js +226 -0
- package/dist/cli-VDBW23SS.js +81 -0
- package/dist/cli-VL2P354N.js +46 -0
- package/dist/cli-VPRRICZA.js +304 -0
- package/dist/cli-VQ6HVQW4.js +4010 -0
- package/dist/cli-WR3NOY74.js +36 -0
- package/dist/cli-WU43JT4T.js +52 -0
- package/dist/cli-XAT25PRU.js +117 -0
- package/dist/cli-XOTNXEJA.js +124 -0
- package/dist/cli-XSLNH5PR.js +6417 -0
- package/dist/cli-XSVGKI3R.js +39 -0
- package/dist/cli-XZCJIKIV.js +124 -0
- package/dist/cli-Y3DDNMPX.js +97 -0
- package/dist/cli-Y3O5F4JN.js +90 -0
- package/dist/cli-YOTGR3NB.js +82 -0
- package/dist/cli-Z56ZIVA6.js +97 -0
- package/dist/cli-ZBN5KAIB.js +59 -0
- package/dist/cli-ZDOTXEKL.js +31 -0
- package/dist/cli-ZDUADFBY.js +88 -0
- package/dist/cli-ZJFQ7EEA.js +131 -0
- package/dist/cli-ZTWOE3ZT.js +65 -0
- package/dist/cli.js +148 -43093
- package/dist/client/build-surfaces.d.ts +33 -0
- package/dist/client/dev-server.d.ts +6 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/playwright.d.ts +62 -0
- package/dist/client.js +228 -48
- package/dist/core/session.d.ts +15 -1
- package/dist/dev/console/assets/{index-BVF8exas.js → index-CuMOOH9m.js} +1 -1
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/shell.d.ts +19 -0
- package/dist/dev/surfaces.d.ts +7 -0
- package/dist/docs/ai-agents.md +1 -1
- package/dist/docs/api/index.md +14 -12
- package/dist/docs/api/sdk-tools-client.md +29 -0
- package/dist/docs/api/sdk-tools-playwright.md +104 -0
- package/dist/docs/changelog.md +34 -0
- package/dist/docs/cli-and-dev-server.md +21 -0
- package/dist/docs/cli-reference.md +45 -31
- package/dist/docs/environment-variables.md +6 -0
- package/dist/docs/getting-started.md +1 -1
- package/dist/docs/guides/designing-a-game.md +29 -4
- package/dist/docs/guides/starter-game.md +3 -3
- package/dist/docs/guides/testing.md +33 -18
- package/dist/docs/guides/upgrading.md +19 -2
- package/dist/docs/page-index.md +10 -9
- package/dist/docs/recipes/e2e-testing.md +19 -20
- package/dist/playwright.js +32232 -0
- package/dist/templates/package/CLAUDE.md.template +7 -346
- package/dist/templates/package/claude/rules/workflow-create-engine.md +2 -2
- package/dist/templates/package/claude/rules/workflow-create-guide.md +2 -2
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +3 -3
- package/dist/templates/package/global-setup.ts.template +7 -18
- package/dist/templates/package/playwright.config.ts.liquid +8 -11
- package/dist/templates/starter-game/playwright.config.ts +8 -11
- package/dist/templates/starter-game/testing/e2e/game.spec.ts +1 -1
- package/dist/templates/starter-game/testing/e2e/global-setup.ts +7 -18
- package/dist/utils/prompt.d.ts +5 -5
- package/dist/utils/resource-scan.d.ts +39 -0
- package/package.json +7 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A package's surfaces built once, for every dev server of a test run (#808).
|
|
3
|
+
*
|
|
4
|
+
* A dev server compiles a surface through Vite the first time a page asks for
|
|
5
|
+
* it, which is paid again by every server a run starts. Built here once, the
|
|
6
|
+
* servers serve the result as files (`startDevServer`'s `builtSurfaces`).
|
|
7
|
+
*/
|
|
8
|
+
export interface BuildSurfacesOptions {
|
|
9
|
+
/** The package to build: the directory holding `seriousgaming.sdk.json`. */
|
|
10
|
+
packagePath: string;
|
|
11
|
+
/** Where to write them. A new temporary directory by default. */
|
|
12
|
+
outDir?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface BuiltSurfaces {
|
|
15
|
+
/** The build, laid out as `sdk build` lays out `dist/`. Pass it as `builtSurfaces`. */
|
|
16
|
+
directory: string;
|
|
17
|
+
/** Delete the directory. */
|
|
18
|
+
remove(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build every surface the package has, as `sdk build` builds them, and
|
|
22
|
+
* nothing else: no logic, no guide, no archive.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const built = await buildSurfaces({ packagePath });
|
|
27
|
+
* const server = await startDevServer({ packagePath, builtSurfaces: built.directory });
|
|
28
|
+
* // ...
|
|
29
|
+
* await server.stop();
|
|
30
|
+
* await built.remove();
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildSurfaces(options: BuildSurfacesOptions): Promise<BuiltSurfaces>;
|
|
@@ -28,6 +28,12 @@ export interface DevServerOptions {
|
|
|
28
28
|
callbacks?: Partial<SignatureCallbacks>;
|
|
29
29
|
/** Re-initialise on every edit that applies only at initialisation. */
|
|
30
30
|
reinitOnChange?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Serve surfaces from this build instead of compiling them through Vite,
|
|
33
|
+
* such as the `directory` `buildSurfaces` returns or the package's `dist/`.
|
|
34
|
+
* Pages load at once, and an edit to a surface is not seen.
|
|
35
|
+
*/
|
|
36
|
+
builtSurfaces?: string;
|
|
31
37
|
}
|
|
32
38
|
export interface DevServer {
|
|
33
39
|
/** The console and API, such as `http://localhost:53712`. */
|
package/dist/client/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
export type { ContextDeletePath, ContextUpdate, SignatureCallbacks } from '@seriousgaming/sdk';
|
|
22
22
|
export { createTestSession, type TestSession, type TestSessionOptions, type TestSessionSetDataOptions, type TestSessionSetSharedDataOptions, type TestSessionState, type TestSessionTeam, type UntypedContext, } from './test-session';
|
|
23
23
|
export { startDevServer, type DevServer, type DevServerOptions } from './dev-server';
|
|
24
|
+
export { buildSurfaces, type BuildSurfacesOptions, type BuiltSurfaces } from './build-surfaces';
|
|
24
25
|
export { createStubServices, stubGenerateText, type TestServices } from './stub-services';
|
|
25
26
|
export { FakeClock, type Clock } from '../core/clock';
|
|
26
27
|
export type { Command, MutationCommand, QueryCommand, QueryResult } from '../core/protocol';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playwright for a game's browser tests: a dev server for each worker.
|
|
3
|
+
*
|
|
4
|
+
* A dev server holds one session, so a run against one server has to take its
|
|
5
|
+
* tests one at a time. Each worker here starts its own isolated server, so the
|
|
6
|
+
* tests of different workers never share a session and the run can be
|
|
7
|
+
* parallel. Tests in one worker still share its server, one after another, so
|
|
8
|
+
* each still states its own starting point (`reinitialiseSession()`).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // playwright.config.ts
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* testDir: './testing/e2e',
|
|
15
|
+
* globalSetup: './testing/e2e/global-setup.ts',
|
|
16
|
+
* fullyParallel: true,
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // testing/e2e/global-setup.ts
|
|
20
|
+
* export { globalSetup as default } from '@seriousgaming/sdk-tools/playwright';
|
|
21
|
+
*
|
|
22
|
+
* // testing/e2e/game.spec.ts
|
|
23
|
+
* import { expect, test } from '@seriousgaming/sdk-tools/playwright';
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import { type FullConfig } from '@playwright/test';
|
|
27
|
+
import { type DevServer, type DevServerOptions } from './dev-server';
|
|
28
|
+
export { expect } from '@playwright/test';
|
|
29
|
+
export type { DevServer } from './dev-server';
|
|
30
|
+
/** Where {@link globalSetup} tells the workers it built the surfaces. */
|
|
31
|
+
export declare const BUILT_SURFACES_ENV_VAR = "SERIOUSGAMING_BUILT_SURFACES";
|
|
32
|
+
/** How each worker's server starts. The package is the config file's directory unless named. */
|
|
33
|
+
export type DevServerFixtureOptions = Omit<DevServerOptions, 'packagePath' | 'builtSurfaces'> & {
|
|
34
|
+
packagePath?: string;
|
|
35
|
+
};
|
|
36
|
+
export interface DevServerWorkerFixtures {
|
|
37
|
+
/**
|
|
38
|
+
* Options for each worker's server, set in the config's `use`:
|
|
39
|
+
* `use: { devServerOptions: { teams: 2 } }`.
|
|
40
|
+
*/
|
|
41
|
+
devServerOptions: DevServerFixtureOptions;
|
|
42
|
+
/** This worker's server. `baseURL` and `SERIOUSGAMING_DEV_URL` already point at it. */
|
|
43
|
+
devServer: DevServer;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Playwright's `test`, with an isolated dev server started for each worker.
|
|
47
|
+
*
|
|
48
|
+
* The server serves the surfaces {@link globalSetup} built, when the config
|
|
49
|
+
* runs it, and compiles them through Vite otherwise. `baseURL` and the e2e
|
|
50
|
+
* helpers point at it, so `page.goto(DEV_SERVER.playerUrl(1))` and
|
|
51
|
+
* `reinitialiseSession()` reach this worker's session and no other.
|
|
52
|
+
*/
|
|
53
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & object, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & DevServerWorkerFixtures>;
|
|
54
|
+
/**
|
|
55
|
+
* A Playwright `globalSetup` that builds the package's surfaces once for the
|
|
56
|
+
* whole run, so every worker's server serves them as files rather than each
|
|
57
|
+
* compiling them through Vite. Removes the build when the run ends.
|
|
58
|
+
*
|
|
59
|
+
* Set `SERIOUSGAMING_BUILT_SURFACES` to a directory of your own, such as
|
|
60
|
+
* `dist`, to serve that instead and build nothing.
|
|
61
|
+
*/
|
|
62
|
+
export declare function globalSetup(config: FullConfig): Promise<() => Promise<void>>;
|
package/dist/client.js
CHANGED
|
@@ -850,8 +850,8 @@ var BUILTIN_FILTER = new RegExp(
|
|
|
850
850
|
function refuseNodeBuiltins() {
|
|
851
851
|
return {
|
|
852
852
|
name: "refuse-node-builtins",
|
|
853
|
-
setup(
|
|
854
|
-
|
|
853
|
+
setup(build2) {
|
|
854
|
+
build2.onResolve({ filter: BUILTIN_FILTER }, (args) => {
|
|
855
855
|
if (args.kind === "entry-point" || !isNodeBuiltin(args.path)) return void 0;
|
|
856
856
|
return {
|
|
857
857
|
errors: [
|
|
@@ -3038,6 +3038,9 @@ function recordWarning(message, code3) {
|
|
|
3038
3038
|
|
|
3039
3039
|
// cli/utils/logger.ts
|
|
3040
3040
|
var isVerbose = false;
|
|
3041
|
+
function getVerboseMode() {
|
|
3042
|
+
return isVerbose;
|
|
3043
|
+
}
|
|
3041
3044
|
function progress(message, ...args) {
|
|
3042
3045
|
if (isJsonOutput()) console.error(message, ...args);
|
|
3043
3046
|
else console.log(message, ...args);
|
|
@@ -15393,10 +15396,10 @@ function resolveAll(constructs2, events, context) {
|
|
|
15393
15396
|
const called = [];
|
|
15394
15397
|
let index3 = -1;
|
|
15395
15398
|
while (++index3 < constructs2.length) {
|
|
15396
|
-
const
|
|
15397
|
-
if (
|
|
15398
|
-
events =
|
|
15399
|
-
called.push(
|
|
15399
|
+
const resolve13 = constructs2[index3].resolveAll;
|
|
15400
|
+
if (resolve13 && !called.includes(resolve13)) {
|
|
15401
|
+
events = resolve13(events, context);
|
|
15402
|
+
called.push(resolve13);
|
|
15400
15403
|
}
|
|
15401
15404
|
}
|
|
15402
15405
|
return events;
|
|
@@ -22004,7 +22007,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
22004
22007
|
assertParser("process", this.parser || this.Parser);
|
|
22005
22008
|
assertCompiler("process", this.compiler || this.Compiler);
|
|
22006
22009
|
return done ? executor(void 0, done) : new Promise(executor);
|
|
22007
|
-
function executor(
|
|
22010
|
+
function executor(resolve13, reject) {
|
|
22008
22011
|
const realFile = vfile(file);
|
|
22009
22012
|
const parseTree = (
|
|
22010
22013
|
/** @type {HeadTree extends undefined ? Node : HeadTree} */
|
|
@@ -22035,8 +22038,8 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
22035
22038
|
function realDone(error, file2) {
|
|
22036
22039
|
if (error || !file2) {
|
|
22037
22040
|
reject(error);
|
|
22038
|
-
} else if (
|
|
22039
|
-
|
|
22041
|
+
} else if (resolve13) {
|
|
22042
|
+
resolve13(file2);
|
|
22040
22043
|
} else {
|
|
22041
22044
|
ok(done, "`done` is defined if `resolve` is not");
|
|
22042
22045
|
done(void 0, file2);
|
|
@@ -22138,7 +22141,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
22138
22141
|
file = void 0;
|
|
22139
22142
|
}
|
|
22140
22143
|
return done ? executor(void 0, done) : new Promise(executor);
|
|
22141
|
-
function executor(
|
|
22144
|
+
function executor(resolve13, reject) {
|
|
22142
22145
|
ok(
|
|
22143
22146
|
typeof file !== "function",
|
|
22144
22147
|
"`file` can\u2019t be a `done` anymore, we checked"
|
|
@@ -22152,8 +22155,8 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
22152
22155
|
);
|
|
22153
22156
|
if (error) {
|
|
22154
22157
|
reject(error);
|
|
22155
|
-
} else if (
|
|
22156
|
-
|
|
22158
|
+
} else if (resolve13) {
|
|
22159
|
+
resolve13(resultingTree);
|
|
22157
22160
|
} else {
|
|
22158
22161
|
ok(done, "`done` is defined if `resolve` is not");
|
|
22159
22162
|
done(void 0, resultingTree, file2);
|
|
@@ -24886,7 +24889,7 @@ function fileSettingDeclarationErrors(identifier, settingsSchema) {
|
|
|
24886
24889
|
}
|
|
24887
24890
|
return errors;
|
|
24888
24891
|
}
|
|
24889
|
-
async function packageFileSettingErrors(owner, settings, schemas,
|
|
24892
|
+
async function packageFileSettingErrors(owner, settings, schemas, resolve13, skip = () => false) {
|
|
24890
24893
|
const errors = [];
|
|
24891
24894
|
for (const [identifier, value] of Object.entries(settings)) {
|
|
24892
24895
|
for (const file of fileSettingValues(schemas[identifier], value)) {
|
|
@@ -24898,7 +24901,7 @@ async function packageFileSettingErrors(owner, settings, schemas, resolve12, ski
|
|
|
24898
24901
|
);
|
|
24899
24902
|
continue;
|
|
24900
24903
|
}
|
|
24901
|
-
const found = await
|
|
24904
|
+
const found = await resolve13(file.value);
|
|
24902
24905
|
if (!found) {
|
|
24903
24906
|
errors.push(`${setting}, but the package ships no such file`);
|
|
24904
24907
|
continue;
|
|
@@ -25600,6 +25603,12 @@ var Session = class {
|
|
|
25600
25603
|
holdingAtSetup = false;
|
|
25601
25604
|
/** Edits on disk that apply only at the next initialisation (#640). */
|
|
25602
25605
|
pending = NO_PENDING_CHANGES;
|
|
25606
|
+
/**
|
|
25607
|
+
* Set when applying {@link pending} threw. The executor has already
|
|
25608
|
+
* adopted the package on disk by then, so the next reload finds nothing
|
|
25609
|
+
* changed and would otherwise drop the edit `Init` never ran on.
|
|
25610
|
+
*/
|
|
25611
|
+
pendingInitFailed = false;
|
|
25603
25612
|
/** The scenario editor's drafts, which belong to no session (§6.5). */
|
|
25604
25613
|
drafts = new ScenarioDrafts();
|
|
25605
25614
|
/** What the parts below are handed of the session. */
|
|
@@ -26045,26 +26054,42 @@ var Session = class {
|
|
|
26045
26054
|
);
|
|
26046
26055
|
return { kind: "failed", pending: this.pendingChanges(), added: [] };
|
|
26047
26056
|
}
|
|
26048
|
-
|
|
26049
|
-
|
|
26050
|
-
|
|
26057
|
+
const pending = this.pendingInitFailed && !hasPendingChanges(reload.pending) ? this.pending : reload.pending;
|
|
26058
|
+
const reinitialise = hasPendingChanges(pending) || reload.added.length > 0 || this.pendingInitFailed;
|
|
26059
|
+
if (reinitialise && (this.options.reinitOnChange || !this.hasPlayed())) {
|
|
26060
|
+
this.pending = pending;
|
|
26061
|
+
try {
|
|
26051
26062
|
await this.applyPendingChanges();
|
|
26052
26063
|
this.emitState(REINITIALISED_ON_CHANGE);
|
|
26053
|
-
return { kind: "reinitialised", pending: reload.
|
|
26064
|
+
return { kind: "reinitialised", pending, added: reload.added };
|
|
26065
|
+
} catch (error) {
|
|
26066
|
+
this.pendingInitFailed = true;
|
|
26067
|
+
this.report(
|
|
26068
|
+
`The session could not re-initialise to apply an edit, because Init failed: ${errorMessage(error)}`,
|
|
26069
|
+
"reload"
|
|
26070
|
+
);
|
|
26071
|
+
this.seedAdded(reload.added);
|
|
26072
|
+
this.emitState("bundles-reloaded");
|
|
26073
|
+
return { kind: "failed", pending, added: reload.added };
|
|
26054
26074
|
}
|
|
26055
26075
|
}
|
|
26056
|
-
this.pending =
|
|
26057
|
-
|
|
26058
|
-
this.state.setTeamContexts(this.state.getTeamContexts());
|
|
26059
|
-
}
|
|
26076
|
+
this.pending = pending;
|
|
26077
|
+
this.seedAdded(reload.added);
|
|
26060
26078
|
this.emitState("bundles-reloaded");
|
|
26061
26079
|
return {
|
|
26062
|
-
kind: hasPendingChanges(
|
|
26080
|
+
kind: hasPendingChanges(pending) ? "pending" : "live",
|
|
26063
26081
|
pending: this.pendingChanges(),
|
|
26064
26082
|
added: reload.added
|
|
26065
26083
|
};
|
|
26066
26084
|
});
|
|
26067
26085
|
}
|
|
26086
|
+
/**
|
|
26087
|
+
* Give every board the capabilities a reload added, now rather than at
|
|
26088
|
+
* its next write, so a read sees them straight away.
|
|
26089
|
+
*/
|
|
26090
|
+
seedAdded(added) {
|
|
26091
|
+
if (added.length > 0) this.state.setTeamContexts(this.state.getTeamContexts());
|
|
26092
|
+
}
|
|
26068
26093
|
/**
|
|
26069
26094
|
* Whether anything has been played: a tick committed and not since
|
|
26070
26095
|
* rewound. A session at its configuration step has played nothing.
|
|
@@ -26312,6 +26337,7 @@ var Session = class {
|
|
|
26312
26337
|
this.executor.setWaitingRoomOpen(this.waitingRoomOpen);
|
|
26313
26338
|
}
|
|
26314
26339
|
this.pending = NO_PENDING_CHANGES;
|
|
26340
|
+
this.pendingInitFailed = false;
|
|
26315
26341
|
return 0;
|
|
26316
26342
|
}
|
|
26317
26343
|
setWaitingRoom(open) {
|
|
@@ -26928,6 +26954,7 @@ async function createTestSession(options) {
|
|
|
26928
26954
|
}
|
|
26929
26955
|
|
|
26930
26956
|
// cli/dev/shell.ts
|
|
26957
|
+
import { statSync as statSync3 } from "fs";
|
|
26931
26958
|
import { mkdtemp as mkdtemp2, rm as rm5 } from "fs/promises";
|
|
26932
26959
|
import { createServer } from "http";
|
|
26933
26960
|
import { tmpdir as tmpdir2 } from "os";
|
|
@@ -26957,7 +26984,7 @@ async function listenWithPortFallback(server, startPort, options = {}) {
|
|
|
26957
26984
|
);
|
|
26958
26985
|
}
|
|
26959
26986
|
function tryListen(server, port, host) {
|
|
26960
|
-
return new Promise((
|
|
26987
|
+
return new Promise((resolve13, reject) => {
|
|
26961
26988
|
const cleanup = () => {
|
|
26962
26989
|
server.removeListener("error", onError);
|
|
26963
26990
|
server.removeListener("listening", onListening);
|
|
@@ -26965,14 +26992,14 @@ function tryListen(server, port, host) {
|
|
|
26965
26992
|
const onError = (err) => {
|
|
26966
26993
|
cleanup();
|
|
26967
26994
|
if (err.code === "EADDRINUSE") {
|
|
26968
|
-
|
|
26995
|
+
resolve13(false);
|
|
26969
26996
|
} else {
|
|
26970
26997
|
reject(err);
|
|
26971
26998
|
}
|
|
26972
26999
|
};
|
|
26973
27000
|
const onListening = () => {
|
|
26974
27001
|
cleanup();
|
|
26975
|
-
|
|
27002
|
+
resolve13(true);
|
|
26976
27003
|
};
|
|
26977
27004
|
server.once("error", onError);
|
|
26978
27005
|
server.once("listening", onListening);
|
|
@@ -27002,13 +27029,13 @@ async function isFree(port) {
|
|
|
27002
27029
|
return true;
|
|
27003
27030
|
}
|
|
27004
27031
|
function isFreeOn(port, host) {
|
|
27005
|
-
return new Promise((
|
|
27032
|
+
return new Promise((resolve13) => {
|
|
27006
27033
|
const probe = createSocket();
|
|
27007
27034
|
probe.once(
|
|
27008
27035
|
"error",
|
|
27009
|
-
(error) =>
|
|
27036
|
+
(error) => resolve13(error.code === "EADDRNOTAVAIL" || error.code === "EAFNOSUPPORT")
|
|
27010
27037
|
);
|
|
27011
|
-
probe.once("listening", () => probe.close(() =>
|
|
27038
|
+
probe.once("listening", () => probe.close(() => resolve13(true)));
|
|
27012
27039
|
probe.listen(port, host);
|
|
27013
27040
|
});
|
|
27014
27041
|
}
|
|
@@ -29713,7 +29740,7 @@ function newInstanceId() {
|
|
|
29713
29740
|
}
|
|
29714
29741
|
|
|
29715
29742
|
// cli/dev/package-watcher.ts
|
|
29716
|
-
import { watch as watchDirectory } from "fs";
|
|
29743
|
+
import { rmSync as rmSync2, watch as watchDirectory } from "fs";
|
|
29717
29744
|
import { mkdtemp, rm as rm3, writeFile as writeFile4 } from "fs/promises";
|
|
29718
29745
|
import { tmpdir } from "os";
|
|
29719
29746
|
import { basename as basename4, join as join16, relative as relative7, sep as sep11 } from "path";
|
|
@@ -29748,7 +29775,12 @@ function classifyDirectory(packagePath, path3) {
|
|
|
29748
29775
|
}
|
|
29749
29776
|
async function untilWatchesDeliver(timeoutMs = 2e3) {
|
|
29750
29777
|
const directory = await mkdtemp(join16(tmpdir(), "sg-watch-"));
|
|
29751
|
-
const
|
|
29778
|
+
const removeOnExit = () => rmSync2(directory, { recursive: true, force: true });
|
|
29779
|
+
process.once("exit", removeOnExit);
|
|
29780
|
+
const remove = () => {
|
|
29781
|
+
process.off("exit", removeOnExit);
|
|
29782
|
+
return rm3(directory, { recursive: true, force: true });
|
|
29783
|
+
};
|
|
29752
29784
|
let delivered = false;
|
|
29753
29785
|
let probe;
|
|
29754
29786
|
try {
|
|
@@ -29765,7 +29797,7 @@ async function untilWatchesDeliver(timeoutMs = 2e3) {
|
|
|
29765
29797
|
const deadline = Date.now() + timeoutMs;
|
|
29766
29798
|
for (let attempt = 0; !delivered && Date.now() < deadline; attempt++) {
|
|
29767
29799
|
await writeFile4(join16(directory, "probe"), String(attempt));
|
|
29768
|
-
await new Promise((
|
|
29800
|
+
await new Promise((resolve13) => setTimeout(resolve13, 25));
|
|
29769
29801
|
}
|
|
29770
29802
|
return async () => {
|
|
29771
29803
|
probe.close();
|
|
@@ -29797,7 +29829,7 @@ async function watchPackage(packagePath, onChange, debounceMs = 150) {
|
|
|
29797
29829
|
const change = classifyChange(packagePath, path3);
|
|
29798
29830
|
if (change) schedule(change);
|
|
29799
29831
|
});
|
|
29800
|
-
await new Promise((
|
|
29832
|
+
await new Promise((resolve13) => watcher.once("ready", () => resolve13()));
|
|
29801
29833
|
const closeProbe = await untilWatchesDeliver();
|
|
29802
29834
|
return {
|
|
29803
29835
|
async close() {
|
|
@@ -30178,7 +30210,7 @@ function blobLinks(response, urlFor) {
|
|
|
30178
30210
|
}
|
|
30179
30211
|
|
|
30180
30212
|
// cli/dev/surfaces.ts
|
|
30181
|
-
var
|
|
30213
|
+
var SURFACE_PREFIX = {
|
|
30182
30214
|
game: "/user-interfaces",
|
|
30183
30215
|
session: "/session-user-interfaces",
|
|
30184
30216
|
setup: "/setup-user-interfaces",
|
|
@@ -30202,7 +30234,7 @@ function toSurface(kind2, bundle, hidden) {
|
|
|
30202
30234
|
return {
|
|
30203
30235
|
kind: kind2,
|
|
30204
30236
|
identifier,
|
|
30205
|
-
src: `${
|
|
30237
|
+
src: `${SURFACE_PREFIX[kind2]}/${encodeURIComponent(identifier)}/${bundle.ui?.entrypoint ?? "index.html"}`,
|
|
30206
30238
|
reads: visible(reads),
|
|
30207
30239
|
writes: visible(writes),
|
|
30208
30240
|
endpoints: endpoints ?? [],
|
|
@@ -30211,6 +30243,14 @@ function toSurface(kind2, bundle, hidden) {
|
|
|
30211
30243
|
settings: (kind2 === "setup" || kind2 === "scenario-editor" ? configures : settings) ?? []
|
|
30212
30244
|
};
|
|
30213
30245
|
}
|
|
30246
|
+
var SURFACE_SLOT = {
|
|
30247
|
+
game: "ui",
|
|
30248
|
+
session: "session",
|
|
30249
|
+
setup: "setup",
|
|
30250
|
+
"scenario-editor": "scenario_editor",
|
|
30251
|
+
"waiting-room": "waiting_room",
|
|
30252
|
+
presentation: "presentation"
|
|
30253
|
+
};
|
|
30214
30254
|
function mountableSurfaces(config) {
|
|
30215
30255
|
if (!config) return [];
|
|
30216
30256
|
const hidden = new Set(
|
|
@@ -31122,11 +31162,11 @@ function parseRoute(pathname, search2) {
|
|
|
31122
31162
|
const preview = query.has("preview");
|
|
31123
31163
|
const scenario = query.get("scenario");
|
|
31124
31164
|
const run = /^\/walkthrough(\/|$)/.test(pathname) ? "walkthrough" : "session";
|
|
31125
|
-
for (const [pattern,
|
|
31165
|
+
for (const [pattern, build2] of PATTERNS) {
|
|
31126
31166
|
const match2 = pathname.match(pattern);
|
|
31127
31167
|
if (match2) {
|
|
31128
31168
|
return {
|
|
31129
|
-
...
|
|
31169
|
+
...build2(match2),
|
|
31130
31170
|
bare,
|
|
31131
31171
|
run,
|
|
31132
31172
|
...scenario === null ? {} : { scenario },
|
|
@@ -31372,6 +31412,10 @@ var DevShell = class {
|
|
|
31372
31412
|
return this.brands;
|
|
31373
31413
|
}
|
|
31374
31414
|
async start() {
|
|
31415
|
+
const built = this.options.builtSurfaces;
|
|
31416
|
+
if (built !== void 0 && !statSync3(built, { throwIfNoEntry: false })?.isDirectory()) {
|
|
31417
|
+
throw new Error(`No built surfaces at ${built}: build them first`);
|
|
31418
|
+
}
|
|
31375
31419
|
if (this.options.isolated) {
|
|
31376
31420
|
const dir = await mkdtemp2(join19(tmpdir2(), "seriousgaming-dev-blobs-"));
|
|
31377
31421
|
this.isolatedBlobs = { dir, restore: redirectBlobs(this.options.packagePath, dir) };
|
|
@@ -31433,9 +31477,9 @@ var DevShell = class {
|
|
|
31433
31477
|
await this.vite?.close();
|
|
31434
31478
|
await Promise.all(
|
|
31435
31479
|
[this.server, this.assetServer, this.hmrServer].map(
|
|
31436
|
-
(server) => new Promise((
|
|
31437
|
-
if (!server) return
|
|
31438
|
-
server.close(() =>
|
|
31480
|
+
(server) => new Promise((resolve13) => {
|
|
31481
|
+
if (!server) return resolve13();
|
|
31482
|
+
server.close(() => resolve13());
|
|
31439
31483
|
})
|
|
31440
31484
|
)
|
|
31441
31485
|
);
|
|
@@ -31508,7 +31552,7 @@ var DevShell = class {
|
|
|
31508
31552
|
record(outcome) {
|
|
31509
31553
|
if (outcome.kind !== "failed") this.reloadFailure = null;
|
|
31510
31554
|
if (outcome.kind === "reinitialised") this.seeded.clear();
|
|
31511
|
-
for (const capability of outcome.added) this.seeded.add(capability);
|
|
31555
|
+
else for (const capability of outcome.added) this.seeded.add(capability);
|
|
31512
31556
|
}
|
|
31513
31557
|
/**
|
|
31514
31558
|
* Everything this server could not apply live to `run`, as it stands now:
|
|
@@ -31723,6 +31767,10 @@ ${MISSING_CONSOLE_MESSAGE}
|
|
|
31723
31767
|
"/assets"
|
|
31724
31768
|
);
|
|
31725
31769
|
registerBrandRoutes(this.assetApp, () => this.brands);
|
|
31770
|
+
if (this.options.builtSurfaces !== void 0) {
|
|
31771
|
+
this.serveBuiltSurfaces(this.options.builtSurfaces);
|
|
31772
|
+
return;
|
|
31773
|
+
}
|
|
31726
31774
|
this.assetApp.use(async (req, res, next) => {
|
|
31727
31775
|
const vite = await this.ensureVite();
|
|
31728
31776
|
if (vite) {
|
|
@@ -31742,6 +31790,24 @@ Install the package's dependencies and restart.`
|
|
|
31742
31790
|
res.status(404).type("text/plain").send(`Not found: ${req.path}`);
|
|
31743
31791
|
});
|
|
31744
31792
|
}
|
|
31793
|
+
/**
|
|
31794
|
+
* Each surface from its built directory, which `sdk build` gives relative
|
|
31795
|
+
* asset paths, so the document and everything it loads resolve under the
|
|
31796
|
+
* route the console already mounts it at.
|
|
31797
|
+
*/
|
|
31798
|
+
serveBuiltSurfaces(directory) {
|
|
31799
|
+
for (const kind2 of Object.keys(SURFACE_PREFIX)) {
|
|
31800
|
+
const slot2 = SURFACE_SLOT[kind2];
|
|
31801
|
+
this.assetApp.use(
|
|
31802
|
+
`${SURFACE_PREFIX[kind2]}/${slot2}`,
|
|
31803
|
+
express2.static(join19(directory, slot2), { index: false })
|
|
31804
|
+
);
|
|
31805
|
+
}
|
|
31806
|
+
this.assetApp.use((req, res) => {
|
|
31807
|
+
const missing = BUNDLE_ROUTE.test(req.path) ? `${req.path} is not in the built surfaces at ${directory}. Build them again after adding a surface.` : `Not found: ${req.path}`;
|
|
31808
|
+
res.status(404).type("text/plain").send(missing);
|
|
31809
|
+
});
|
|
31810
|
+
}
|
|
31745
31811
|
/**
|
|
31746
31812
|
* Vite, started the first time something asks for a surface (#320).
|
|
31747
31813
|
*
|
|
@@ -31811,22 +31877,27 @@ Install the package's dependencies to serve its surfaces.
|
|
|
31811
31877
|
*/
|
|
31812
31878
|
async viteServerOptions() {
|
|
31813
31879
|
const hmr = this.publicHmrUrl;
|
|
31880
|
+
const overlay = this.options.errorOverlay === false ? { overlay: false } : {};
|
|
31814
31881
|
if (!hmr) {
|
|
31815
|
-
return {
|
|
31882
|
+
return {
|
|
31883
|
+
middlewareMode: true,
|
|
31884
|
+
hmr: { port: this.vitePort, ...this.bindHost, ...overlay }
|
|
31885
|
+
};
|
|
31816
31886
|
}
|
|
31817
31887
|
const listener = createServer((_req, res) => {
|
|
31818
31888
|
res.writeHead(426, { "Content-Type": "text/plain" }).end("Upgrade Required");
|
|
31819
31889
|
});
|
|
31820
|
-
await new Promise((
|
|
31890
|
+
await new Promise((resolve13, reject) => {
|
|
31821
31891
|
listener.once("error", reject);
|
|
31822
31892
|
listener.listen(this.vitePort, this.bindHost.host, () => {
|
|
31823
31893
|
listener.off("error", reject);
|
|
31824
|
-
|
|
31894
|
+
resolve13();
|
|
31825
31895
|
});
|
|
31826
31896
|
});
|
|
31827
31897
|
this.hmrServer = listener;
|
|
31828
31898
|
return {
|
|
31829
31899
|
middlewareMode: true,
|
|
31900
|
+
...this.options.errorOverlay === false ? { hmr: overlay } : {},
|
|
31830
31901
|
ws: { server: listener, ...hmrClientTarget(hmr) },
|
|
31831
31902
|
// Vite refuses a request whose `Host` it does not recognise, and a
|
|
31832
31903
|
// proxy that passes its own on would otherwise be refused it.
|
|
@@ -31861,7 +31932,10 @@ Install the package's dependencies to serve its surfaces.
|
|
|
31861
31932
|
this.reloadFailure = event.message;
|
|
31862
31933
|
}
|
|
31863
31934
|
if (event.type === "state") {
|
|
31864
|
-
if (REINITIALISING_CAUSES.has(event.cause))
|
|
31935
|
+
if (REINITIALISING_CAUSES.has(event.cause)) {
|
|
31936
|
+
this.seeded.clear();
|
|
31937
|
+
this.reloadFailure = null;
|
|
31938
|
+
}
|
|
31865
31939
|
this.syncPresence("session");
|
|
31866
31940
|
}
|
|
31867
31941
|
});
|
|
@@ -32121,9 +32195,19 @@ function reportReload(outcome) {
|
|
|
32121
32195
|
case "failed":
|
|
32122
32196
|
return;
|
|
32123
32197
|
case "reinitialised":
|
|
32124
|
-
|
|
32125
|
-
|
|
32126
|
-
|
|
32198
|
+
if (hasPendingChanges(outcome.pending)) {
|
|
32199
|
+
logger.success(
|
|
32200
|
+
`${describePendingChanges(outcome.pending)}. Re-initialised the session at tick 0 to apply it.`
|
|
32201
|
+
);
|
|
32202
|
+
}
|
|
32203
|
+
for (const capability of outcome.added) {
|
|
32204
|
+
logger.success(
|
|
32205
|
+
`Capability "${capability}" added. Re-initialised the session at tick 0 so Init runs for it.`
|
|
32206
|
+
);
|
|
32207
|
+
}
|
|
32208
|
+
if (!hasPendingChanges(outcome.pending) && outcome.added.length === 0) {
|
|
32209
|
+
logger.success("Package changed; re-initialised the session at tick 0.");
|
|
32210
|
+
}
|
|
32127
32211
|
return;
|
|
32128
32212
|
case "pending":
|
|
32129
32213
|
logger.warn(
|
|
@@ -32190,6 +32274,7 @@ async function startDevServer(options) {
|
|
|
32190
32274
|
...options.clock === void 0 ? {} : { clock: options.clock },
|
|
32191
32275
|
...options.callbacks === void 0 ? {} : { callbacks: options.callbacks },
|
|
32192
32276
|
...options.reinitOnChange ? { reinitOnChange: true } : {},
|
|
32277
|
+
...options.builtSurfaces === void 0 ? {} : { builtSurfaces: options.builtSurfaces },
|
|
32193
32278
|
...environment.seriousGamingApiKey === void 0 ? {} : { seriousGamingApiKey: environment.seriousGamingApiKey },
|
|
32194
32279
|
...environment.seriousGamingApiHost === void 0 ? {} : { seriousGamingApiHost: environment.seriousGamingApiHost },
|
|
32195
32280
|
...environment.elevenLabsApiKey === void 0 ? {} : { elevenLabsApiKey: environment.elevenLabsApiKey }
|
|
@@ -32211,8 +32296,103 @@ async function startDevServer(options) {
|
|
|
32211
32296
|
}
|
|
32212
32297
|
};
|
|
32213
32298
|
}
|
|
32299
|
+
|
|
32300
|
+
// cli/client/build-surfaces.ts
|
|
32301
|
+
import { mkdtemp as mkdtemp3, rm as rm6 } from "fs/promises";
|
|
32302
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
32303
|
+
import { join as join21 } from "path";
|
|
32304
|
+
|
|
32305
|
+
// cli/bundling/ui-bundler.ts
|
|
32306
|
+
import { realpathSync as realpathSync3 } from "fs";
|
|
32307
|
+
import { join as join20, resolve as resolve12 } from "path";
|
|
32308
|
+
import react2 from "@vitejs/plugin-react";
|
|
32309
|
+
import { build, loadConfigFromFile, mergeConfig } from "vite";
|
|
32310
|
+
|
|
32311
|
+
// cli/utils/resource-scan.ts
|
|
32312
|
+
function distPath(meta, identifier) {
|
|
32313
|
+
if (meta.slot) return meta.slot;
|
|
32314
|
+
return `${meta.pluralDir}/${identifier}`;
|
|
32315
|
+
}
|
|
32316
|
+
|
|
32317
|
+
// cli/bundling/ui-bundler.ts
|
|
32318
|
+
async function bundleUserInterface(ui, workingDir, buildDir, type) {
|
|
32319
|
+
const uiOutputDir = join20(buildDir, distPath(getResourceMeta(type), ui.definition.identifier));
|
|
32320
|
+
const uiRootDir = join20(workingDir, ui.rootDirectory);
|
|
32321
|
+
const uiDir = realpathSync3(uiRootDir);
|
|
32322
|
+
logger.debug(`Building ${ui.definition.identifier}...`);
|
|
32323
|
+
const isVerbose2 = getVerboseMode();
|
|
32324
|
+
const configEnv = { command: "build", mode: "production" };
|
|
32325
|
+
const rootConfigResult = await loadConfigFromFile(configEnv, void 0, workingDir);
|
|
32326
|
+
const uiConfigResult = await loadConfigFromFile(configEnv, void 0, uiDir);
|
|
32327
|
+
if (rootConfigResult?.path && uiConfigResult?.path) {
|
|
32328
|
+
logger.warn(
|
|
32329
|
+
`Both ${rootConfigResult.path} and ${uiConfigResult.path} exist. They will be merged (per-UI overrides package-root), but this is almost certainly a mistake \u2014 choose one location and delete the other.`
|
|
32330
|
+
);
|
|
32331
|
+
}
|
|
32332
|
+
const inlineConfig = {
|
|
32333
|
+
base: "./",
|
|
32334
|
+
// Relative paths, must use this for iframes to work
|
|
32335
|
+
root: uiDir,
|
|
32336
|
+
// We've already loaded both user configs explicitly above. Disable
|
|
32337
|
+
// Vite's own config-file auto-discovery so it doesn't load
|
|
32338
|
+
// `uiDir/vite.config.ts` a second time.
|
|
32339
|
+
configFile: false,
|
|
32340
|
+
plugins: [react2()],
|
|
32341
|
+
resolve: {
|
|
32342
|
+
dedupe: ["react", "react-dom", "@emotion/react", "@emotion/styled"]
|
|
32343
|
+
},
|
|
32344
|
+
build: {
|
|
32345
|
+
outDir: uiOutputDir,
|
|
32346
|
+
emptyOutDir: true,
|
|
32347
|
+
rollupOptions: {
|
|
32348
|
+
input: resolve12(uiDir, ui.ui.entrypoint)
|
|
32349
|
+
}
|
|
32350
|
+
},
|
|
32351
|
+
logLevel: isVerbose2 ? "info" : "silent"
|
|
32352
|
+
};
|
|
32353
|
+
const mergedUserConfig = mergeConfig(
|
|
32354
|
+
rootConfigResult?.config ?? {},
|
|
32355
|
+
uiConfigResult?.config ?? {}
|
|
32356
|
+
);
|
|
32357
|
+
const finalConfig = mergeConfig(mergedUserConfig, inlineConfig);
|
|
32358
|
+
try {
|
|
32359
|
+
await build(finalConfig);
|
|
32360
|
+
logger.debug(` Built ${ui.definition.identifier} -> ${uiOutputDir}`);
|
|
32361
|
+
} catch (error) {
|
|
32362
|
+
logger.error(
|
|
32363
|
+
`Failed to build ${ui.definition.identifier}: ${error instanceof Error ? error.message : String(error)}`
|
|
32364
|
+
);
|
|
32365
|
+
throw error;
|
|
32366
|
+
}
|
|
32367
|
+
}
|
|
32368
|
+
|
|
32369
|
+
// cli/client/build-surfaces.ts
|
|
32370
|
+
var SURFACE_SLOTS = [
|
|
32371
|
+
"ui",
|
|
32372
|
+
"session",
|
|
32373
|
+
"setup",
|
|
32374
|
+
"scenario_editor",
|
|
32375
|
+
"waiting_room",
|
|
32376
|
+
"presentation"
|
|
32377
|
+
];
|
|
32378
|
+
async function buildSurfaces(options) {
|
|
32379
|
+
const config = await loadConfig(join21(options.packagePath, "seriousgaming.sdk.json"));
|
|
32380
|
+
const directory = options.outDir ?? await mkdtemp3(join21(tmpdir3(), "seriousgaming-surfaces-"));
|
|
32381
|
+
const remove = () => rm6(directory, { recursive: true, force: true });
|
|
32382
|
+
try {
|
|
32383
|
+
for (const slot2 of SURFACE_SLOTS) {
|
|
32384
|
+
const surface = config[slot2];
|
|
32385
|
+
if (surface) await bundleUserInterface(surface, options.packagePath, directory, slot2);
|
|
32386
|
+
}
|
|
32387
|
+
} catch (error) {
|
|
32388
|
+
await remove();
|
|
32389
|
+
throw error;
|
|
32390
|
+
}
|
|
32391
|
+
return { directory, remove };
|
|
32392
|
+
}
|
|
32214
32393
|
export {
|
|
32215
32394
|
FakeClock,
|
|
32395
|
+
buildSurfaces,
|
|
32216
32396
|
createStubServices,
|
|
32217
32397
|
createTestSession,
|
|
32218
32398
|
startDevServer,
|