gamestage 0.35.30 → 0.35.32
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/cli.mjs +177 -6
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -9480,9 +9480,12 @@ async function start(options = {}) {
|
|
|
9480
9480
|
}
|
|
9481
9481
|
};
|
|
9482
9482
|
const first = await roundSoon;
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9483
|
+
const noRound = !first.ok && first.cause instanceof Error && first.cause.status === 404 && ["not_found", "no_round"].includes(first.cause.code ?? "");
|
|
9484
|
+
if (!first.ok && !noRound) throw first.cause;
|
|
9485
|
+
if (first.ok) {
|
|
9486
|
+
sampleIso(platform.clock, first.value.server_time);
|
|
9487
|
+
round = first.value;
|
|
9488
|
+
}
|
|
9486
9489
|
const sameRound = (a, b) => a !== void 0 && a.id === b.id && a.version === b.version && a.challenge_instance_id === b.challenge_instance_id;
|
|
9487
9490
|
const undoAnnounce = platform.onRoundAnnounced(() => {
|
|
9488
9491
|
void (async () => {
|
|
@@ -9712,7 +9715,7 @@ export {
|
|
|
9712
9715
|
titleTreatment,
|
|
9713
9716
|
tokenOf
|
|
9714
9717
|
};
|
|
9715
|
-
`,an="
|
|
9718
|
+
`,an="32cb921b6dadae35",qe="gamestage.js",IE="0.66.23",xN=`<!doctype html>
|
|
9716
9719
|
<html lang="en">
|
|
9717
9720
|
<head>
|
|
9718
9721
|
<meta charset="utf-8" />
|
|
@@ -10069,6 +10072,28 @@ function renderBoard() {
|
|
|
10069
10072
|
);
|
|
10070
10073
|
}
|
|
10071
10074
|
|
|
10075
|
+
/**
|
|
10076
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
10077
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
10078
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
10079
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
10080
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
10081
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
10082
|
+
*/
|
|
10083
|
+
function showNoRound() {
|
|
10084
|
+
const prompt = el("prompt");
|
|
10085
|
+
prompt.textContent = label("label_come_back");
|
|
10086
|
+
for (const node of document.body.children) {
|
|
10087
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
10088
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
10089
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
10090
|
+
node.hidden = true;
|
|
10091
|
+
}
|
|
10092
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
10093
|
+
// the page starts again to draw it.
|
|
10094
|
+
game.onRoundChanged(() => location.reload());
|
|
10095
|
+
}
|
|
10096
|
+
|
|
10072
10097
|
async function main() {
|
|
10073
10098
|
game = await start({
|
|
10074
10099
|
// Where a player's token comes from, if this game has one. Gamestage ships no
|
|
@@ -10092,6 +10117,12 @@ async function main() {
|
|
|
10092
10117
|
displayName: game.deployedName,
|
|
10093
10118
|
});
|
|
10094
10119
|
|
|
10120
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
10121
|
+
if (!game.round) {
|
|
10122
|
+
showNoRound();
|
|
10123
|
+
return;
|
|
10124
|
+
}
|
|
10125
|
+
|
|
10095
10126
|
// A fan's way back to their progress on another device: a code shown once,
|
|
10096
10127
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
10097
10128
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -10648,6 +10679,28 @@ function renderRound() {
|
|
|
10648
10679
|
if (round.challenge.target_label) el("target-label").textContent = round.challenge.target_label;
|
|
10649
10680
|
}
|
|
10650
10681
|
|
|
10682
|
+
/**
|
|
10683
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
10684
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
10685
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
10686
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
10687
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
10688
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
10689
|
+
*/
|
|
10690
|
+
function showNoRound() {
|
|
10691
|
+
const prompt = el("prompt");
|
|
10692
|
+
prompt.textContent = label("label_come_back");
|
|
10693
|
+
for (const node of document.body.children) {
|
|
10694
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
10695
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
10696
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
10697
|
+
node.hidden = true;
|
|
10698
|
+
}
|
|
10699
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
10700
|
+
// the page starts again to draw it.
|
|
10701
|
+
game.onRoundChanged(() => location.reload());
|
|
10702
|
+
}
|
|
10703
|
+
|
|
10651
10704
|
async function main() {
|
|
10652
10705
|
game = await start({
|
|
10653
10706
|
// Where a player's token comes from, if this game has one. Gamestage ships no
|
|
@@ -10671,6 +10724,12 @@ async function main() {
|
|
|
10671
10724
|
displayName: game.deployedName,
|
|
10672
10725
|
});
|
|
10673
10726
|
|
|
10727
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
10728
|
+
if (!game.round) {
|
|
10729
|
+
showNoRound();
|
|
10730
|
+
return;
|
|
10731
|
+
}
|
|
10732
|
+
|
|
10674
10733
|
// A fan's way back to their progress on another device: a code shown once,
|
|
10675
10734
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
10676
10735
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -11248,6 +11307,28 @@ function renderState(state) {
|
|
|
11248
11307
|
}
|
|
11249
11308
|
}
|
|
11250
11309
|
|
|
11310
|
+
/**
|
|
11311
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
11312
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
11313
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
11314
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
11315
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
11316
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
11317
|
+
*/
|
|
11318
|
+
function showNoRound() {
|
|
11319
|
+
const prompt = el("prompt");
|
|
11320
|
+
prompt.textContent = label("label_come_back");
|
|
11321
|
+
for (const node of document.body.children) {
|
|
11322
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
11323
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
11324
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
11325
|
+
node.hidden = true;
|
|
11326
|
+
}
|
|
11327
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
11328
|
+
// the page starts again to draw it.
|
|
11329
|
+
game.onRoundChanged(() => location.reload());
|
|
11330
|
+
}
|
|
11331
|
+
|
|
11251
11332
|
async function main() {
|
|
11252
11333
|
game = await start({
|
|
11253
11334
|
// Where a player's token comes from, if this game has one. Gamestage ships no
|
|
@@ -11271,6 +11352,12 @@ async function main() {
|
|
|
11271
11352
|
displayName: game.deployedName,
|
|
11272
11353
|
});
|
|
11273
11354
|
|
|
11355
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
11356
|
+
if (!game.round) {
|
|
11357
|
+
showNoRound();
|
|
11358
|
+
return;
|
|
11359
|
+
}
|
|
11360
|
+
|
|
11274
11361
|
// A fan's way back to their progress on another device: a code shown once,
|
|
11275
11362
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
11276
11363
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -11842,6 +11929,28 @@ function renderBoard() {
|
|
|
11842
11929
|
);
|
|
11843
11930
|
}
|
|
11844
11931
|
|
|
11932
|
+
/**
|
|
11933
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
11934
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
11935
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
11936
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
11937
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
11938
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
11939
|
+
*/
|
|
11940
|
+
function showNoRound() {
|
|
11941
|
+
const prompt = el("prompt");
|
|
11942
|
+
prompt.textContent = label("label_come_back");
|
|
11943
|
+
for (const node of document.body.children) {
|
|
11944
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
11945
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
11946
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
11947
|
+
node.hidden = true;
|
|
11948
|
+
}
|
|
11949
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
11950
|
+
// the page starts again to draw it.
|
|
11951
|
+
game.onRoundChanged(() => location.reload());
|
|
11952
|
+
}
|
|
11953
|
+
|
|
11845
11954
|
async function main() {
|
|
11846
11955
|
game = await start({
|
|
11847
11956
|
// Where a player's token comes from, if this game has one. Gamestage ships no
|
|
@@ -11862,6 +11971,12 @@ async function main() {
|
|
|
11862
11971
|
displayName: game.deployedName,
|
|
11863
11972
|
});
|
|
11864
11973
|
|
|
11974
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
11975
|
+
if (!game.round) {
|
|
11976
|
+
showNoRound();
|
|
11977
|
+
return;
|
|
11978
|
+
}
|
|
11979
|
+
|
|
11865
11980
|
// A fan's way back to their progress on another device: a code shown once,
|
|
11866
11981
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
11867
11982
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -12857,6 +12972,28 @@ async function operate(op, board) {
|
|
|
12857
12972
|
}
|
|
12858
12973
|
}
|
|
12859
12974
|
|
|
12975
|
+
/**
|
|
12976
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
12977
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
12978
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
12979
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
12980
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
12981
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
12982
|
+
*/
|
|
12983
|
+
function showNoRound() {
|
|
12984
|
+
const prompt = el("prompt");
|
|
12985
|
+
prompt.textContent = label("label_come_back");
|
|
12986
|
+
for (const node of document.body.children) {
|
|
12987
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
12988
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
12989
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
12990
|
+
node.hidden = true;
|
|
12991
|
+
}
|
|
12992
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
12993
|
+
// the page starts again to draw it.
|
|
12994
|
+
game.onRoundChanged(() => location.reload());
|
|
12995
|
+
}
|
|
12996
|
+
|
|
12860
12997
|
async function main() {
|
|
12861
12998
|
game = await start({
|
|
12862
12999
|
identity: () => window.GAMESTAGE_TOKEN,
|
|
@@ -12866,6 +13003,12 @@ async function main() {
|
|
|
12866
13003
|
displayName: game.deployedName,
|
|
12867
13004
|
});
|
|
12868
13005
|
|
|
13006
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
13007
|
+
if (!game.round) {
|
|
13008
|
+
showNoRound();
|
|
13009
|
+
return;
|
|
13010
|
+
}
|
|
13011
|
+
|
|
12869
13012
|
// A fan's way back to their progress on another device: a code shown once,
|
|
12870
13013
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
12871
13014
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -13701,6 +13844,28 @@ el("shoot").onclick = () => {
|
|
|
13701
13844
|
// Start
|
|
13702
13845
|
// ---------------------------------------------------------------------------
|
|
13703
13846
|
|
|
13847
|
+
/**
|
|
13848
|
+
* A deployed game with no round on yet: before a producer writes the first
|
|
13849
|
+
* one in Studio, or between editions. Said in Studio's own words, the
|
|
13850
|
+
* come-back line, rather than as the connection failure it used to show:
|
|
13851
|
+
* "The game didn't load. Check your connection" was wrong about the cause.
|
|
13852
|
+
* The play area is hidden; the header, the footer and anything the library
|
|
13853
|
+
* draws (its classes start \`gs-\`) stay. GS-534.
|
|
13854
|
+
*/
|
|
13855
|
+
function showNoRound() {
|
|
13856
|
+
const prompt = el("prompt");
|
|
13857
|
+
prompt.textContent = label("label_come_back");
|
|
13858
|
+
for (const node of document.body.children) {
|
|
13859
|
+
if (node.contains(prompt) || node.id === "connection") continue;
|
|
13860
|
+
if (node.tagName === "FOOTER" || node.tagName === "SCRIPT") continue;
|
|
13861
|
+
if ([...node.classList].some((c) => c.startsWith("gs-"))) continue;
|
|
13862
|
+
node.hidden = true;
|
|
13863
|
+
}
|
|
13864
|
+
// The first round a producer puts on arrives over the live connection, and
|
|
13865
|
+
// the page starts again to draw it.
|
|
13866
|
+
game.onRoundChanged(() => location.reload());
|
|
13867
|
+
}
|
|
13868
|
+
|
|
13704
13869
|
async function main() {
|
|
13705
13870
|
game = await start({
|
|
13706
13871
|
identity: () => window.GAMESTAGE_TOKEN,
|
|
@@ -13710,6 +13875,12 @@ async function main() {
|
|
|
13710
13875
|
displayName: game.deployedName,
|
|
13711
13876
|
});
|
|
13712
13877
|
|
|
13878
|
+
// No round on yet is a state of the game, not a failure. GS-534.
|
|
13879
|
+
if (!game.round) {
|
|
13880
|
+
showNoRound();
|
|
13881
|
+
return;
|
|
13882
|
+
}
|
|
13883
|
+
|
|
13713
13884
|
// A fan's way back to their progress on another device: a code shown once,
|
|
13714
13885
|
// and "I've played before" to restore it. It opens as a dialog, so it adds
|
|
13715
13886
|
// nothing to the page until asked. The words are Studio's. GS-568.
|
|
@@ -13919,7 +14090,7 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[t]?this._life
|
|
|
13919
14090
|
`),this.outputHelp({error:!0}));let r=o||{},n=r.exitCode||1,a=r.code||"commander.error";this._exit(n,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in Te.env){let o=t.attributeName();(this.getOptionValue(o)===void 0||["default","config","env"].includes(this.getOptionValueSource(o)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,Te.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new ms(this.options),o=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&o(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(n=>!o(n)).forEach(n=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(t){let o=`error: missing required argument '${t}'`;this.error(o,{code:"commander.missingArgument"})}optionMissingArgument(t){let o=`error: option '${t.flags}' argument missing`;this.error(o,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let o=`error: required option '${t.flags}' not specified`;this.error(o,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,o){let r=i=>{let s=i.attributeName(),l=this.getOptionValue(s),d=this.options.find(p=>p.negate&&s===p.attributeName()),m=this.options.find(p=>!p.negate&&s===p.attributeName());return d&&(d.presetArg===void 0&&l===!1||d.presetArg!==void 0&&l===d.presetArg)?d:m||i},n=i=>{let s=r(i),l=s.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},a=`error: ${n(t)} cannot be used with ${n(o)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let o="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],a=this;do{let i=a.createHelp().visibleOptions(a).filter(s=>s.long).map(s=>s.long);n=n.concat(i),a=a.parent}while(a&&!a._enablePositionalOptions);o=cu(t,n)}let r=`error: unknown option '${t}'${o}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let o=this.registeredArguments.length,r=o===1?"":"s",n=t.length,a=this.parent?` for '${this.name()}'`:"",i=t.join(", "),s=`error: too many arguments${a}. Expected ${o} argument${r} but got ${n}: ${i}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],o="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(a=>{n.push(a.name()),a.alias()&&n.push(a.alias())}),o=cu(t,n)}let r=`error: unknown command '${t}'${o}`;this.error(r,{code:"commander.unknownCommand"})}version(t,o,r){if(t===void 0)return this._version;this._version=t,o=o||"-V, --version",r=r||"output the version number";let n=this.createOption(o,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
13920
14091
|
`),this._exit(0,"commander.version",t)}),this}description(t,o){return t===void 0&&o===void 0?this._description:(this._description=t,o&&(this._argsDescription=o),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let o=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(o=this.commands[this.commands.length-1]),t===o._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(t);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return o._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(o=>this.alias(o)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let o=this.registeredArguments.map(r=>us(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?o:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=bn.basename(t,bn.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let o=this.createHelp(),r=this._getOutputContext(t);o.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let n=o.formatHelp(this,o);return r.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let o=!!t.error,r,n,a;return o?(r=s=>this._outputConfiguration.writeErr(s),n=this._outputConfiguration.getErrHasColors(),a=this._outputConfiguration.getErrHelpWidth()):(r=s=>this._outputConfiguration.writeOut(s),n=this._outputConfiguration.getOutHasColors(),a=this._outputConfiguration.getOutHelpWidth()),{error:o,write:s=>(n||(s=this._outputConfiguration.stripColor(s)),r(s)),hasColors:n,helpWidth:a}}outputHelp(t){let o;typeof t=="function"&&(o=t,t=void 0);let r=this._getOutputContext(t),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(i=>i.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let a=this.helpInformation({error:r.error});if(o&&(a=o(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(i=>i.emit("afterAllHelp",n))}helpOption(t,o){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",o??"display help for command"),(t||o)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let o=Number(Te.exitCode??0);o===0&&t&&typeof t!="function"&&t.error&&(o=1),this._exit(o,"commander.help","(outputHelp)")}addHelpText(t,o){let r=["beforeAll","before","after","afterAll"];if(!r.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
13921
14092
|
Expecting one of '${r.join("', '")}'`);let n=`${t}Help`;return this.on(n,a=>{let i;typeof o=="function"?i=o({error:a.error,command:a.command}):i=o,i&&a.write(`${i}
|
|
13922
|
-
`)}),this}_outputHelpIfRequested(t){let o=this._getHelpOption();o&&t.find(n=>o.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Sw(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let o,r="127.0.0.1",n="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?o=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(o=a[1],/^\d+$/.test(a[3])?n=a[3]:r=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(o=a[1],r=a[3],n=a[4]),o&&n!=="0"?`${o}=${r}:${parseInt(n)+1}`:t})}function Tw(){if(Te.env.NO_COLOR||Te.env.FORCE_COLOR==="0"||Te.env.FORCE_COLOR==="false")return!1;if(Te.env.FORCE_COLOR||Te.env.CLICOLOR_FORCE!==void 0)return!0}var wU=new nr;ke();sn();$e();import{mkdir as ON,readFile as zN,writeFile as RN}from"node:fs/promises";import{dirname as NN,join as jN,relative as LN,resolve as DN}from"node:path";async function MN(e,t){let o;try{o=await zN(e,"utf8")}catch{return"absent"}return o===t?"same":"different"}async function OE(e,t,o){let r=jN(e,t),n=await MN(r,o);try{await ON(NN(r),{recursive:!0}),await RN(r,o,"utf8")}catch{throw R(`Cannot write ${r}.`),new Error("unreachable")}return{where:LN(process.cwd(),r)||t,state:n}}async function zE(e){let t=DN(e.out??"."),o=await OE(t,qe,Bt),r=await OE(t,ot,qr),n=`import { start } from "./${qe}";`,a=`import { createPlayerClient, newIdempotencyKey } from "./${ot}";`,i=o.state==="same"&&r.state==="same";if(U())return ee({ok:!0,status:i?"unchanged":"written",files:[{path:o.where,digest:an,import:n},{path:r.where,digest:Bo,import:a}],path:o.where,digest:an,import:n});j(i?"Already current":"Wrote the Gamestage client"),O("Library",`${o.where} (${an})`),O("Player client",`${r.where} (${Bo})`),g(),k(`Import it: ${v.cyan(n)}`),k(`The player API on its own: ${v.cyan(a)}`),(o.state==="different"||r.state==="different")&&k("An earlier copy was replaced. It is generated, so nothing of yours was in it."),g()}ke();sn();uo();import{mkdir as pj,readdir as s$,stat as hj,writeFile as i$}from"node:fs/promises";import{join as fj}from"node:path";import{createInterface as gj}from"node:readline/promises";import{createHash as yj}from"node:crypto";var wt="0.35.
|
|
14093
|
+
`)}),this}_outputHelpIfRequested(t){let o=this._getHelpOption();o&&t.find(n=>o.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Sw(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let o,r="127.0.0.1",n="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?o=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(o=a[1],/^\d+$/.test(a[3])?n=a[3]:r=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(o=a[1],r=a[3],n=a[4]),o&&n!=="0"?`${o}=${r}:${parseInt(n)+1}`:t})}function Tw(){if(Te.env.NO_COLOR||Te.env.FORCE_COLOR==="0"||Te.env.FORCE_COLOR==="false")return!1;if(Te.env.FORCE_COLOR||Te.env.CLICOLOR_FORCE!==void 0)return!0}var wU=new nr;ke();sn();$e();import{mkdir as ON,readFile as zN,writeFile as RN}from"node:fs/promises";import{dirname as NN,join as jN,relative as LN,resolve as DN}from"node:path";async function MN(e,t){let o;try{o=await zN(e,"utf8")}catch{return"absent"}return o===t?"same":"different"}async function OE(e,t,o){let r=jN(e,t),n=await MN(r,o);try{await ON(NN(r),{recursive:!0}),await RN(r,o,"utf8")}catch{throw R(`Cannot write ${r}.`),new Error("unreachable")}return{where:LN(process.cwd(),r)||t,state:n}}async function zE(e){let t=DN(e.out??"."),o=await OE(t,qe,Bt),r=await OE(t,ot,qr),n=`import { start } from "./${qe}";`,a=`import { createPlayerClient, newIdempotencyKey } from "./${ot}";`,i=o.state==="same"&&r.state==="same";if(U())return ee({ok:!0,status:i?"unchanged":"written",files:[{path:o.where,digest:an,import:n},{path:r.where,digest:Bo,import:a}],path:o.where,digest:an,import:n});j(i?"Already current":"Wrote the Gamestage client"),O("Library",`${o.where} (${an})`),O("Player client",`${r.where} (${Bo})`),g(),k(`Import it: ${v.cyan(n)}`),k(`The player API on its own: ${v.cyan(a)}`),(o.state==="different"||r.state==="different")&&k("An earlier copy was replaced. It is generated, so nothing of yours was in it."),g()}ke();sn();uo();import{mkdir as pj,readdir as s$,stat as hj,writeFile as i$}from"node:fs/promises";import{join as fj}from"node:path";import{createInterface as gj}from"node:readline/promises";import{createHash as yj}from"node:crypto";var wt="0.35.32",$i="2026-09-29-1",Bl=">=22.13.0";function WN(e=Bl){let[t,o]=e.replace(/^[^\d]*/,"").split(".").map(Number);return[t,o||0]}function HE(e,t=Bl){let[o,r]=WN(t),[n,a]=e.split(".").map(Number);return n>o||n===o&&a>=r}import{randomUUID as HN}from"node:crypto";var KN=/-[0-9a-f]{4}$/;function ql(e){return`${e}-${HN().replace(/-/g,"").slice(0,4)}`}function KE(e){return KN.test(e)}ut();var Pn="favicon.svg",Ii=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
13923
14094
|
<rect width="32" height="32" rx="7" fill="#1b1c1f"/>
|
|
13924
14095
|
<path d="m12 8 12 8-12 8Z" fill="#fff"/>
|
|
13925
14096
|
</svg>
|
|
@@ -13987,7 +14158,7 @@ window.GAMESTAGE_GAME = ${JSON.stringify(o)};
|
|
|
13987
14158
|
// This page was deployed, so it may ask which Interaction Cloud project it is.
|
|
13988
14159
|
window.GAMESTAGE_IC_LOOKUP = true;
|
|
13989
14160
|
</script>
|
|
13990
|
-
`,n=e.search(/<script\b/i);if(n===-1){let a=e.search(/<\/head>/i);return a===-1?r+e:e.slice(0,a)+r+e.slice(a)}return e.slice(0,n)+r+e.slice(n)}async function Jo(e,t,o,r){let n=await fetch(e,{method:"PUT",body:typeof t=="string"?new Uint8Array(Buffer.from(t,"utf8")):t,headers:{"content-type":o,...r?{"cache-control":r}:{}}});n.ok||R(`Upload refused with ${n.status}. Ask for a fresh URL and retry.`)}function Kd(e){let t=new URL(e.publicUrl);return t.pathname=`/${e.key.split("/").map(encodeURIComponent).join("/")}`,t.search="",t.hash="",t.toString()}function b6(e){switch(l6(e).toLowerCase()){case".html":return"text/html; charset=utf-8";case".css":return"text/css; charset=utf-8";case".js":case".mjs":return"text/javascript; charset=utf-8";case".json":return"application/json; charset=utf-8";case".svg":return"image/svg+xml";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".ico":return"image/x-icon";case".webmanifest":return"application/manifest+json; charset=utf-8";case".wasm":return"application/wasm";default:return"application/octet-stream"}}async function oC(e,t,o,r,n,a){let i=Ql(a.settings,a.fallbackTitle),s=i.description??i.title,l=fo(o),d=await e.uploadTarget(t,ho),m=d.publicUrl.replace(/[^/]+$/,"index.html"),p=null,h=l.get("og:image")||void 0;if(!h&&r&&(h=d.publicUrl),!h){let y=await(a.draw??v$)(n??Ei(a.settings,i.title),i.description);y.png?(p=y.png,h=d.publicUrl,k(`Link preview: drew ${ho} (${1200}x${630}) from the game's name and strapline.`)):k(`Link preview: no ${ho} drawn (${y.reason}). The link will unfurl without a picture; add ${ho} at ${1200}x${630} to the game folder, or install Chrome and deploy again.`)}return{tags:{title:i.title,description:s,siteName:i.siteName,url:m,image:h,imageAlt:i.description?`${i.title}: ${i.description}`:i.title,imageWidth:1200,imageHeight:630},card:p}}async function rC(e,t,o){if(!o)return;let r=await e.uploadTarget(t,ho);await Jo(r.uploadUrl,o,"image/png",r.cacheControl)}async function v6(e,t,o,r={},n,a,i){let s=sw(o),l;try{l=aw(s)}catch{throw R(`Cannot read ${o}.`),new Error("unreachable")}let d=await Tb({path:s,relativePath:o},r.round);d&&R(`${o} ${d.why}`,["A deploy is a publishing act, and --file publishes this file as the game's","own page. Point --file at the game's HTML, or use --dir and let the gate","withhold what the page does not need."]),await a?.(s);let m=await e.uploadTarget(t,"index.html"),p=i?await oC(e,t,l.toString("utf8"),!1,n,i):null,h=p?ji(l.toString("utf8"),p.tags):l.toString("utf8");await rC(e,t,p?.card??null);let y=nC(q2(Pi(h),n),`${m.playerApiOrigin}`,t);await Jo(m.uploadUrl,y,"text/html; charset=utf-8",m.cacheControl);let w=await e.uploadTarget(t,ot);await Jo(w.uploadUrl,qr,"text/javascript; charset=utf-8",w.cacheControl);let I=await e.uploadTarget(t,qe);await Jo(I.uploadUrl,Bt,"text/javascript; charset=utf-8",I.cacheControl);let L=await e.uploadTarget(t,Pn);return await Jo(L.uploadUrl,Ii,"image/svg+xml",L.cacheControl),U()||(g(),k(`Uploaded ${o} to ${Kd(m)}`),k(`Wired it to ${m.playerApiOrigin} as "${t}"`),k(`Shipped @monterosa/gamestage beside it (${an})`),k(`Shipped the player client beside it (${Bo})`)),Kd(m)}async function w6(e,t,o,r,n){if(r||!e||!t)return;let{browserCheck:a}=await Promise.resolve().then(()=>(Zo(),nw));x6(await a(e,t,o,n))}function k6(e){return[...(e??[]).slice(-8)].reverse().find(r=>r.level==="error"&&/not on Interaction Cloud/.test(r.message))?.message.replace(/^The game is not on Interaction Cloud: /,"Studio answered: ")}function _6(e,t,o){let r=e.studioUrl??Ai(e.id);return[`${v.bold(`No ${t} yet: add one in Studio.`)}`,` ${v.cyan(r)}`,"",e.studioUrl?" The game is online and its Studio project exists, so a fan opening it now":" The game is online, and Stage links to its Studio project once it has one, so a fan opening it now",` finds nothing to play. Write the first ${t} in Studio and it appears`,` without another deploy. Share the game once a ${t} is on.`,"",` ${v.cyan(re("dev --serve"))} try the game on this machine with a sample ${o.toLowerCase()} meanwhile`]}function x6(e){if(e.status==="verified"){O("Checked","the page loads and plays in a browser"),g();return}if(e.status==="skipped"||e.status==="n/a"){k(v.dim(`Not checked in a browser: ${e.detail??""}`.trim())),g();return}j("The published page did not start"),g(` ${e.detail??""}`),g(),k("The files are published, so the game is live and broken rather than unpublished."),k(`${v.cyan(re("verify"))} the same check, with the rest of them`),g(),process.exitCode=1}function S6(e){for(let t of e.walkedPast)k(`Walked past ${t}: it is a toolchain directory, not your game.`);for(let t of e.allowed)k(`Published ${t.path} because you allowed it.`);for(let t of e.withheld)k(`Withheld ${t.path} from the upload: it ${t.why}`);e.refuse&&R(`${e.refuse.path} ${e.refuse.why}`,["A deploy is a publishing act, so this file would sit at a public URL beside","your game. Remove it from the directory, or point --dir at a directory that","does not contain it, and deploy again."])}async function T6(e,t,o,r={},n,a,i){let s,l=[];try{let $=Mi(o,{symlinks:"throw"});s=$.files,l=$.withheld}catch($){throw R($ instanceof Error?$.message:`Cannot read ${o}.`),new Error("unreachable")}let d=await p$(s,{...r,exempt:[qe,ot]});S6(d);let m=d.publish,p=m.find($=>$.relativePath==="index.html");p||R(`Directory ${o} must contain an index.html file.`),await a?.(p.path);let h=k$(m,l);j(`Publishing ${m.length} ${m.length===1?"file":"files"} to the playground`);for(let $ of h.lines)k($);h.named.length&&(g(),k("The lines above are named because they are not ordinary web assets. Anything there you did not mean to publish, stop and remove it: a deploy puts every one of these at a public URL beside your game.")),g();let y=aw(p.path,"utf8"),w=i?await oC(e,t,y,m.some($=>$.relativePath===ho),n,i):null,I=bb(y),L=m.some($=>$.relativePath==="favicon.ico"),J=m.some($=>$.relativePath===Pn),Q=!I&&!L,q=Q&&!J,_=rw();if(_!=="0.0.0-test"){let $=`${He}/client/${_}/${qe}`,E=!1;try{E=(await fetch($,{method:"HEAD"})).ok}catch{E=!0}E||R(`The client this deploy would pin, ${_}, is not published yet.`,[`Every page uploaded here will import ${$},`,"which answers 404 today. The game would load, fetch nothing, and show a","blank screen with no error anywhere.","","Deploy the site first: it is what serves /client/<version>/.","",`${v.cyan("node scripts/deploy.mjs site")} then run this deploy again`])}let T;for(let $ of m){if($.relativePath===qe||$.relativePath===ot)continue;let E;try{E=await e.uploadTarget(t,$.relativePath)}catch(ce){throw new Error(`${$.relativePath} cannot be published: ${ce instanceof Error?ce.message:String(ce)}`,{cause:ce})}$.relativePath==="index.html"&&(T=E);let z=aw($.path),W=/\.(m?js)$/i.test($.relativePath),ae=/\.html$/i.test($.relativePath)?nC(F2($.relativePath==="index.html"?q2((()=>{let ce=w?ji(z.toString("utf8"),w.tags):z.toString("utf8");return Q?Pi(ce):ce})(),n):z.toString("utf8"),rw()),E.playerApiOrigin,t):W?F2(z.toString("utf8"),rw()):z;await Jo(E.uploadUrl,ae,b6($.relativePath),E.cacheControl)}if(await rC(e,t,w?.card??null),q){let $=await e.uploadTarget(t,Pn);await Jo($.uploadUrl,Ii,"image/svg+xml",$.cacheControl)}let Y=[...m.map($=>$.relativePath),...q?[Pn]:[],...w?.card?[ho]:[]];try{await e.pruneBundle(t,Y);for(let $ of d.withheld)k(`Removed ${$.path} from the playground.`)}catch($){let E=$ instanceof Error?$.message:String($),z=d.withheld.map(W=>W.path);j("The playground still holds files this deploy did not publish"),g(` ${E}`),g(),z.length?(k(`Could not remove ${z.join(", ")} from the playground: ${E}`),k("Anything an earlier deploy put there is still being served.")):k("Anything an earlier deploy put there is still being served."),g(),process.exitCode=1}if(!U()&&T&&(g(),k(`Uploaded ${m.length} files from ${o}`),k(`Playground: ${Kd(T)}`),k(`Wired it to ${T.playerApiOrigin} as "${t}"`),q&&k("Added a replaceable starter favicon")),!T)throw new Error("The directory index was not uploaded.");return Kd(T)}async function E6(e,t,o,r){let n=!0;try{let p=je(await hn(o,"utf8"));p.ok&&(n=p.manifest.identity?.consent?.analytics_requires_consent!==!1)}catch{}let{consentGate:a}=await Promise.resolve().then(()=>(Zo(),nw)),i=r?await a(t,e,n):{status:"skipped",detail:"asked not to open a browser (--no-check)."};if(i.status==="verified"){O("Consent","a fan is asked before anything is recorded");return}i.status==="open"&&R("This game would record fans without asking them first, so nothing was published.",[i.detail??"","",`${v.cyan(re("verify"))} the same check, with the rest of them`]);let s="";try{s=await hn(t,"utf8")}catch{return}let l=/gamestage(\.min)?\.js|@monterosa\/gamestage/.test(s),d=/consentBanner\s*:\s*false/.test(s),m=/data-gs-component=["']consent["']|<Consent\b|game\.consent\.decide\(/.test(s);n&&(!l||d&&!m)&&R("This game does not ask fans for consent, so nothing was published.",[l?"The page turns the consent banner off and draws no consent screen of its own.":"The page does not load the Gamestage client, which draws the consent banner.",`${v.cyan(re("client"))} add the client, then deploy again`]),k(v.dim(`Consent checked by reading the page, not in a browser: ${i.detail??""}`.trim()))}async function $6(e,t){let o=!0;try{let a=je(await hn(t,"utf8"));a.ok&&(o=a.manifest.identity?.consent?.analytics_requires_consent!==!1)}catch{}if(!o)return;let r=hs.filter(a=>!e?.[a]?.trim()),n=e?.privacy_policy_url?.trim()??"";r.length===0&&/^https:\/\/[^\s]+$/.test(n)||R("The consent banner would not say who is asking, so nothing was published.",[r.length?`${On} has no ${r.join(" or ")}.`:`privacy_policy_url must be an https address, and is "${n}".`,"Add your brand as consent_brand_name and your privacy policy's address as","privacy_policy_url. A fan is told who is recording them before they answer."])}Wo();uo();ke();import{readFile as pC,stat as M6}from"node:fs/promises";import{createServer as F6}from"node:http";import{extname as U6,join as G6,normalize as B6,resolve as pw,sep as q6}from"node:path";ke();var iC="player-conformance",uw="round-current",A6="sha256:emulator-conformance";function jn(e){return structuredClone(e)}function fn(){return{server_time:"2026-08-01T09:00:00.000Z",snapshot:A6}}var C6="2026-08-01T08:00:00.000Z";function I6(e){let t=e==="per-player-challenge",o=e==="locked";return{...fn(),id:uw,number:412,version:2,...o?{locks_at:C6}:{},can:{accepting_plays:!o,results_available:!1,solution_revealed:!1,closed:!1,optimistic_play:!1},challenge_instance_id:t?"challenge-player-conformance":null,challenge:{prompt:"alpha"}}}function aC(e,t){let o=t==="mistakes";return{...fn(),player_id:iC,round_id:e,attempts_used:o?6:0,attempts_allowed:10,mistakes_used:o?2:0,mistakes_allowed:4,progress:o?{solved:["group-1"]}:{},score:o?10:0,score_revision:0,finished:!1,outcome:o?"incomplete":void 0}}function P6(e){let t=I6(e),o=new Map([[t.id,t]]),r=new Map([[t.id,aC(t.id,e)]]);return e==="solution-disclosure"&&(o.set("round-revealed",{...t,id:"round-revealed",number:411,version:3,can:{accepting_plays:!1,results_available:!0,solution_revealed:!0,closed:!0,optimistic_play:!1},solution:{answer:"revealed-alpha"}}),r.set("round-revealed",aC("round-revealed",e))),{runtime:{...fn(),game:"conformance-game",api_version:"2.0",archetype:e==="at-settlement"?"predict":"group",marking:e==="at-settlement"?"at_settlement":"at_commit",challenge_source:e==="per-player-challenge"?"per_player":"shared",schedule:{kind:"continuous"},updates:{transport:"poll",freshness_seconds:30},display:{title:"Conformance game"},identity:{required:!1,provider:"identify",anonymous_play:!0},archive:!0,capabilities:["plays","profile","leaderboard"]},rounds:o,roundStates:r,leaderboard:{...fn(),round_id:uw,order:"high_first",tie_break:"earliest_play",entries:[{rank:1,player_id:"player-example",display_name:"Example",score:20}],total:1,truncated:!1},profile:{...fn(),player_id:iC,display_name:"Example",played:0,won:0,current_streak:0,max_streak:0,distribution:{},constraints:{}},plays:new Map,intents:new Map,nextPlay:1}}function Yd(e,t){return{...fn(),play_id:`rejected-${e.nextPlay++}`,outcome:"rejected",reason:t,round_version:2,marked:!1,feedback:[]}}function mw(e){let t=P6(e);return{async getRuntime(){return jn(t.runtime)},async getCurrentRound(){return jn(t.rounds.get(uw))},async getRound(o){let r=t.rounds.get(o);return r?jn(r):void 0},async play(o,r){let n=t.rounds.get(o);if(!n)return Yd(t,"round_not_found");let a=bl({round_id:o,round_version:r.round_version,challenge_instance_id:r.challenge_instance_id,payload:r.payload}),i=t.plays.get(r.idempotency_key);if(i)return t.intents.get(r.idempotency_key)!==a?Yd(t,"idempotency_conflict"):{...jn(i),outcome:"duplicate"};if(r.round_version!==n.version)return{...fn(),play_id:`stale-${t.nextPlay++}`,outcome:"stale",reason:"round_version",round_version:n.version,marked:!1,feedback:[]};if(n.challenge_instance_id!==null&&r.challenge_instance_id!==n.challenge_instance_id)return Yd(t,"challenge_instance_id");if(n.locks_at!==void 0&&n.locks_at<=fn().server_time)return Yd(t,"lock_deadline_passed");let s=t.roundStates.get(o),l=t.runtime.marking==="at_settlement",d={...s,...fn(),attempts_used:s.attempts_used+1,score:s.score+(l?0:10),finished:!l,outcome:l?"pending":"won"},m={...fn(),play_id:`play-${t.nextPlay++}`,outcome:"accepted",round_version:n.version,marked:!l,feedback:l?[]:[{key:"answer",verdict:"correct"}],round_state:jn(d)};return t.roundStates.set(o,d),t.plays.set(r.idempotency_key,m),t.intents.set(r.idempotency_key,a),d.finished&&!s.finished&&(t.profile=yl(t.profile,d.outcome)),jn(m)},async getRoundState(o){let r=t.roundStates.get(o);if(!r)throw new Error(`No such round: ${o}`);return jn(r)},async getProfile(){return jn(t.profile)},async getLeaderboard(){return jn(t.leaderboard)}}}function O6(){return e=>mw(e)}var FX=O6();ke();import{createServer as z6}from"node:http";function Qo(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${t.replace(/\\\{[^}]+\\\}/g,"([^/]+)")}$`)}var R6=Qo(ze.runtime),sC=Qo(ze.currentRound),cC=Qo(ze.round),lC=Qo(ze.plays),dC=Qo(ze.roundState),N6=Qo(ze.profile),j6=Qo(ze.leaderboard),uC={"access-control-allow-origin":"*","access-control-allow-methods":"GET, POST, OPTIONS","access-control-allow-headers":"authorization, content-type, x-gamestage-player","access-control-max-age":"600"};function _o(e,t,o){let r=JSON.stringify(o);e.writeHead(t,{...uC,"content-type":"application/json; charset=utf-8","content-length":Buffer.byteLength(r)}),e.end(r)}function Xo(e,t,o,r){_o(e,t,{error:{code:o,message:r,retryable:!1}})}async function L6(e){let t=[];for await(let o of e)t.push(Buffer.from(o));if(t.length!==0)return JSON.parse(Buffer.concat(t).toString("utf8"))}async function D6(e,t,o,r,n){if(!e.url){Xo(t,400,"invalid_request","The request URL is missing.");return}let i=new URL(e.url,"http://localhost").pathname;if(e.method==="OPTIONS"){t.writeHead(204,uC),t.end();return}if(n&&(sC.test(i)||cC.test(i)||lC.test(i)||dC.test(i))){Xo(t,404,"no_round",n);return}if(e.method==="GET"){if(r&&/^\/(client\/[^/]+\/)?gamestage\.js$/.test(i)){t.writeHead(200,{"content-type":"text/javascript; charset=utf-8","cache-control":"no-store","access-control-allow-origin":"*","content-length":Buffer.byteLength(r)}),t.end(r);return}if(R6.test(i)){_o(t,200,await o.getRuntime());return}if(sC.test(i)){_o(t,200,await o.getCurrentRound());return}let s=cC.exec(i);if(s){let d=await o.getRound(decodeURIComponent(s[2]));if(!d){Xo(t,404,"round_not_found","The requested round was not found.");return}_o(t,200,d);return}let l=dC.exec(i);if(l){let d=decodeURIComponent(l[2]);try{_o(t,200,await o.getRoundState(d))}catch{Xo(t,404,"round_not_found","The requested round was not found.")}return}if(N6.test(i)){_o(t,200,await o.getProfile());return}if(j6.test(i)){_o(t,200,await o.getLeaderboard());return}}if(e.method==="POST"){let s=lC.exec(i);if(s){try{let l=await L6(e);_o(t,200,await o.play(decodeURIComponent(s[2]),l))}catch(l){Xo(t,400,"invalid_request",l instanceof SyntaxError?"The request body must be valid JSON.":"The request body is invalid.")}return}}Xo(t,404,"not_found","The requested player API route was not found.")}function Vd(e="default",t,o){let r=mw(e);return z6((n,a)=>{D6(n,a,r,t,o).catch(()=>{a.headersSent?a.destroy():Xo(a,500,"internal_error","The emulator could not answer the request.")})})}sn();Bd();ut();Zo();$e();async function W6(e){let t;try{t=await pC(e,"utf8")}catch{return}let o=je(t);if(!o.ok){R(`${e} is not a valid App Manifest.`,o.issues.map(r=>`${v.cyan(r.path)} ${r.message}`));return}return o.manifest}var H6={unconfigured:"No round yet. Set one up in Studio, or add one to gamestage.yaml to play it locally.","studio-round":"This game's round is in Studio, which gamestage dev cannot reach. Play the deployed game, or add a round to gamestage.yaml to play it locally."};async function K6(e){let t=Number(e.port);if(!Number.isInteger(t)||t<0||t>65535)throw new Error("--port must be an integer between 0 and 65535");let o=e.scenario??"default";if(e.fixture)return{server:Vd(o,Bt),what:"fixture",fixtureReason:"requested",game:"conformance-game"};let r=await W6(e.manifest??"gamestage.yaml");if(!r)return{server:Vd(o,Bt),what:"fixture",fixtureReason:"no-manifest",game:"conformance-game"};let n=r.backend.archetype,a=!r.backend.round&&n&&pn.includes(n)?ko(n):void 0,i=r.backend.round??a;if(!i){let l=r.interaction_cloud.elements.length?"studio-round":"unconfigured";return{server:Vd(o,Bt,H6[l]),what:"fixture",fixtureReason:l,game:r.app.id,title:r.app.title}}let s=r.backend.archetype;return s&&s!==i.archetype&&R(`The manifest declares the ${s} format and a ${i.archetype} round.`,["One of the two is wrong. The round decides what the Engine marks."]),pn.includes(i.archetype)||R(`No Engine here serves the ${i.archetype} format yet.`,[`Built so far: ${pn.join(", ")}. \`gamestage dev --fixture\` serves`,"the contract fixture if you are working against the wire rather than the rules."]),{server:await ma({game:r.app.id,round:i,title:r.app.title,identityRequired:!!e.as,clientBundle:Bt}),what:"engine",game:r.app.id,round:i,title:r.app.title,containerLabel:r.experience.container_label,as:e.as,...a?{sample:!0}:{}}}var Y6={".html":"text/html; charset=utf-8",".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".ico":"image/x-icon",".woff2":"font/woff2"};function V6(e,t){let o=(n,a)=>`if (!window.${n}) window.${n} = ${JSON.stringify(a)};
|
|
14161
|
+
`,n=e.search(/<script\b/i);if(n===-1){let a=e.search(/<\/head>/i);return a===-1?r+e:e.slice(0,a)+r+e.slice(a)}return e.slice(0,n)+r+e.slice(n)}async function Jo(e,t,o,r){let n=await fetch(e,{method:"PUT",body:typeof t=="string"?new Uint8Array(Buffer.from(t,"utf8")):t,headers:{"content-type":o,...r?{"cache-control":r}:{}}});n.ok||R(`Upload refused with ${n.status}. Ask for a fresh URL and retry.`)}function Kd(e){let t=new URL(e.publicUrl);return t.pathname=`/${e.key.split("/").map(encodeURIComponent).join("/")}`,t.search="",t.hash="",t.toString()}function b6(e){switch(l6(e).toLowerCase()){case".html":return"text/html; charset=utf-8";case".css":return"text/css; charset=utf-8";case".js":case".mjs":return"text/javascript; charset=utf-8";case".json":return"application/json; charset=utf-8";case".svg":return"image/svg+xml";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".ico":return"image/x-icon";case".webmanifest":return"application/manifest+json; charset=utf-8";case".wasm":return"application/wasm";default:return"application/octet-stream"}}async function oC(e,t,o,r,n,a){let i=Ql(a.settings,a.fallbackTitle),s=i.description??i.title,l=fo(o),d=await e.uploadTarget(t,ho),m=d.publicUrl.replace(/[^/]+$/,"index.html"),p=null,h=l.get("og:image")||void 0;if(!h&&r&&(h=d.publicUrl),!h){let y=await(a.draw??v$)(n??Ei(a.settings,i.title),i.description);y.png?(p=y.png,h=d.publicUrl,k(`Link preview: drew ${ho} (${1200}x${630}) from the game's name and strapline.`)):k(`Link preview: no ${ho} drawn (${y.reason}). The link will unfurl without a picture; add ${ho} at ${1200}x${630} to the game folder, or install Chrome and deploy again.`)}return{tags:{title:i.title,description:s,siteName:i.siteName,url:m,image:h,imageAlt:i.description?`${i.title}: ${i.description}`:i.title,imageWidth:1200,imageHeight:630},card:p}}async function rC(e,t,o){if(!o)return;let r=await e.uploadTarget(t,ho);await Jo(r.uploadUrl,o,"image/png",r.cacheControl)}async function v6(e,t,o,r={},n,a,i){let s=sw(o),l;try{l=aw(s)}catch{throw R(`Cannot read ${o}.`),new Error("unreachable")}let d=await Tb({path:s,relativePath:o},r.round);d&&R(`${o} ${d.why}`,["A deploy is a publishing act, and --file publishes this file as the game's","own page. Point --file at the game's HTML, or use --dir and let the gate","withhold what the page does not need."]),await a?.(s);let m=await e.uploadTarget(t,"index.html"),p=i?await oC(e,t,l.toString("utf8"),!1,n,i):null,h=p?ji(l.toString("utf8"),p.tags):l.toString("utf8");await rC(e,t,p?.card??null);let y=nC(q2(Pi(h),n),`${m.playerApiOrigin}`,t);await Jo(m.uploadUrl,y,"text/html; charset=utf-8",m.cacheControl);let w=await e.uploadTarget(t,ot);await Jo(w.uploadUrl,qr,"text/javascript; charset=utf-8",w.cacheControl);let I=await e.uploadTarget(t,qe);await Jo(I.uploadUrl,Bt,"text/javascript; charset=utf-8",I.cacheControl);let L=await e.uploadTarget(t,Pn);return await Jo(L.uploadUrl,Ii,"image/svg+xml",L.cacheControl),U()||(g(),k(`Uploaded ${o} to ${Kd(m)}`),k(`Wired it to ${m.playerApiOrigin} as "${t}"`),k(`Shipped @monterosa/gamestage beside it (${an})`),k(`Shipped the player client beside it (${Bo})`)),Kd(m)}async function w6(e,t,o,r,n){if(r||!e||!t)return;let{browserCheck:a}=await Promise.resolve().then(()=>(Zo(),nw));x6(await a(e,t,o,n))}function k6(e){let t=e??[],o=-1;return t.forEach((a,i)=>{/^Deployed /.test(a.message)&&(o=i)}),[...o>=0?t.slice(o):t.slice(-8)].reverse().find(a=>a.level==="error"&&/not on Interaction Cloud/.test(a.message))?.message.replace(/^The game is not on Interaction Cloud: /,"Studio answered: ")}function _6(e,t,o){let r=e.studioUrl??Ai(e.id);return[`${v.bold(`No ${t} yet: add one in Studio.`)}`,` ${v.cyan(r)}`,"",e.studioUrl?" The game is online and its Studio project exists, so a fan opening it now":" The game is online, and Stage links to its Studio project once it has one, so a fan opening it now",` finds nothing to play. Write the first ${t} in Studio and it appears`,` without another deploy. Share the game once a ${t} is on.`,"",` ${v.cyan(re("dev --serve"))} try the game on this machine with a sample ${o.toLowerCase()} meanwhile`]}function x6(e){if(e.status==="verified"){O("Checked","the page loads and plays in a browser"),g();return}if(e.status==="skipped"||e.status==="n/a"){k(v.dim(`Not checked in a browser: ${e.detail??""}`.trim())),g();return}j("The published page did not start"),g(` ${e.detail??""}`),g(),k("The files are published, so the game is live and broken rather than unpublished."),k(`${v.cyan(re("verify"))} the same check, with the rest of them`),g(),process.exitCode=1}function S6(e){for(let t of e.walkedPast)k(`Walked past ${t}: it is a toolchain directory, not your game.`);for(let t of e.allowed)k(`Published ${t.path} because you allowed it.`);for(let t of e.withheld)k(`Withheld ${t.path} from the upload: it ${t.why}`);e.refuse&&R(`${e.refuse.path} ${e.refuse.why}`,["A deploy is a publishing act, so this file would sit at a public URL beside","your game. Remove it from the directory, or point --dir at a directory that","does not contain it, and deploy again."])}async function T6(e,t,o,r={},n,a,i){let s,l=[];try{let $=Mi(o,{symlinks:"throw"});s=$.files,l=$.withheld}catch($){throw R($ instanceof Error?$.message:`Cannot read ${o}.`),new Error("unreachable")}let d=await p$(s,{...r,exempt:[qe,ot]});S6(d);let m=d.publish,p=m.find($=>$.relativePath==="index.html");p||R(`Directory ${o} must contain an index.html file.`),await a?.(p.path);let h=k$(m,l);j(`Publishing ${m.length} ${m.length===1?"file":"files"} to the playground`);for(let $ of h.lines)k($);h.named.length&&(g(),k("The lines above are named because they are not ordinary web assets. Anything there you did not mean to publish, stop and remove it: a deploy puts every one of these at a public URL beside your game.")),g();let y=aw(p.path,"utf8"),w=i?await oC(e,t,y,m.some($=>$.relativePath===ho),n,i):null,I=bb(y),L=m.some($=>$.relativePath==="favicon.ico"),J=m.some($=>$.relativePath===Pn),Q=!I&&!L,q=Q&&!J,_=rw();if(_!=="0.0.0-test"){let $=`${He}/client/${_}/${qe}`,E=!1;try{E=(await fetch($,{method:"HEAD"})).ok}catch{E=!0}E||R(`The client this deploy would pin, ${_}, is not published yet.`,[`Every page uploaded here will import ${$},`,"which answers 404 today. The game would load, fetch nothing, and show a","blank screen with no error anywhere.","","Deploy the site first: it is what serves /client/<version>/.","",`${v.cyan("node scripts/deploy.mjs site")} then run this deploy again`])}let T;for(let $ of m){if($.relativePath===qe||$.relativePath===ot)continue;let E;try{E=await e.uploadTarget(t,$.relativePath)}catch(ce){throw new Error(`${$.relativePath} cannot be published: ${ce instanceof Error?ce.message:String(ce)}`,{cause:ce})}$.relativePath==="index.html"&&(T=E);let z=aw($.path),W=/\.(m?js)$/i.test($.relativePath),ae=/\.html$/i.test($.relativePath)?nC(F2($.relativePath==="index.html"?q2((()=>{let ce=w?ji(z.toString("utf8"),w.tags):z.toString("utf8");return Q?Pi(ce):ce})(),n):z.toString("utf8"),rw()),E.playerApiOrigin,t):W?F2(z.toString("utf8"),rw()):z;await Jo(E.uploadUrl,ae,b6($.relativePath),E.cacheControl)}if(await rC(e,t,w?.card??null),q){let $=await e.uploadTarget(t,Pn);await Jo($.uploadUrl,Ii,"image/svg+xml",$.cacheControl)}let Y=[...m.map($=>$.relativePath),...q?[Pn]:[],...w?.card?[ho]:[]];try{await e.pruneBundle(t,Y);for(let $ of d.withheld)k(`Removed ${$.path} from the playground.`)}catch($){let E=$ instanceof Error?$.message:String($),z=d.withheld.map(W=>W.path);j("The playground still holds files this deploy did not publish"),g(` ${E}`),g(),z.length?(k(`Could not remove ${z.join(", ")} from the playground: ${E}`),k("Anything an earlier deploy put there is still being served.")):k("Anything an earlier deploy put there is still being served."),g(),process.exitCode=1}if(!U()&&T&&(g(),k(`Uploaded ${m.length} files from ${o}`),k(`Playground: ${Kd(T)}`),k(`Wired it to ${T.playerApiOrigin} as "${t}"`),q&&k("Added a replaceable starter favicon")),!T)throw new Error("The directory index was not uploaded.");return Kd(T)}async function E6(e,t,o,r){let n=!0;try{let p=je(await hn(o,"utf8"));p.ok&&(n=p.manifest.identity?.consent?.analytics_requires_consent!==!1)}catch{}let{consentGate:a}=await Promise.resolve().then(()=>(Zo(),nw)),i=r?await a(t,e,n):{status:"skipped",detail:"asked not to open a browser (--no-check)."};if(i.status==="verified"){O("Consent","a fan is asked before anything is recorded");return}i.status==="open"&&R("This game would record fans without asking them first, so nothing was published.",[i.detail??"","",`${v.cyan(re("verify"))} the same check, with the rest of them`]);let s="";try{s=await hn(t,"utf8")}catch{return}let l=/gamestage(\.min)?\.js|@monterosa\/gamestage/.test(s),d=/consentBanner\s*:\s*false/.test(s),m=/data-gs-component=["']consent["']|<Consent\b|game\.consent\.decide\(/.test(s);n&&(!l||d&&!m)&&R("This game does not ask fans for consent, so nothing was published.",[l?"The page turns the consent banner off and draws no consent screen of its own.":"The page does not load the Gamestage client, which draws the consent banner.",`${v.cyan(re("client"))} add the client, then deploy again`]),k(v.dim(`Consent checked by reading the page, not in a browser: ${i.detail??""}`.trim()))}async function $6(e,t){let o=!0;try{let a=je(await hn(t,"utf8"));a.ok&&(o=a.manifest.identity?.consent?.analytics_requires_consent!==!1)}catch{}if(!o)return;let r=hs.filter(a=>!e?.[a]?.trim()),n=e?.privacy_policy_url?.trim()??"";r.length===0&&/^https:\/\/[^\s]+$/.test(n)||R("The consent banner would not say who is asking, so nothing was published.",[r.length?`${On} has no ${r.join(" or ")}.`:`privacy_policy_url must be an https address, and is "${n}".`,"Add your brand as consent_brand_name and your privacy policy's address as","privacy_policy_url. A fan is told who is recording them before they answer."])}Wo();uo();ke();import{readFile as pC,stat as M6}from"node:fs/promises";import{createServer as F6}from"node:http";import{extname as U6,join as G6,normalize as B6,resolve as pw,sep as q6}from"node:path";ke();var iC="player-conformance",uw="round-current",A6="sha256:emulator-conformance";function jn(e){return structuredClone(e)}function fn(){return{server_time:"2026-08-01T09:00:00.000Z",snapshot:A6}}var C6="2026-08-01T08:00:00.000Z";function I6(e){let t=e==="per-player-challenge",o=e==="locked";return{...fn(),id:uw,number:412,version:2,...o?{locks_at:C6}:{},can:{accepting_plays:!o,results_available:!1,solution_revealed:!1,closed:!1,optimistic_play:!1},challenge_instance_id:t?"challenge-player-conformance":null,challenge:{prompt:"alpha"}}}function aC(e,t){let o=t==="mistakes";return{...fn(),player_id:iC,round_id:e,attempts_used:o?6:0,attempts_allowed:10,mistakes_used:o?2:0,mistakes_allowed:4,progress:o?{solved:["group-1"]}:{},score:o?10:0,score_revision:0,finished:!1,outcome:o?"incomplete":void 0}}function P6(e){let t=I6(e),o=new Map([[t.id,t]]),r=new Map([[t.id,aC(t.id,e)]]);return e==="solution-disclosure"&&(o.set("round-revealed",{...t,id:"round-revealed",number:411,version:3,can:{accepting_plays:!1,results_available:!0,solution_revealed:!0,closed:!0,optimistic_play:!1},solution:{answer:"revealed-alpha"}}),r.set("round-revealed",aC("round-revealed",e))),{runtime:{...fn(),game:"conformance-game",api_version:"2.0",archetype:e==="at-settlement"?"predict":"group",marking:e==="at-settlement"?"at_settlement":"at_commit",challenge_source:e==="per-player-challenge"?"per_player":"shared",schedule:{kind:"continuous"},updates:{transport:"poll",freshness_seconds:30},display:{title:"Conformance game"},identity:{required:!1,provider:"identify",anonymous_play:!0},archive:!0,capabilities:["plays","profile","leaderboard"]},rounds:o,roundStates:r,leaderboard:{...fn(),round_id:uw,order:"high_first",tie_break:"earliest_play",entries:[{rank:1,player_id:"player-example",display_name:"Example",score:20}],total:1,truncated:!1},profile:{...fn(),player_id:iC,display_name:"Example",played:0,won:0,current_streak:0,max_streak:0,distribution:{},constraints:{}},plays:new Map,intents:new Map,nextPlay:1}}function Yd(e,t){return{...fn(),play_id:`rejected-${e.nextPlay++}`,outcome:"rejected",reason:t,round_version:2,marked:!1,feedback:[]}}function mw(e){let t=P6(e);return{async getRuntime(){return jn(t.runtime)},async getCurrentRound(){return jn(t.rounds.get(uw))},async getRound(o){let r=t.rounds.get(o);return r?jn(r):void 0},async play(o,r){let n=t.rounds.get(o);if(!n)return Yd(t,"round_not_found");let a=bl({round_id:o,round_version:r.round_version,challenge_instance_id:r.challenge_instance_id,payload:r.payload}),i=t.plays.get(r.idempotency_key);if(i)return t.intents.get(r.idempotency_key)!==a?Yd(t,"idempotency_conflict"):{...jn(i),outcome:"duplicate"};if(r.round_version!==n.version)return{...fn(),play_id:`stale-${t.nextPlay++}`,outcome:"stale",reason:"round_version",round_version:n.version,marked:!1,feedback:[]};if(n.challenge_instance_id!==null&&r.challenge_instance_id!==n.challenge_instance_id)return Yd(t,"challenge_instance_id");if(n.locks_at!==void 0&&n.locks_at<=fn().server_time)return Yd(t,"lock_deadline_passed");let s=t.roundStates.get(o),l=t.runtime.marking==="at_settlement",d={...s,...fn(),attempts_used:s.attempts_used+1,score:s.score+(l?0:10),finished:!l,outcome:l?"pending":"won"},m={...fn(),play_id:`play-${t.nextPlay++}`,outcome:"accepted",round_version:n.version,marked:!l,feedback:l?[]:[{key:"answer",verdict:"correct"}],round_state:jn(d)};return t.roundStates.set(o,d),t.plays.set(r.idempotency_key,m),t.intents.set(r.idempotency_key,a),d.finished&&!s.finished&&(t.profile=yl(t.profile,d.outcome)),jn(m)},async getRoundState(o){let r=t.roundStates.get(o);if(!r)throw new Error(`No such round: ${o}`);return jn(r)},async getProfile(){return jn(t.profile)},async getLeaderboard(){return jn(t.leaderboard)}}}function O6(){return e=>mw(e)}var FX=O6();ke();import{createServer as z6}from"node:http";function Qo(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${t.replace(/\\\{[^}]+\\\}/g,"([^/]+)")}$`)}var R6=Qo(ze.runtime),sC=Qo(ze.currentRound),cC=Qo(ze.round),lC=Qo(ze.plays),dC=Qo(ze.roundState),N6=Qo(ze.profile),j6=Qo(ze.leaderboard),uC={"access-control-allow-origin":"*","access-control-allow-methods":"GET, POST, OPTIONS","access-control-allow-headers":"authorization, content-type, x-gamestage-player","access-control-max-age":"600"};function _o(e,t,o){let r=JSON.stringify(o);e.writeHead(t,{...uC,"content-type":"application/json; charset=utf-8","content-length":Buffer.byteLength(r)}),e.end(r)}function Xo(e,t,o,r){_o(e,t,{error:{code:o,message:r,retryable:!1}})}async function L6(e){let t=[];for await(let o of e)t.push(Buffer.from(o));if(t.length!==0)return JSON.parse(Buffer.concat(t).toString("utf8"))}async function D6(e,t,o,r,n){if(!e.url){Xo(t,400,"invalid_request","The request URL is missing.");return}let i=new URL(e.url,"http://localhost").pathname;if(e.method==="OPTIONS"){t.writeHead(204,uC),t.end();return}if(n&&(sC.test(i)||cC.test(i)||lC.test(i)||dC.test(i))){Xo(t,404,"no_round",n);return}if(e.method==="GET"){if(r&&/^\/(client\/[^/]+\/)?gamestage\.js$/.test(i)){t.writeHead(200,{"content-type":"text/javascript; charset=utf-8","cache-control":"no-store","access-control-allow-origin":"*","content-length":Buffer.byteLength(r)}),t.end(r);return}if(R6.test(i)){_o(t,200,await o.getRuntime());return}if(sC.test(i)){_o(t,200,await o.getCurrentRound());return}let s=cC.exec(i);if(s){let d=await o.getRound(decodeURIComponent(s[2]));if(!d){Xo(t,404,"round_not_found","The requested round was not found.");return}_o(t,200,d);return}let l=dC.exec(i);if(l){let d=decodeURIComponent(l[2]);try{_o(t,200,await o.getRoundState(d))}catch{Xo(t,404,"round_not_found","The requested round was not found.")}return}if(N6.test(i)){_o(t,200,await o.getProfile());return}if(j6.test(i)){_o(t,200,await o.getLeaderboard());return}}if(e.method==="POST"){let s=lC.exec(i);if(s){try{let l=await L6(e);_o(t,200,await o.play(decodeURIComponent(s[2]),l))}catch(l){Xo(t,400,"invalid_request",l instanceof SyntaxError?"The request body must be valid JSON.":"The request body is invalid.")}return}}Xo(t,404,"not_found","The requested player API route was not found.")}function Vd(e="default",t,o){let r=mw(e);return z6((n,a)=>{D6(n,a,r,t,o).catch(()=>{a.headersSent?a.destroy():Xo(a,500,"internal_error","The emulator could not answer the request.")})})}sn();Bd();ut();Zo();$e();async function W6(e){let t;try{t=await pC(e,"utf8")}catch{return}let o=je(t);if(!o.ok){R(`${e} is not a valid App Manifest.`,o.issues.map(r=>`${v.cyan(r.path)} ${r.message}`));return}return o.manifest}var H6={unconfigured:"No round yet. Set one up in Studio, or add one to gamestage.yaml to play it locally.","studio-round":"This game's round is in Studio, which gamestage dev cannot reach. Play the deployed game, or add a round to gamestage.yaml to play it locally."};async function K6(e){let t=Number(e.port);if(!Number.isInteger(t)||t<0||t>65535)throw new Error("--port must be an integer between 0 and 65535");let o=e.scenario??"default";if(e.fixture)return{server:Vd(o,Bt),what:"fixture",fixtureReason:"requested",game:"conformance-game"};let r=await W6(e.manifest??"gamestage.yaml");if(!r)return{server:Vd(o,Bt),what:"fixture",fixtureReason:"no-manifest",game:"conformance-game"};let n=r.backend.archetype,a=!r.backend.round&&n&&pn.includes(n)?ko(n):void 0,i=r.backend.round??a;if(!i){let l=r.interaction_cloud.elements.length?"studio-round":"unconfigured";return{server:Vd(o,Bt,H6[l]),what:"fixture",fixtureReason:l,game:r.app.id,title:r.app.title}}let s=r.backend.archetype;return s&&s!==i.archetype&&R(`The manifest declares the ${s} format and a ${i.archetype} round.`,["One of the two is wrong. The round decides what the Engine marks."]),pn.includes(i.archetype)||R(`No Engine here serves the ${i.archetype} format yet.`,[`Built so far: ${pn.join(", ")}. \`gamestage dev --fixture\` serves`,"the contract fixture if you are working against the wire rather than the rules."]),{server:await ma({game:r.app.id,round:i,title:r.app.title,identityRequired:!!e.as,clientBundle:Bt}),what:"engine",game:r.app.id,round:i,title:r.app.title,containerLabel:r.experience.container_label,as:e.as,...a?{sample:!0}:{}}}var Y6={".html":"text/html; charset=utf-8",".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".ico":"image/x-icon",".woff2":"font/woff2"};function V6(e,t){let o=(n,a)=>`if (!window.${n}) window.${n} = ${JSON.stringify(a)};
|
|
13991
14162
|
`,r="<script>\n// Added by `gamestage dev --serve` as it served this page. Not in your file.\n"+o("GAMESTAGE_API",t.api)+o("GAMESTAGE_GAME",t.game)+(t.token?o("GAMESTAGE_TOKEN",t.token):"")+(t.presentation?`if (!window.GAMESTAGE_PRESENTATION) window.GAMESTAGE_PRESENTATION = ${JSON.stringify(t.presentation)};
|
|
13992
14163
|
`:"")+`</script>
|
|
13993
14164
|
`;return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>`${n}
|
package/package.json
CHANGED