gamestage 0.35.31 → 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.
Files changed (2) hide show
  1. package/cli.mjs +176 -5
  2. 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
- if (!first.ok) throw first.cause;
9484
- sampleIso(platform.clock, first.value.server_time);
9485
- round = first.value;
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="6fc943126f4e07dc",qe="gamestage.js",IE="0.66.22",xN=`<!doctype html>
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.31",$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">
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gamestage",
3
- "version": "0.35.31",
3
+ "version": "0.35.32",
4
4
  "description": "Take a browser game to production: answers, scoring, locks and settlement behind a server the player cannot edit.",
5
5
  "bin": {
6
6
  "gamestage": "./cli.mjs"