playcademy 0.14.21 → 0.14.23

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/index.js CHANGED
@@ -2196,10 +2196,15 @@ function getAddDevDependencyCommand(pm, packageName) {
2196
2196
  }
2197
2197
 
2198
2198
  // src/constants/api.ts
2199
+ import { join as join3 } from "node:path";
2200
+
2201
+ // src/constants/server.ts
2199
2202
  import { join as join2 } from "node:path";
2200
- var DEFAULT_API_ROUTES_DIRECTORY = join2("server", "api");
2201
2203
  var SERVER_ROOT_DIRECTORY = "server";
2202
- var SERVER_LIB_DIRECTORY = join2("server", "lib");
2204
+ var SERVER_LIB_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "lib");
2205
+
2206
+ // src/constants/api.ts
2207
+ var DEFAULT_API_ROUTES_DIRECTORY = join3(SERVER_ROOT_DIRECTORY, "api");
2203
2208
  var AUTH_API_SUBDIRECTORY = "auth";
2204
2209
  var SAMPLE_API_SUBDIRECTORY = "sample";
2205
2210
  var SAMPLE_CUSTOM_FILENAME = "custom.ts";
@@ -2340,12 +2345,20 @@ var ENV_FILES = [
2340
2345
  // Overrides all (highest priority)
2341
2346
  ];
2342
2347
  var ENV_EXAMPLE_FILE = ".env.example";
2348
+ var TSCONFIG_JSON = "tsconfig.json";
2349
+ var TSCONFIG_APP_JSON = "tsconfig.app.json";
2343
2350
  var TSCONFIG_FILES = [
2344
- "tsconfig.app.json",
2351
+ TSCONFIG_APP_JSON,
2345
2352
  // Modern tooling (try first)
2346
- "tsconfig.json"
2353
+ TSCONFIG_JSON
2347
2354
  // Standard (fallback)
2348
2355
  ];
2356
+ var TSCONFIG_REQUIRED_INCLUDES = [
2357
+ "playcademy-env.d.ts",
2358
+ // Generated type definitions
2359
+ "server"
2360
+ // Server-side code
2361
+ ];
2349
2362
 
2350
2363
  // src/constants/bucket.ts
2351
2364
  var BUCKET_ALWAYS_SKIP = [".git", ".DS_Store", ".gitignore", ...ENV_FILES];
@@ -2363,8 +2376,8 @@ var CLOUDFLARE_BINDINGS = {
2363
2376
  var MINIFLARE_D1_DIRECTORY = "miniflare-D1DatabaseObject";
2364
2377
 
2365
2378
  // src/constants/database.ts
2366
- import { join as join3 } from "path";
2367
- var DEFAULT_DATABASE_DIRECTORY = join3("server", "db");
2379
+ import { join as join4 } from "path";
2380
+ var DEFAULT_DATABASE_DIRECTORY = join4("server", "db");
2368
2381
  var SCHEMA_SUBDIRECTORY = "schema";
2369
2382
  var DB_FILES = {
2370
2383
  /** Index file name */
@@ -2381,7 +2394,7 @@ var DB_FILES = {
2381
2394
  var DRIZZLE_CONFIG_FILES = ["drizzle.config.ts", "drizzle.config.js"];
2382
2395
 
2383
2396
  // src/constants/godot.ts
2384
- import { join as join4 } from "node:path";
2397
+ import { join as join5 } from "node:path";
2385
2398
  var GODOT_PROJECT_FILE = "project.godot";
2386
2399
  var GODOT_EXPORT_PRESETS_FILE = "export_presets.cfg";
2387
2400
  var GODOT_WEB_PLATFORM = 'platform="Web"';
@@ -2389,13 +2402,13 @@ var GODOT_BUILD_DIRECTORIES = {
2389
2402
  /** Root build directory (cleared before each export) */
2390
2403
  ROOT: "build",
2391
2404
  /** Web export subdirectory */
2392
- WEB: join4("build", "web")
2405
+ WEB: join5("build", "web")
2393
2406
  };
2394
2407
  var GODOT_BUILD_OUTPUTS = {
2395
2408
  /** Exported web build entry point */
2396
- INDEX_HTML: join4("build", "web", "index.html"),
2409
+ INDEX_HTML: join5("build", "web", "index.html"),
2397
2410
  /** Packaged zip file (created by Godot export) */
2398
- ZIP: join4("build", "web_playcademy.zip")
2411
+ ZIP: join5("build", "web_playcademy.zip")
2399
2412
  };
2400
2413
  var GODOT_EXECUTABLE_PATTERNS = {
2401
2414
  /** macOS app bundle suffix */
@@ -2418,17 +2431,17 @@ var CALLBACK_PATH = "/callback";
2418
2431
  var SSO_AUTH_TIMEOUT_MS = 3e4;
2419
2432
 
2420
2433
  // src/constants/paths.ts
2421
- import { join as join5 } from "path";
2434
+ import { join as join6 } from "path";
2422
2435
  var WORKSPACE_NAME = ".playcademy";
2423
2436
  var CLI_DIRECTORIES = {
2424
2437
  /** Root directory for CLI artifacts in workspace */
2425
2438
  WORKSPACE: WORKSPACE_NAME,
2426
2439
  /** Database directory within workspace */
2427
- DATABASE: join5(WORKSPACE_NAME, "db"),
2440
+ DATABASE: join6(WORKSPACE_NAME, "db"),
2428
2441
  /** KV storage directory within workspace */
2429
- KV: join5(WORKSPACE_NAME, "kv"),
2442
+ KV: join6(WORKSPACE_NAME, "kv"),
2430
2443
  /** Bucket storage directory within workspace */
2431
- BUCKET: join5(WORKSPACE_NAME, "bucket")
2444
+ BUCKET: join6(WORKSPACE_NAME, "bucket")
2432
2445
  };
2433
2446
  var CLI_USER_DIRECTORIES = {
2434
2447
  /** User config directory for auth, games store, etc. */
@@ -2436,7 +2449,7 @@ var CLI_USER_DIRECTORIES = {
2436
2449
  };
2437
2450
  var CLI_DEFAULT_OUTPUTS = {
2438
2451
  /** Default worker bundle output for debug command */
2439
- WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
2452
+ WORKER_BUNDLE: join6(WORKSPACE_NAME, "worker-bundle.js")
2440
2453
  };
2441
2454
  var CLI_FILES = {
2442
2455
  /** Auth store file in user config directory */
@@ -2471,7 +2484,7 @@ import { PlaycademyClient } from "@playcademy/sdk/internal";
2471
2484
  // src/lib/auth/storage.ts
2472
2485
  import { access, mkdir, readFile as readFile2, writeFile } from "node:fs/promises";
2473
2486
  import { homedir } from "node:os";
2474
- import { join as join6 } from "node:path";
2487
+ import { join as join7 } from "node:path";
2475
2488
 
2476
2489
  // src/lib/core/context.ts
2477
2490
  import { existsSync as existsSync3 } from "fs";
@@ -3501,10 +3514,10 @@ function getWebBaseUrl(apiBaseUrl) {
3501
3514
 
3502
3515
  // src/lib/auth/storage.ts
3503
3516
  function getAuthPath() {
3504
- return join6(homedir(), CLI_USER_DIRECTORIES.CONFIG, CLI_FILES.AUTH_STORE);
3517
+ return join7(homedir(), CLI_USER_DIRECTORIES.CONFIG, CLI_FILES.AUTH_STORE);
3505
3518
  }
3506
3519
  async function ensureAuthDir() {
3507
- const authDir = join6(homedir(), CLI_USER_DIRECTORIES.CONFIG);
3520
+ const authDir = join7(homedir(), CLI_USER_DIRECTORIES.CONFIG);
3508
3521
  await mkdir(authDir, { recursive: true });
3509
3522
  }
3510
3523
  function createEmptyEnvironmentProfiles() {
@@ -3737,7 +3750,7 @@ function formatErrorAndExit(error, code = 1) {
3737
3750
  // src/lib/secrets/env.ts
3738
3751
  init_file_loader();
3739
3752
  import { existsSync as existsSync4, writeFileSync } from "fs";
3740
- import { join as join7 } from "path";
3753
+ import { join as join8 } from "path";
3741
3754
  function parseEnvFile(contents) {
3742
3755
  const secrets = {};
3743
3756
  for (const line of contents.split("\n")) {
@@ -3773,13 +3786,13 @@ async function readEnvFile(workspace) {
3773
3786
  return secrets;
3774
3787
  }
3775
3788
  function getLoadedEnvFiles(workspace) {
3776
- return ENV_FILES.filter((filename) => existsSync4(join7(workspace, filename)));
3789
+ return ENV_FILES.filter((filename) => existsSync4(join8(workspace, filename)));
3777
3790
  }
3778
3791
  function hasEnvFile(workspace) {
3779
- return ENV_FILES.some((filename) => existsSync4(join7(workspace, filename)));
3792
+ return ENV_FILES.some((filename) => existsSync4(join8(workspace, filename)));
3780
3793
  }
3781
3794
  async function updateEnvExample(workspace, lines) {
3782
- const envExamplePath = join7(workspace, ENV_EXAMPLE_FILE);
3795
+ const envExamplePath = join8(workspace, ENV_EXAMPLE_FILE);
3783
3796
  let existing = "";
3784
3797
  if (existsSync4(envExamplePath)) {
3785
3798
  const loaded = await loadFile(envExamplePath);
@@ -5281,12 +5294,12 @@ async function getGameFromConfig(client) {
5281
5294
 
5282
5295
  // src/lib/core/gitignore.ts
5283
5296
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
5284
- import { join as join8, sep } from "path";
5297
+ import { join as join9, sep } from "path";
5285
5298
  function normalizeGitignoreEntry(entry) {
5286
5299
  return entry.replace(/^\/+/, "").replace(/\/+$/, "");
5287
5300
  }
5288
5301
  function loadGitignorePatterns(directory) {
5289
- const gitignorePath = join8(directory, ".gitignore");
5302
+ const gitignorePath = join9(directory, ".gitignore");
5290
5303
  if (!existsSync6(gitignorePath)) {
5291
5304
  return [];
5292
5305
  }
@@ -5327,12 +5340,12 @@ function isIgnoredByGitignore(filePath, patterns) {
5327
5340
  // src/lib/core/import.ts
5328
5341
  import { mkdtempSync, rmSync } from "fs";
5329
5342
  import { tmpdir } from "os";
5330
- import { join as join9 } from "path";
5343
+ import { join as join10 } from "path";
5331
5344
  import { pathToFileURL } from "url";
5332
5345
  import * as esbuild from "esbuild";
5333
5346
  async function importTypescriptFile(filePath, bundleOptions) {
5334
- const tempDir = mkdtempSync(join9(tmpdir(), "playcademy-import-"));
5335
- const outFile = join9(tempDir, "bundle.mjs");
5347
+ const tempDir = mkdtempSync(join10(tmpdir(), "playcademy-import-"));
5348
+ const outFile = join10(tempDir, "bundle.mjs");
5336
5349
  try {
5337
5350
  await esbuild.build({
5338
5351
  entryPoints: [filePath],
@@ -5411,11 +5424,11 @@ import { bold as bold4, cyan as cyan2 } from "colorette";
5411
5424
 
5412
5425
  // src/lib/init/scaffold.ts
5413
5426
  import { existsSync as existsSync9, mkdirSync as mkdirSync3, writeFileSync as writeFileSync5 } from "fs";
5414
- import { join as join12, resolve as resolve5 } from "path";
5427
+ import { join as join13, resolve as resolve5 } from "path";
5415
5428
 
5416
5429
  // src/lib/init/auth.ts
5417
5430
  import { existsSync as existsSync7, mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
5418
- import { join as join10 } from "path";
5431
+ import { join as join11 } from "path";
5419
5432
  var authTemplate = loadTemplateString("auth/auth.ts");
5420
5433
  var authCatchAllTemplate = loadTemplateString("auth/auth-catch-all.ts");
5421
5434
  var authSchemaTemplate = loadTemplateString("auth/auth-schema.ts");
@@ -5457,28 +5470,28 @@ function generateAuthConfig(strategies, gameName) {
5457
5470
  return authContent;
5458
5471
  }
5459
5472
  function scaffoldAuthConfig(workspace, authContent) {
5460
- const libDir = join10(workspace, SERVER_LIB_DIRECTORY);
5473
+ const libDir = join11(workspace, SERVER_LIB_DIRECTORY);
5461
5474
  if (!existsSync7(libDir)) {
5462
5475
  mkdirSync(libDir, { recursive: true });
5463
5476
  }
5464
- writeFileSync3(join10(libDir, AUTH_CONFIG_FILE), authContent);
5477
+ writeFileSync3(join11(libDir, AUTH_CONFIG_FILE), authContent);
5465
5478
  }
5466
5479
  function scaffoldAuthRoutes(workspace) {
5467
- const apiDir = join10(workspace, DEFAULT_API_ROUTES_DIRECTORY);
5468
- const authApiDir = join10(apiDir, AUTH_API_SUBDIRECTORY);
5480
+ const apiDir = join11(workspace, DEFAULT_API_ROUTES_DIRECTORY);
5481
+ const authApiDir = join11(apiDir, AUTH_API_SUBDIRECTORY);
5469
5482
  if (!existsSync7(authApiDir)) {
5470
5483
  mkdirSync(authApiDir, { recursive: true });
5471
5484
  }
5472
- writeFileSync3(join10(authApiDir, "[...all].ts"), authCatchAllTemplate);
5485
+ writeFileSync3(join11(authApiDir, "[...all].ts"), authCatchAllTemplate);
5473
5486
  }
5474
5487
  function scaffoldAuthSchema(workspace) {
5475
- const dbDir = join10(workspace, DEFAULT_DATABASE_DIRECTORY);
5476
- const schemaDir = join10(dbDir, SCHEMA_SUBDIRECTORY);
5488
+ const dbDir = join11(workspace, DEFAULT_DATABASE_DIRECTORY);
5489
+ const schemaDir = join11(dbDir, SCHEMA_SUBDIRECTORY);
5477
5490
  if (!existsSync7(schemaDir)) {
5478
5491
  mkdirSync(schemaDir, { recursive: true });
5479
5492
  }
5480
- writeFileSync3(join10(schemaDir, "auth.ts"), authSchemaTemplate);
5481
- const schemaIndexPath = join10(schemaDir, DB_FILES.SCHEMA_INDEX);
5493
+ writeFileSync3(join11(schemaDir, "auth.ts"), authSchemaTemplate);
5494
+ const schemaIndexPath = join11(schemaDir, DB_FILES.SCHEMA_INDEX);
5482
5495
  if (existsSync7(schemaIndexPath)) {
5483
5496
  const existing = readFileSync4(schemaIndexPath, "utf-8");
5484
5497
  if (!existing.includes("export * from './auth'")) {
@@ -5489,12 +5502,12 @@ function scaffoldAuthSchema(workspace) {
5489
5502
  }
5490
5503
  }
5491
5504
  function scaffoldProtectedExample(workspace) {
5492
- const apiDir = join10(workspace, DEFAULT_API_ROUTES_DIRECTORY);
5493
- const sampleDir = join10(apiDir, SAMPLE_API_SUBDIRECTORY);
5505
+ const apiDir = join11(workspace, DEFAULT_API_ROUTES_DIRECTORY);
5506
+ const sampleDir = join11(apiDir, SAMPLE_API_SUBDIRECTORY);
5494
5507
  if (!existsSync7(sampleDir)) {
5495
5508
  mkdirSync(sampleDir, { recursive: true });
5496
5509
  }
5497
- writeFileSync3(join10(sampleDir, "protected.ts"), protectedRouteTemplate);
5510
+ writeFileSync3(join11(sampleDir, "protected.ts"), protectedRouteTemplate);
5498
5511
  }
5499
5512
  function updateEnvForAuth(workspace, strategies) {
5500
5513
  const envLines = [];
@@ -5536,7 +5549,7 @@ async function scaffoldAuthSetup(options = {}) {
5536
5549
  return packagesUpdated;
5537
5550
  }
5538
5551
  async function setupPackageJson(workspace) {
5539
- const pkgPath = join10(workspace, "package.json");
5552
+ const pkgPath = join11(workspace, "package.json");
5540
5553
  const authDeps = {
5541
5554
  "@playcademy/better-auth": PLAYCADEMY_AUTH_VERSION,
5542
5555
  "better-auth": BETTER_AUTH_VERSION
@@ -5557,18 +5570,18 @@ async function setupPackageJson(workspace) {
5557
5570
  }
5558
5571
  function hasAuthSetup() {
5559
5572
  const workspace = getWorkspace();
5560
- const authPath = join10(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
5573
+ const authPath = join11(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
5561
5574
  return existsSync7(authPath);
5562
5575
  }
5563
5576
 
5564
5577
  // src/lib/init/database.ts
5565
5578
  import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
5566
- import { join as join11 } from "path";
5579
+ import { join as join12 } from "path";
5567
5580
 
5568
5581
  // package.json
5569
5582
  var package_default2 = {
5570
5583
  name: "playcademy",
5571
- version: "0.14.20",
5584
+ version: "0.14.22",
5572
5585
  type: "module",
5573
5586
  exports: {
5574
5587
  ".": {
@@ -5659,25 +5672,25 @@ async function scaffoldDatabaseSetup(options) {
5659
5672
  await runStep(
5660
5673
  "Configuring database...",
5661
5674
  async () => {
5662
- const dbDir = join11(workspace, DEFAULT_DATABASE_DIRECTORY);
5663
- const schemaDir = join11(dbDir, SCHEMA_SUBDIRECTORY);
5675
+ const dbDir = join12(workspace, DEFAULT_DATABASE_DIRECTORY);
5676
+ const schemaDir = join12(dbDir, SCHEMA_SUBDIRECTORY);
5664
5677
  if (!existsSync8(dbDir)) {
5665
5678
  mkdirSync2(dbDir, { recursive: true });
5666
5679
  }
5667
5680
  if (!existsSync8(schemaDir)) {
5668
5681
  mkdirSync2(schemaDir, { recursive: true });
5669
5682
  }
5670
- const exampleSchemaPath = join11(schemaDir, DB_FILES.EXAMPLE_SCHEMA);
5683
+ const exampleSchemaPath = join12(schemaDir, DB_FILES.EXAMPLE_SCHEMA);
5671
5684
  writeFileSync4(exampleSchemaPath, dbSchemaExampleTemplate);
5672
- const schemaIndexPath = join11(schemaDir, DB_FILES.SCHEMA_INDEX);
5685
+ const schemaIndexPath = join12(schemaDir, DB_FILES.SCHEMA_INDEX);
5673
5686
  writeFileSync4(schemaIndexPath, dbSchemaIndexTemplate);
5674
- const dbIndexPath = join11(dbDir, DB_FILES.INDEX);
5687
+ const dbIndexPath = join12(dbDir, DB_FILES.INDEX);
5675
5688
  writeFileSync4(dbIndexPath, dbIndexTemplate);
5676
- const dbTypesPath = join11(dbDir, DB_FILES.TYPES);
5689
+ const dbTypesPath = join12(dbDir, DB_FILES.TYPES);
5677
5690
  writeFileSync4(dbTypesPath, dbTypesTemplate);
5678
- const dbSeedPath = join11(dbDir, DB_FILES.SEED);
5691
+ const dbSeedPath = join12(dbDir, DB_FILES.SEED);
5679
5692
  writeFileSync4(dbSeedPath, dbSeedTemplate);
5680
- const drizzleConfigPath = join11(workspace, DRIZZLE_CONFIG_FILES[0]);
5693
+ const drizzleConfigPath = join12(workspace, DRIZZLE_CONFIG_FILES[0]);
5681
5694
  writeFileSync4(drizzleConfigPath, drizzleConfigTemplate);
5682
5695
  packagesUpdated = await setupPackageJson2(workspace, options.gameName);
5683
5696
  },
@@ -5686,7 +5699,7 @@ async function scaffoldDatabaseSetup(options) {
5686
5699
  return packagesUpdated;
5687
5700
  }
5688
5701
  async function setupPackageJson2(workspace, gameName) {
5689
- const pkgPath = join11(workspace, "package.json");
5702
+ const pkgPath = join12(workspace, "package.json");
5690
5703
  const dbDeps = {
5691
5704
  "drizzle-orm": "^0.42.0",
5692
5705
  "better-sqlite3": "^12.0.0"
@@ -5728,7 +5741,7 @@ async function setupPackageJson2(workspace, gameName) {
5728
5741
  }
5729
5742
  function hasDatabaseSetup() {
5730
5743
  const workspace = getWorkspace();
5731
- return DRIZZLE_CONFIG_FILES.some((filename) => existsSync8(join11(workspace, filename)));
5744
+ return DRIZZLE_CONFIG_FILES.some((filename) => existsSync8(join12(workspace, filename)));
5732
5745
  }
5733
5746
 
5734
5747
  // src/lib/init/scaffold.ts
@@ -5739,7 +5752,7 @@ var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
5739
5752
  var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
5740
5753
  async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
5741
5754
  const apiPath = resolve5(getWorkspace(), apiDirectory);
5742
- const samplePath = join12(apiPath, "sample");
5755
+ const samplePath = join13(apiPath, "sample");
5743
5756
  if (!existsSync9(apiPath)) {
5744
5757
  mkdirSync3(apiPath, { recursive: true });
5745
5758
  }
@@ -5747,7 +5760,7 @@ async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
5747
5760
  mkdirSync3(samplePath, { recursive: true });
5748
5761
  }
5749
5762
  for (const route of sampleRoutes) {
5750
- writeFileSync5(join12(samplePath, route.filename), route.template, "utf-8");
5763
+ writeFileSync5(join13(samplePath, route.filename), route.template, "utf-8");
5751
5764
  }
5752
5765
  }
5753
5766
  async function scaffoldSampleFileIfMissing(config, sampleFilename, template) {
@@ -5763,7 +5776,7 @@ async function scaffoldSampleFileIfMissing(config, sampleFilename, template) {
5763
5776
  }
5764
5777
  await scaffoldApiDirectory(customRoutesDir, [{ filename: sampleFilename, template }]);
5765
5778
  logger.success(
5766
- `Created sample route: <${join12(customRoutesDir, SAMPLE_API_SUBDIRECTORY, sampleFilename)}>`
5779
+ `Created sample route: <${join13(customRoutesDir, SAMPLE_API_SUBDIRECTORY, sampleFilename)}>`
5767
5780
  );
5768
5781
  return true;
5769
5782
  }
@@ -5776,11 +5789,11 @@ function validateApiDirectoryDoesNotExist(value) {
5776
5789
  }
5777
5790
  function ensurePlaycademyGitignore() {
5778
5791
  const workspace = getWorkspace();
5779
- const playcademyDir = join12(workspace, CLI_DIRECTORIES.WORKSPACE);
5792
+ const playcademyDir = join13(workspace, CLI_DIRECTORIES.WORKSPACE);
5780
5793
  if (!existsSync9(playcademyDir)) {
5781
5794
  mkdirSync3(playcademyDir, { recursive: true });
5782
5795
  }
5783
- const gitignorePath = join12(playcademyDir, ".gitignore");
5796
+ const gitignorePath = join13(playcademyDir, ".gitignore");
5784
5797
  writeFileSync5(gitignorePath, playcademyGitignoreTemplate);
5785
5798
  }
5786
5799
  async function scaffoldIntegrations(gameName, options) {
@@ -6095,16 +6108,16 @@ function hasBucketSetup(config) {
6095
6108
  init_file_loader();
6096
6109
  import { execSync as execSync3 } from "child_process";
6097
6110
  import { existsSync as existsSync12, writeFileSync as writeFileSync7 } from "fs";
6098
- import { dirname as dirname4, join as join15 } from "path";
6111
+ import { dirname as dirname4, join as join16 } from "path";
6099
6112
  import { fileURLToPath as fileURLToPath2 } from "url";
6100
6113
 
6101
6114
  // src/lib/deploy/backend.ts
6102
6115
  import { existsSync as existsSync10 } from "node:fs";
6103
- import { join as join13 } from "node:path";
6116
+ import { join as join14 } from "node:path";
6104
6117
  function getCustomRoutesDirectory(projectPath, config) {
6105
6118
  const customRoutes = config?.integrations?.customRoutes;
6106
6119
  const customRoutesDir = typeof customRoutes === "object" && customRoutes.directory || DEFAULT_API_ROUTES_DIRECTORY;
6107
- return join13(projectPath, customRoutesDir);
6120
+ return join14(projectPath, customRoutesDir);
6108
6121
  }
6109
6122
  function hasLocalCustomRoutes(projectPath, config) {
6110
6123
  const customRoutesDir = getCustomRoutesDirectory(projectPath, config);
@@ -6121,7 +6134,7 @@ async function hasBackendChanged(previousHash, currentHash) {
6121
6134
  }
6122
6135
  async function getDirectorySize(dirPath) {
6123
6136
  const { stat: stat2, readdir } = await import("node:fs/promises");
6124
- const { join: join49 } = await import("node:path");
6137
+ const { join: join50 } = await import("node:path");
6125
6138
  if (!existsSync10(dirPath)) {
6126
6139
  return null;
6127
6140
  }
@@ -6130,7 +6143,7 @@ async function getDirectorySize(dirPath) {
6130
6143
  async function calculateSize(dir) {
6131
6144
  const entries = await readdir(dir, { withFileTypes: true });
6132
6145
  for (const entry of entries) {
6133
- const fullPath = join49(dir, entry.name);
6146
+ const fullPath = join50(dir, entry.name);
6134
6147
  if (entry.isDirectory()) {
6135
6148
  await calculateSize(fullPath);
6136
6149
  } else if (entry.isFile()) {
@@ -6149,15 +6162,22 @@ async function getDirectorySize(dirPath) {
6149
6162
  // src/lib/init/tsconfig.ts
6150
6163
  init_file_loader();
6151
6164
  import { existsSync as existsSync11, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
6152
- import { join as join14 } from "path";
6153
- function hasPlaycademyEnv(config) {
6154
- return config.include?.includes("playcademy-env.d.ts") ?? false;
6165
+ import { join as join15 } from "path";
6166
+ function hasAllRequiredIncludes(config) {
6167
+ if (!config.include) return false;
6168
+ return TSCONFIG_REQUIRED_INCLUDES.every((entry) => config.include.includes(entry));
6169
+ }
6170
+ function getMissingIncludes(config) {
6171
+ if (!config.include) return [...TSCONFIG_REQUIRED_INCLUDES];
6172
+ return TSCONFIG_REQUIRED_INCLUDES.filter((entry) => !config.include.includes(entry));
6155
6173
  }
6156
- function addPlaycademyEnv(config) {
6174
+ function addRequiredIncludes(config) {
6157
6175
  if (!config.include) {
6158
6176
  config.include = [];
6159
6177
  }
6160
- config.include.push("playcademy-env.d.ts");
6178
+ for (const entry of getMissingIncludes(config)) {
6179
+ config.include.push(entry);
6180
+ }
6161
6181
  }
6162
6182
  function updateExistingIncludeArray(content) {
6163
6183
  const includeRegex = /"include"\s*:\s*\[([^\]]*)\]/;
@@ -6167,20 +6187,24 @@ function updateExistingIncludeArray(content) {
6167
6187
  }
6168
6188
  const fullMatch = match[0];
6169
6189
  const arrayContents = match[1];
6170
- if (arrayContents.includes("playcademy-env.d.ts")) {
6190
+ const missingEntries = TSCONFIG_REQUIRED_INCLUDES.filter(
6191
+ (entry) => !arrayContents.includes(entry)
6192
+ );
6193
+ if (missingEntries.length === 0) {
6171
6194
  return content;
6172
6195
  }
6173
6196
  const trimmedContents = arrayContents.trim();
6174
- const newEntry = '"playcademy-env.d.ts"';
6197
+ const newEntries = missingEntries.map((entry) => `"${entry}"`);
6175
6198
  let newArrayContents;
6176
6199
  if (trimmedContents === "") {
6177
- newArrayContents = newEntry;
6200
+ newArrayContents = newEntries.join(", ");
6178
6201
  } else if (arrayContents.includes("\n")) {
6179
- newArrayContents = `${arrayContents},
6180
- ${newEntry}
6202
+ const entriesStr = newEntries.map((e) => `
6203
+ ${e}`).join(",");
6204
+ newArrayContents = `${arrayContents},${entriesStr}
6181
6205
  `;
6182
6206
  } else {
6183
- newArrayContents = `${trimmedContents}, ${newEntry}`;
6207
+ newArrayContents = `${trimmedContents}, ${newEntries.join(", ")}`;
6184
6208
  }
6185
6209
  const newIncludeArray = `"include": [${newArrayContents}]`;
6186
6210
  return content.replace(fullMatch, newIncludeArray);
@@ -6195,9 +6219,10 @@ function addNewIncludeProperty(content) {
6195
6219
  const insertPosition = closingBraceMatch.index;
6196
6220
  const beforeClosing = content.slice(0, insertPosition).trim();
6197
6221
  const needsComma = beforeClosing.endsWith("]") || beforeClosing.endsWith("}") || beforeClosing.endsWith('"');
6222
+ const entriesStr = TSCONFIG_REQUIRED_INCLUDES.map((e) => `"${e}"`).join(", ");
6198
6223
  const comma = needsComma ? "," : "";
6199
6224
  const includeEntry = `${comma}
6200
- ${propertyIndent}"include": ["playcademy-env.d.ts"]`;
6225
+ ${propertyIndent}"include": [${entriesStr}]`;
6201
6226
  const updatedContent = content.slice(0, insertPosition) + includeEntry + content.slice(insertPosition);
6202
6227
  return updatedContent;
6203
6228
  }
@@ -6206,7 +6231,7 @@ function addToIncludeArrayPreservingComments(content) {
6206
6231
  }
6207
6232
  async function ensureTsconfigIncludes(workspace) {
6208
6233
  for (const filename of TSCONFIG_FILES) {
6209
- const configPath = join14(workspace, filename);
6234
+ const configPath = join15(workspace, filename);
6210
6235
  if (!existsSync11(configPath)) {
6211
6236
  continue;
6212
6237
  }
@@ -6216,10 +6241,10 @@ async function ensureTsconfigIncludes(workspace) {
6216
6241
  stripComments: true
6217
6242
  });
6218
6243
  if (!config) continue;
6219
- if (config.references && filename !== "tsconfig.json") {
6244
+ if (config.references && filename !== TSCONFIG_JSON) {
6220
6245
  continue;
6221
6246
  }
6222
- if (hasPlaycademyEnv(config)) {
6247
+ if (hasAllRequiredIncludes(config)) {
6223
6248
  return filename;
6224
6249
  }
6225
6250
  try {
@@ -6231,7 +6256,7 @@ async function ensureTsconfigIncludes(workspace) {
6231
6256
  }
6232
6257
  } catch {
6233
6258
  }
6234
- addPlaycademyEnv(config);
6259
+ addRequiredIncludes(config);
6235
6260
  writeFileSync6(configPath, JSON.stringify(config, null, 4) + "\n");
6236
6261
  return filename;
6237
6262
  } catch {
@@ -6256,8 +6281,8 @@ function hasAnyBackend(features) {
6256
6281
  return Object.values(features).some(Boolean);
6257
6282
  }
6258
6283
  async function setupPlaycademyDependencies(workspace) {
6259
- const playcademyDir = join15(workspace, CLI_DIRECTORIES.WORKSPACE);
6260
- const playcademyPkgPath = join15(playcademyDir, "package.json");
6284
+ const playcademyDir = join16(workspace, CLI_DIRECTORIES.WORKSPACE);
6285
+ const playcademyPkgPath = join16(playcademyDir, "package.json");
6261
6286
  const __dirname2 = dirname4(fileURLToPath2(import.meta.url));
6262
6287
  const cliPkg = await loadPackageJson({ cwd: __dirname2, searchUp: true, required: true });
6263
6288
  const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
@@ -6342,14 +6367,14 @@ async function ensurePlaycademyTypes(options = {}) {
6342
6367
  const bindingsStr = generateBindingsTypeString(features);
6343
6368
  const secretsStr = await generateSecretsTypeString(workspace, verbose);
6344
6369
  const hasAuth = !!config.integrations?.auth;
6345
- const hasAuthFile = existsSync12(join15(workspace, "server/lib/auth.ts"));
6370
+ const hasAuthFile = existsSync12(join16(workspace, "server/lib/auth.ts"));
6346
6371
  const authVariablesString = generateAuthVariablesString(hasAuth, hasAuthFile);
6347
6372
  let envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
6348
6373
  envContent = envContent.replace("{{SECRETS}}", secretsStr);
6349
6374
  envContent = envContent.replace("{{AUTH_IMPORT}}", authVariablesString.authImport);
6350
6375
  envContent = envContent.replace("{{VARIABLES}}", authVariablesString.variables);
6351
6376
  envContent = envContent.replace("{{CONTEXT_VARS}}", authVariablesString.contextVars);
6352
- const envPath = join15(workspace, "playcademy-env.d.ts");
6377
+ const envPath = join16(workspace, "playcademy-env.d.ts");
6353
6378
  writeFileSync7(envPath, envContent);
6354
6379
  if (verbose) {
6355
6380
  logger.success(`Generated <playcademy-env.d.ts>`);
@@ -6367,10 +6392,10 @@ async function ensurePlaycademyTypes(options = {}) {
6367
6392
 
6368
6393
  // src/lib/init/gitignore.ts
6369
6394
  import { existsSync as existsSync13, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "fs";
6370
- import { join as join16 } from "path";
6395
+ import { join as join17 } from "path";
6371
6396
  var rootGitignoreTemplate = loadTemplateString("gitignore");
6372
6397
  function ensureRootGitignore(workspace = getWorkspace()) {
6373
- const gitignorePath = join16(workspace, ".gitignore");
6398
+ const gitignorePath = join17(workspace, ".gitignore");
6374
6399
  if (!existsSync13(gitignorePath)) {
6375
6400
  writeFileSync8(gitignorePath, rootGitignoreTemplate);
6376
6401
  return;
@@ -6532,7 +6557,7 @@ var integrationChangeDetectors = {
6532
6557
  import { existsSync as existsSync14 } from "node:fs";
6533
6558
  import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
6534
6559
  import { homedir as homedir2 } from "node:os";
6535
- import { join as join17 } from "node:path";
6560
+ import { join as join18 } from "node:path";
6536
6561
 
6537
6562
  // src/lib/deploy/hash.ts
6538
6563
  init_file_loader();
@@ -6573,10 +6598,10 @@ function hashContent(content) {
6573
6598
 
6574
6599
  // src/lib/games/storage.ts
6575
6600
  function getGamesStorePath() {
6576
- return join17(homedir2(), CLI_USER_DIRECTORIES.CONFIG, CLI_FILES.GAMES_STORE);
6601
+ return join18(homedir2(), CLI_USER_DIRECTORIES.CONFIG, CLI_FILES.GAMES_STORE);
6577
6602
  }
6578
6603
  async function ensureConfigDir() {
6579
- const configDir = join17(homedir2(), CLI_USER_DIRECTORIES.CONFIG);
6604
+ const configDir = join18(homedir2(), CLI_USER_DIRECTORIES.CONFIG);
6580
6605
  await mkdir2(configDir, { recursive: true });
6581
6606
  }
6582
6607
  async function loadGameStore() {
@@ -6720,12 +6745,12 @@ async function saveDeploymentState(game, backendMetadata, context2) {
6720
6745
 
6721
6746
  // src/lib/dev/backend.ts
6722
6747
  import { existsSync as existsSync15 } from "fs";
6723
- import { join as join18 } from "path";
6748
+ import { join as join19 } from "path";
6724
6749
  function hasCustomRoutes(config) {
6725
6750
  const workspace = getWorkspace();
6726
6751
  const customRoutesConfig = config?.integrations?.customRoutes;
6727
6752
  const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
6728
- return existsSync15(join18(workspace, customRoutesDir));
6753
+ return existsSync15(join19(workspace, customRoutesDir));
6729
6754
  }
6730
6755
  function needsBackend(config) {
6731
6756
  return !!config?.integrations || hasCustomRoutes(config);
@@ -6818,7 +6843,7 @@ function displayRegisteredRoutes(integrations, customRoutes = []) {
6818
6843
  }
6819
6844
 
6820
6845
  // src/lib/dev/reload.ts
6821
- import { join as join19, relative } from "path";
6846
+ import { join as join20, relative } from "path";
6822
6847
  import chokidar from "chokidar";
6823
6848
  import { bold as bold5, cyan as cyan3, dim as dim5, green as green2 } from "colorette";
6824
6849
  function formatTime() {
@@ -6835,9 +6860,9 @@ function startHotReload(onReload, options = {}) {
6835
6860
  const customRoutesConfig = options.config?.integrations?.customRoutes;
6836
6861
  const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
6837
6862
  const watchPaths = [
6838
- join19(workspace, customRoutesDir),
6839
- join19(workspace, "playcademy.config.js"),
6840
- join19(workspace, "playcademy.config.json")
6863
+ join20(workspace, customRoutesDir),
6864
+ join20(workspace, "playcademy.config.js"),
6865
+ join20(workspace, "playcademy.config.json")
6841
6866
  ];
6842
6867
  const watcher = chokidar.watch(watchPaths, {
6843
6868
  persistent: true,
@@ -6880,7 +6905,7 @@ function startHotReload(onReload, options = {}) {
6880
6905
  init_file_loader();
6881
6906
  import { mkdir as mkdir3, writeFile as writeFile3 } from "fs/promises";
6882
6907
  import { tmpdir as tmpdir2 } from "os";
6883
- import { join as join20, relative as relative2 } from "path";
6908
+ import { join as join21, relative as relative2 } from "path";
6884
6909
  import { pathToFileURL as pathToFileURL2 } from "url";
6885
6910
  async function discoverRoutes(apiDir) {
6886
6911
  const files = scanDirectory(apiDir, {
@@ -6890,8 +6915,8 @@ async function discoverRoutes(apiDir) {
6890
6915
  const routes = await Promise.all(
6891
6916
  files.map(async (file) => {
6892
6917
  const routePath = filePathToRoutePath(file);
6893
- const absolutePath = join20(apiDir, file);
6894
- const relativePath = relative2(getWorkspace(), absolutePath);
6918
+ const absolutePath = join21(apiDir, file);
6919
+ const relativePath = relative2(getWorkspace(), absolutePath).replace(/\\/g, "/");
6895
6920
  const methods = await detectExportedMethods(absolutePath);
6896
6921
  return {
6897
6922
  path: routePath,
@@ -6952,10 +6977,10 @@ async function transpileRoute(filePath) {
6952
6977
  if (!result.outputFiles?.[0]) {
6953
6978
  throw new Error("Transpilation failed: no output");
6954
6979
  }
6955
- const tempDir = join20(tmpdir2(), "playcademy-dev");
6980
+ const tempDir = join21(tmpdir2(), "playcademy-dev");
6956
6981
  await mkdir3(tempDir, { recursive: true });
6957
6982
  const hash = hashContent(filePath).slice(0, 12);
6958
- const jsPath = join20(tempDir, `${hash}.mjs`);
6983
+ const jsPath = join21(tempDir, `${hash}.mjs`);
6959
6984
  await writeFile3(jsPath, result.outputFiles[0].text);
6960
6985
  return jsPath;
6961
6986
  }
@@ -6981,14 +7006,14 @@ async function registerCustomRoutes(app, routes) {
6981
7006
  // src/lib/dev/server.ts
6982
7007
  init_src();
6983
7008
  import { mkdir as mkdir4 } from "fs/promises";
6984
- import { join as join23 } from "path";
7009
+ import { join as join24 } from "path";
6985
7010
  import { Log, LogLevel, Miniflare } from "miniflare";
6986
7011
 
6987
7012
  // ../utils/src/port.ts
6988
7013
  import { existsSync as existsSync16, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync10 } from "node:fs";
6989
7014
  import { createServer } from "node:net";
6990
7015
  import { homedir as homedir3 } from "node:os";
6991
- import { join as join21 } from "node:path";
7016
+ import { join as join22 } from "node:path";
6992
7017
  async function isPortAvailableOnHost(port, host) {
6993
7018
  return new Promise((resolve11) => {
6994
7019
  const server = createServer();
@@ -7027,11 +7052,11 @@ async function findAvailablePort(startPort = 4321) {
7027
7052
  }
7028
7053
  function getRegistryPath() {
7029
7054
  const home = homedir3();
7030
- const dir = join21(home, ".playcademy");
7055
+ const dir = join22(home, ".playcademy");
7031
7056
  if (!existsSync16(dir)) {
7032
7057
  mkdirSync4(dir, { recursive: true });
7033
7058
  }
7034
- return join21(dir, ".proc");
7059
+ return join22(dir, ".proc");
7035
7060
  }
7036
7061
  function readRegistry() {
7037
7062
  const registryPath = getRegistryPath();
@@ -7122,7 +7147,7 @@ function cleanupServerInfo(type, projectRoot, pid) {
7122
7147
 
7123
7148
  // src/lib/deploy/bundle.ts
7124
7149
  import { existsSync as existsSync17 } from "fs";
7125
- import { join as join22 } from "path";
7150
+ import { join as join23 } from "path";
7126
7151
 
7127
7152
  // ../edge-play/src/entry.ts
7128
7153
  var entry_default = "/**\n * Game Backend Entry Point\n *\n * This file is the main entry point for deployed game backends.\n * It creates a Hono app and registers all enabled integration routes.\n *\n * Bundled with esbuild and deployed to Cloudflare Workers (or AWS Lambda).\n * Config is injected at build time via esbuild's `define` option.\n *\n * DO NOT REMOVE any code wrapped by \u26A0\uFE0F BUILD_MARKER: <marker> \u26A0\uFE0F\n */\n\nimport { Hono } from 'hono'\n\nimport {\n registerApiNotFoundHandler,\n registerAssetFallback,\n registerCors,\n registerEnvSetup,\n registerPlaycademyUser,\n registerSdkInit,\n} from './entry/middleware'\nimport { setupProcessGlobal } from './entry/setup'\nimport { registerBuiltinRoutes } from './register-routes'\n\nimport type { RuntimeConfig } from './entry/types'\nimport type { HonoEnv } from './types'\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTE_IMPORTS \u26A0\uFE0F\n\n/**\n * Config injected at build time by esbuild\n *\n * The `declare const` tells TypeScript \"this exists at runtime, trust me.\"\n * During bundling, esbuild's `define` option does literal text replacement:\n *\n * Example bundling:\n * Source: if (PLAYCADEMY_CONFIG.integrations.timeback) { ... }\n * Define: { 'PLAYCADEMY_CONFIG': JSON.stringify({ integrations: { timeback: {...} } }) }\n * Output: if ({\"integrations\":{\"timeback\":{...}}}.integrations.timeback) { ... }\n *\n * This enables tree-shaking: if timeback is not configured, those code paths are removed.\n * The bundled Worker only includes the routes that are actually enabled.\n */\ndeclare const PLAYCADEMY_CONFIG: RuntimeConfig\n\n// Setup process global polyfill for SDK compatibility\nsetupProcessGlobal()\n\n// Create Hono app\nconst app = new Hono<HonoEnv>()\n\n// Register middleware\nregisterCors(app)\nregisterEnvSetup(app, PLAYCADEMY_CONFIG)\nregisterSdkInit(app, PLAYCADEMY_CONFIG)\nregisterPlaycademyUser(app)\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: SESSION_MIDDLEWARE \u26A0\uFE0F\n\n// Register built-in integration routes based on enabled integrations\n// This function conditionally imports and registers routes like:\n// - GET /api (always included)\n// - GET /api/health (always included)\n// - POST /api/integrations/timeback/end-activity (if timeback enabled)\n//\n// Uses dynamic imports for tree-shaking: if an integration is not enabled,\n// its route code is completely removed from the bundle.\nawait registerBuiltinRoutes(app, PLAYCADEMY_CONFIG.integrations)\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTES \u26A0\uFE0F\n\n// Register API 404 handler\n// Returns JSON error for unmatched /api/* routes\n// Must be registered after all API routes\nregisterApiNotFoundHandler(app)\n\n// Register static asset fallback handler\n// Serves frontend assets from Workers Assets binding\n// MUST be registered last as it uses a wildcard GET route (app.get('*', ...))\n//\n// In production: Serves frontend assets from Workers Assets binding\n// In local dev: Returns 404 (Vite serves the frontend separately)\nregisterAssetFallback(app)\n\nexport default app\n";
@@ -7397,7 +7422,7 @@ async function discoverCustomRoutes(config) {
7397
7422
  const workspace = getWorkspace();
7398
7423
  const customRoutesConfig = config.integrations?.customRoutes;
7399
7424
  const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
7400
- const customRoutes = await discoverRoutes(join22(workspace, customRoutesDir));
7425
+ const customRoutes = await discoverRoutes(join23(workspace, customRoutesDir));
7401
7426
  const customRouteData = customRoutes.map((r) => ({
7402
7427
  path: r.path,
7403
7428
  file: r.file,
@@ -7409,15 +7434,15 @@ async function discoverCustomRoutes(config) {
7409
7434
  function resolveEmbeddedSourcePaths() {
7410
7435
  const workspace = getWorkspace();
7411
7436
  const distDir = new URL(".", import.meta.url).pathname;
7412
- const embeddedEdgeSrc = join22(distDir, "edge-play", "src");
7437
+ const embeddedEdgeSrc = join23(distDir, "edge-play", "src");
7413
7438
  const isBuiltPackage = existsSync17(embeddedEdgeSrc);
7414
7439
  const monorepoRoot = getMonorepoRoot();
7415
- const monorepoEdgeSrc = join22(monorepoRoot, "packages/edge-play/src");
7440
+ const monorepoEdgeSrc = join23(monorepoRoot, "packages/edge-play/src");
7416
7441
  const edgePlaySrc = isBuiltPackage ? embeddedEdgeSrc : monorepoEdgeSrc;
7417
- const cliPackageRoot = isBuiltPackage ? join22(distDir, "../../..") : join22(monorepoRoot, "packages/cli");
7418
- const cliNodeModules = isBuiltPackage ? join22(cliPackageRoot, "node_modules") : monorepoRoot;
7419
- const workspaceNodeModules = join22(workspace, "node_modules");
7420
- const constantsEntry = isBuiltPackage ? join22(embeddedEdgeSrc, "..", "..", "constants", "src", "index.ts") : join22(monorepoRoot, "packages", "constants", "src", "index.ts");
7442
+ const cliPackageRoot = isBuiltPackage ? join23(distDir, "../../..") : join23(monorepoRoot, "packages/cli");
7443
+ const cliNodeModules = isBuiltPackage ? join23(cliPackageRoot, "node_modules") : monorepoRoot;
7444
+ const workspaceNodeModules = join23(workspace, "node_modules");
7445
+ const constantsEntry = isBuiltPackage ? join23(embeddedEdgeSrc, "..", "..", "constants", "src", "index.ts") : join23(monorepoRoot, "packages", "constants", "src", "index.ts");
7421
7446
  return {
7422
7447
  isBuiltPackage,
7423
7448
  edgePlaySrc,
@@ -7482,22 +7507,22 @@ function createEsbuildConfig(entryCode, paths, bundleConfig, customRoutesDir, op
7482
7507
  // │ Example: import * as route from '@game-api/hello.ts' │
7483
7508
  // │ Resolves to: /user-project/server/api/hello.ts │
7484
7509
  // └─────────────────────────────────────────────────────────────────┘
7485
- "@game-api": join22(workspace, customRoutesDir),
7510
+ "@game-api": join23(workspace, customRoutesDir),
7486
7511
  // ┌─ User's server lib directory ───────────────────────────────────┐
7487
7512
  // │ @game-server is a virtual module for server utilities/config │
7488
7513
  // │ Example: import { getAuth } from '@game-server/lib/auth' │
7489
7514
  // │ Resolves to: /user-project/server/lib/auth.ts │
7490
7515
  // └─────────────────────────────────────────────────────────────────┘
7491
- "@game-server": join22(workspace, "server"),
7516
+ "@game-server": join23(workspace, "server"),
7492
7517
  // ┌─ Node.js polyfills for Cloudflare Workers ──────────────────────┐
7493
7518
  // │ Workers don't have fs, path, os, etc. Redirect to polyfills │
7494
7519
  // │ that throw helpful errors if user code tries to use them. │
7495
7520
  // └─────────────────────────────────────────────────────────────────┘
7496
- fs: join22(edgePlaySrc, "polyfills.js"),
7497
- "fs/promises": join22(edgePlaySrc, "polyfills.js"),
7498
- path: join22(edgePlaySrc, "polyfills.js"),
7499
- os: join22(edgePlaySrc, "polyfills.js"),
7500
- process: join22(edgePlaySrc, "polyfills.js")
7521
+ fs: join23(edgePlaySrc, "polyfills.js"),
7522
+ "fs/promises": join23(edgePlaySrc, "polyfills.js"),
7523
+ path: join23(edgePlaySrc, "polyfills.js"),
7524
+ os: join23(edgePlaySrc, "polyfills.js"),
7525
+ process: join23(edgePlaySrc, "polyfills.js")
7501
7526
  },
7502
7527
  // ──── Build Plugins ────
7503
7528
  plugins: [textLoaderPlugin()],
@@ -7665,7 +7690,7 @@ async function startDevServer(options) {
7665
7690
  return { server: mf, port };
7666
7691
  }
7667
7692
  async function ensureDatabaseDirectory() {
7668
- const dbDir = join23(getWorkspace(), CLI_DIRECTORIES.DATABASE);
7693
+ const dbDir = join24(getWorkspace(), CLI_DIRECTORIES.DATABASE);
7669
7694
  try {
7670
7695
  await mkdir4(dbDir, { recursive: true });
7671
7696
  } catch (error) {
@@ -7674,7 +7699,7 @@ async function ensureDatabaseDirectory() {
7674
7699
  return dbDir;
7675
7700
  }
7676
7701
  async function ensureKvDirectory() {
7677
- const kvDir = join23(getWorkspace(), CLI_DIRECTORIES.KV);
7702
+ const kvDir = join24(getWorkspace(), CLI_DIRECTORIES.KV);
7678
7703
  try {
7679
7704
  await mkdir4(kvDir, { recursive: true });
7680
7705
  } catch (error) {
@@ -7683,7 +7708,7 @@ async function ensureKvDirectory() {
7683
7708
  return kvDir;
7684
7709
  }
7685
7710
  async function ensureBucketDirectory() {
7686
- const bucketDir = join23(getWorkspace(), CLI_DIRECTORIES.BUCKET);
7711
+ const bucketDir = join24(getWorkspace(), CLI_DIRECTORIES.BUCKET);
7687
7712
  try {
7688
7713
  await mkdir4(bucketDir, { recursive: true });
7689
7714
  } catch (error) {
@@ -8012,13 +8037,13 @@ function displayDeploymentDiff(options) {
8012
8037
  // src/lib/deploy/godot.ts
8013
8038
  import { execSync as execSync5 } from "child_process";
8014
8039
  import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync10, rmSync as rmSync2 } from "fs";
8015
- import { join as join24 } from "path";
8040
+ import { join as join25 } from "path";
8016
8041
  import { confirm as confirm2, select as select2 } from "@inquirer/prompts";
8017
8042
  function isGodotProject() {
8018
- return existsSync18(join24(getWorkspace(), GODOT_PROJECT_FILE));
8043
+ return existsSync18(join25(getWorkspace(), GODOT_PROJECT_FILE));
8019
8044
  }
8020
8045
  function hasWebExportPreset() {
8021
- const presetsPath = join24(getWorkspace(), GODOT_EXPORT_PRESETS_FILE);
8046
+ const presetsPath = join25(getWorkspace(), GODOT_EXPORT_PRESETS_FILE);
8022
8047
  if (!existsSync18(presetsPath)) {
8023
8048
  return { configured: false };
8024
8049
  }
@@ -8074,7 +8099,7 @@ async function findGodotExecutable() {
8074
8099
  const apps = result.split("\n").filter(Boolean);
8075
8100
  for (const appPath of apps) {
8076
8101
  if (seenAppBundles.has(appPath)) continue;
8077
- const executable = join24(appPath, GODOT_EXECUTABLE_PATTERNS.MACOS_APP_EXECUTABLE);
8102
+ const executable = join25(appPath, GODOT_EXECUTABLE_PATTERNS.MACOS_APP_EXECUTABLE);
8078
8103
  const appName = appPath.split("/").pop() || "Godot";
8079
8104
  foundExecutables.push({ path: executable, label: appName });
8080
8105
  }
@@ -8136,11 +8161,11 @@ async function findGodotExecutable() {
8136
8161
  async function runGodotExport(godotPath, presetName, outputPath) {
8137
8162
  const root = getWorkspace();
8138
8163
  try {
8139
- const buildDir = join24(root, GODOT_BUILD_DIRECTORIES.ROOT);
8164
+ const buildDir = join25(root, GODOT_BUILD_DIRECTORIES.ROOT);
8140
8165
  if (existsSync18(buildDir)) {
8141
8166
  rmSync2(buildDir, { recursive: true, force: true });
8142
8167
  }
8143
- mkdirSync5(join24(root, GODOT_BUILD_DIRECTORIES.WEB), { recursive: true });
8168
+ mkdirSync5(join25(root, GODOT_BUILD_DIRECTORIES.WEB), { recursive: true });
8144
8169
  await runStep(
8145
8170
  `Exporting project using "${presetName}" preset`,
8146
8171
  async () => {
@@ -8196,7 +8221,7 @@ async function handleGodotBuildPrompt() {
8196
8221
  logger.newLine();
8197
8222
  return null;
8198
8223
  }
8199
- if (existsSync18(join24(getWorkspace(), GODOT_BUILD_OUTPUTS.ZIP))) {
8224
+ if (existsSync18(join25(getWorkspace(), GODOT_BUILD_OUTPUTS.ZIP))) {
8200
8225
  return GODOT_BUILD_OUTPUTS.ZIP;
8201
8226
  }
8202
8227
  logger.warn("Expected zip file not found, using build directory");
@@ -8209,10 +8234,10 @@ import { confirm as confirm3, input as input2, select as select3 } from "@inquir
8209
8234
 
8210
8235
  // src/lib/deploy/build-discovery.ts
8211
8236
  init_file_loader();
8212
- import { join as join25, relative as relative3 } from "path";
8237
+ import { join as join26, relative as relative3 } from "path";
8213
8238
  function findSingleBuildZip() {
8214
8239
  const workspace = getWorkspace();
8215
- const playcademyDir = join25(workspace, CLI_DIRECTORIES.WORKSPACE);
8240
+ const playcademyDir = join26(workspace, CLI_DIRECTORIES.WORKSPACE);
8216
8241
  const zipFiles = findFilesByExtension(playcademyDir, "zip");
8217
8242
  if (zipFiles.length === 1) {
8218
8243
  return zipFiles[0] ? relative3(workspace, zipFiles[0]) : null;
@@ -8223,7 +8248,7 @@ function findSingleBuildZip() {
8223
8248
  // src/lib/deploy/schema.ts
8224
8249
  import { existsSync as existsSync19 } from "fs";
8225
8250
  import { createRequire } from "module";
8226
- import { join as join26 } from "path";
8251
+ import { join as join27 } from "path";
8227
8252
  async function getDatabaseDirectory() {
8228
8253
  try {
8229
8254
  const config = await loadConfig();
@@ -8251,7 +8276,7 @@ async function getSchemaInfo(previousSchemaSnapshot) {
8251
8276
  return null;
8252
8277
  }
8253
8278
  const dbDirectory = await getDatabaseDirectory();
8254
- const schemaPath = join26(workspace, dbDirectory, SCHEMA_SUBDIRECTORY, DB_FILES.SCHEMA_INDEX);
8279
+ const schemaPath = join27(workspace, dbDirectory, SCHEMA_SUBDIRECTORY, DB_FILES.SCHEMA_INDEX);
8255
8280
  if (!existsSync19(schemaPath)) {
8256
8281
  return null;
8257
8282
  }
@@ -8630,7 +8655,7 @@ function reportCancellation() {
8630
8655
 
8631
8656
  // src/lib/deploy/preparation.ts
8632
8657
  import { stat } from "node:fs/promises";
8633
- import { join as join27 } from "node:path";
8658
+ import { join as join28 } from "node:path";
8634
8659
 
8635
8660
  // ../data/src/domains/game/helpers.ts
8636
8661
  var isHostedGame = (game) => {
@@ -9278,8 +9303,8 @@ async function analyzeChanges(context2) {
9278
9303
  const bundle = await bundleBackend(context2.fullConfig);
9279
9304
  const bundleHash = hashContent(bundle.code);
9280
9305
  const [serverSize, dbSize] = await Promise.all([
9281
- getDirectorySize(join27(projectPath, SERVER_ROOT_DIRECTORY)),
9282
- getDirectorySize(join27(projectPath, DEFAULT_DATABASE_DIRECTORY))
9306
+ getDirectorySize(join28(projectPath, SERVER_ROOT_DIRECTORY)),
9307
+ getDirectorySize(join28(projectPath, DEFAULT_DATABASE_DIRECTORY))
9283
9308
  ]);
9284
9309
  context2.currentBackendBundleHash = bundleHash;
9285
9310
  context2.currentBackendSize = bundle.code.length;
@@ -9402,7 +9427,7 @@ function hasOptionalFieldsMissing(missing) {
9402
9427
  // src/lib/deploy/steps.ts
9403
9428
  import { existsSync as existsSync21 } from "fs";
9404
9429
  import { readFile as readFile4 } from "fs/promises";
9405
- import { basename as basename2, join as join28, resolve as resolve8 } from "path";
9430
+ import { basename as basename2, join as join29, resolve as resolve8 } from "path";
9406
9431
 
9407
9432
  // src/lib/deploy/stub.ts
9408
9433
  import * as esbuild2 from "esbuild";
@@ -9619,8 +9644,8 @@ async function deployGame(context2, shouldUploadBuild, shouldDeployBackend) {
9619
9644
  secrets: Object.keys(deploymentPrep.secrets).length > 0 ? deploymentPrep.secrets : void 0
9620
9645
  };
9621
9646
  const [serverSize, dbSize] = await Promise.all([
9622
- getDirectorySize(join28(context2.projectPath, SERVER_ROOT_DIRECTORY)),
9623
- getDirectorySize(join28(context2.projectPath, DEFAULT_DATABASE_DIRECTORY))
9647
+ getDirectorySize(join29(context2.projectPath, SERVER_ROOT_DIRECTORY)),
9648
+ getDirectorySize(join29(context2.projectPath, DEFAULT_DATABASE_DIRECTORY))
9624
9649
  ]);
9625
9650
  backendMetadata = {
9626
9651
  backendBundleHash: hashContent(bundle.code),
@@ -9681,7 +9706,7 @@ async function deployGame(context2, shouldUploadBuild, shouldDeployBackend) {
9681
9706
 
9682
9707
  // src/lib/db/path.ts
9683
9708
  import { copyFileSync, existsSync as existsSync22, mkdirSync as mkdirSync6, readdirSync as readdirSync2, unlinkSync } from "fs";
9684
- import { join as join29 } from "path";
9709
+ import { join as join30 } from "path";
9685
9710
  var DB_DIRECTORY = CLI_DIRECTORIES.DATABASE;
9686
9711
  var INITIAL_DB_NAME = CLI_FILES.INITIAL_DATABASE;
9687
9712
  var ensureDirectoryExists = (dir) => {
@@ -9690,11 +9715,11 @@ var ensureDirectoryExists = (dir) => {
9690
9715
  }
9691
9716
  };
9692
9717
  var findMiniflareDatabase = (dbDir) => {
9693
- const miniflareDir = join29(dbDir, MINIFLARE_D1_DIRECTORY);
9718
+ const miniflareDir = join30(dbDir, MINIFLARE_D1_DIRECTORY);
9694
9719
  if (!existsSync22(miniflareDir)) return null;
9695
9720
  const sqliteFiles = readdirSync2(miniflareDir).filter((file) => file.endsWith(".sqlite"));
9696
9721
  if (sqliteFiles.length === 0) return null;
9697
- return join29(miniflareDir, sqliteFiles[0]);
9722
+ return join30(miniflareDir, sqliteFiles[0]);
9698
9723
  };
9699
9724
  var migrateInitialDbToTarget = (initialPath, targetPath) => {
9700
9725
  if (!existsSync22(initialPath)) return;
@@ -9702,7 +9727,7 @@ var migrateInitialDbToTarget = (initialPath, targetPath) => {
9702
9727
  unlinkSync(initialPath);
9703
9728
  };
9704
9729
  function getDevDbPath() {
9705
- const initialDbPath = join29(DB_DIRECTORY, INITIAL_DB_NAME);
9730
+ const initialDbPath = join30(DB_DIRECTORY, INITIAL_DB_NAME);
9706
9731
  ensureDirectoryExists(DB_DIRECTORY);
9707
9732
  const miniflareDbPath = findMiniflareDatabase(DB_DIRECTORY);
9708
9733
  if (miniflareDbPath) {
@@ -9766,10 +9791,10 @@ async function bundleSeedWorker(seedFilePath, projectPath) {
9766
9791
  // src/lib/db/reset.ts
9767
9792
  import { execSync as execSync6 } from "child_process";
9768
9793
  import { rmSync as rmSync3 } from "fs";
9769
- import { join as join30 } from "path";
9794
+ import { join as join31 } from "path";
9770
9795
  async function resetDatabase(workspace, mf, options = { debug: false }) {
9771
9796
  const { debug } = options;
9772
- const dbDir = join30(workspace, CLI_DIRECTORIES.DATABASE);
9797
+ const dbDir = join31(workspace, CLI_DIRECTORIES.DATABASE);
9773
9798
  await runStep(
9774
9799
  "Resetting database...",
9775
9800
  async () => {
@@ -10028,7 +10053,7 @@ import { dim as dim7 } from "colorette";
10028
10053
 
10029
10054
  // src/lib/bucket/collect.ts
10030
10055
  import { readdirSync as readdirSync3, statSync as statSync2 } from "fs";
10031
- import { join as join31, relative as relative4, sep as sep2 } from "path";
10056
+ import { join as join32, relative as relative4, sep as sep2 } from "path";
10032
10057
  function shouldSkipFile(filePath, baseDir, gitignorePatterns) {
10033
10058
  const relativePath = relative4(baseDir, filePath);
10034
10059
  const pathParts = relativePath.split(sep2);
@@ -10043,7 +10068,7 @@ function collectFiles(directory, baseDir, gitignorePatterns) {
10043
10068
  try {
10044
10069
  const entries = readdirSync3(directory, { withFileTypes: true });
10045
10070
  for (const entry of entries) {
10046
- const fullPath = join31(directory, entry.name);
10071
+ const fullPath = join32(directory, entry.name);
10047
10072
  if (shouldSkipFile(fullPath, baseDir, gitignorePatterns)) {
10048
10073
  continue;
10049
10074
  }
@@ -10783,11 +10808,11 @@ async function addPlaycademySdk() {
10783
10808
  initCommand.addCommand(configCommand);
10784
10809
 
10785
10810
  // src/commands/login.ts
10811
+ import { userInfo } from "os";
10786
10812
  import { input as input3, password, select as select4 } from "@inquirer/prompts";
10787
10813
  import { bold as bold8, dim as dim8, whiteBright } from "colorette";
10788
10814
  import { Command as Command3 } from "commander";
10789
10815
  import open from "open";
10790
- init_file_loader();
10791
10816
  var loginCommand = new Command3("login").description("Authenticate with Playcademy").option("-e, --email <email>", "Email address (for email/password auth)").option("-p, --password <password>", "Password (for email/password auth)").option("--sso", "Use Timeback SSO authentication").option("--env <environment>", "Environment to login to (staging or production)").action(async (options) => {
10792
10817
  const { email, password: password2, sso, env } = options;
10793
10818
  const environment = ensureEnvironment(env);
@@ -10844,10 +10869,9 @@ var loginCommand = new Command3("login").description("Authenticate with Playcade
10844
10869
  const apiKeyResult = await runStep(
10845
10870
  "Creating API key for CLI usage",
10846
10871
  async () => {
10847
- const pkg = await loadPackageJson({ required: false });
10848
- const nameVersion = pkg ? getPackageNameVersionFromData(pkg) : `${getCurrentDirectoryName("playcademy-cli")}@0.0.0`;
10872
+ const username = userInfo().username.substring(0, 32);
10849
10873
  const result = await client.auth.apiKeys.create({
10850
- name: nameVersion,
10874
+ name: username,
10851
10875
  expiresIn: null,
10852
10876
  // No expiration
10853
10877
  permissions: {
@@ -10911,10 +10935,9 @@ async function handleSsoLogin(environment, profileName) {
10911
10935
  const apiKeyResult = await runStep(
10912
10936
  "Creating API key for CLI usage",
10913
10937
  async () => {
10914
- const pkg = await loadPackageJson({ required: false });
10915
- const nameVersion = pkg ? getPackageNameVersionFromData(pkg) : `${getCurrentDirectoryName("playcademy-cli")}@0.0.0`;
10938
+ const username = userInfo().username.substring(0, 32);
10916
10939
  const response = await client.auth.apiKeys.create({
10917
- name: nameVersion,
10940
+ name: username,
10918
10941
  expiresIn: null,
10919
10942
  permissions: {
10920
10943
  games: ["read", "write", "delete"],
@@ -11575,7 +11598,7 @@ import { Command as Command17 } from "commander";
11575
11598
  // src/commands/auth/add.ts
11576
11599
  init_file_loader();
11577
11600
  import { writeFileSync as writeFileSync13 } from "fs";
11578
- import { join as join32 } from "path";
11601
+ import { join as join33 } from "path";
11579
11602
  import { bold as bold10 } from "colorette";
11580
11603
  import { Command as Command15 } from "commander";
11581
11604
  var addAuthCommand = new Command15("add").description("Add an authentication provider to your project").argument("<provider>", "Provider to add: email | github | google").addHelpText(
@@ -11613,7 +11636,7 @@ Examples:
11613
11636
  logger.highlight(`Add ${providerDisplayName} Authentication`);
11614
11637
  logger.newLine();
11615
11638
  const workspace = getWorkspace();
11616
- const authPath = join32(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
11639
+ const authPath = join33(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
11617
11640
  let authContent = await loadFile(authPath);
11618
11641
  if (!authContent) {
11619
11642
  logger.error("Authentication configuration not found");
@@ -11891,7 +11914,7 @@ async function runDbInit() {
11891
11914
 
11892
11915
  // src/commands/db/reset.ts
11893
11916
  import { existsSync as existsSync23 } from "fs";
11894
- import { join as join33 } from "path";
11917
+ import { join as join34 } from "path";
11895
11918
  import { confirm as confirm8, input as input7 } from "@inquirer/prompts";
11896
11919
  import { bold as bold11, redBright as redBright4, underline as underline3 } from "colorette";
11897
11920
  import { Miniflare as Miniflare2 } from "miniflare";
@@ -11970,7 +11993,7 @@ async function runDbResetRemote(options) {
11970
11993
  }
11971
11994
  async function runDbResetLocal(options) {
11972
11995
  const workspace = getWorkspace();
11973
- const dbDir = join33(workspace, CLI_DIRECTORIES.DATABASE);
11996
+ const dbDir = join34(workspace, CLI_DIRECTORIES.DATABASE);
11974
11997
  logger.newLine();
11975
11998
  if (!existsSync23(dbDir)) {
11976
11999
  logger.warn("No database found to reset");
@@ -12032,7 +12055,7 @@ async function runDbReset(options = {}) {
12032
12055
 
12033
12056
  // src/commands/db/seed.ts
12034
12057
  import { existsSync as existsSync24 } from "fs";
12035
- import { join as join34 } from "path";
12058
+ import { join as join35 } from "path";
12036
12059
  import { confirm as confirm9, input as input8 } from "@inquirer/prompts";
12037
12060
  import { bold as bold12, redBright as redBright5, underline as underline4 } from "colorette";
12038
12061
  import { Miniflare as Miniflare3 } from "miniflare";
@@ -12152,12 +12175,12 @@ async function runDbSeedRemote(seedFile, options) {
12152
12175
  }
12153
12176
  async function runDbSeedLocal(seedFile, options) {
12154
12177
  const workspace = getWorkspace();
12155
- const dbDir = join34(workspace, CLI_DIRECTORIES.DATABASE);
12178
+ const dbDir = join35(workspace, CLI_DIRECTORIES.DATABASE);
12156
12179
  const config = await loadConfig();
12157
12180
  const hasBucket = hasBucketSetup(config);
12158
12181
  const hasKV = hasKVSetup(config);
12159
- const bucketDir = hasBucket ? join34(workspace, CLI_DIRECTORIES.BUCKET) : void 0;
12160
- const kvDir = hasKV ? join34(workspace, CLI_DIRECTORIES.KV) : void 0;
12182
+ const bucketDir = hasBucket ? join35(workspace, CLI_DIRECTORIES.BUCKET) : void 0;
12183
+ const kvDir = hasKV ? join35(workspace, CLI_DIRECTORIES.KV) : void 0;
12161
12184
  if (bucketDir) {
12162
12185
  const { mkdir: mkdir5 } = await import("fs/promises");
12163
12186
  await mkdir5(bucketDir, { recursive: true });
@@ -12199,7 +12222,7 @@ async function runDbSeedLocal(seedFile, options) {
12199
12222
  async function runDbSeed(options = {}) {
12200
12223
  const workspace = getWorkspace();
12201
12224
  try {
12202
- const seedFile = options.file ? join34(workspace, options.file) : join34(workspace, DEFAULT_DATABASE_DIRECTORY, DB_FILES.SEED);
12225
+ const seedFile = options.file ? join35(workspace, options.file) : join35(workspace, DEFAULT_DATABASE_DIRECTORY, DB_FILES.SEED);
12203
12226
  if (!existsSync24(seedFile)) {
12204
12227
  logger.newLine();
12205
12228
  logger.error(`Seed file not found: ${seedFile}`);
@@ -12252,7 +12275,7 @@ dbCommand.command("diff").description("Show schema changes since last deployment
12252
12275
  import { Command as Command19 } from "commander";
12253
12276
 
12254
12277
  // src/commands/kv/clear.ts
12255
- import { join as join35 } from "path";
12278
+ import { join as join36 } from "path";
12256
12279
  import { confirm as confirm10 } from "@inquirer/prompts";
12257
12280
  import { Miniflare as Miniflare4 } from "miniflare";
12258
12281
  async function runKVClear(options = {}) {
@@ -12285,7 +12308,7 @@ async function runKVClear(options = {}) {
12285
12308
  }
12286
12309
  process.exit(1);
12287
12310
  }
12288
- const kvDir = join35(getWorkspace(), CLI_DIRECTORIES.KV);
12311
+ const kvDir = join36(getWorkspace(), CLI_DIRECTORIES.KV);
12289
12312
  const mf = new Miniflare4({
12290
12313
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12291
12314
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12356,7 +12379,7 @@ async function runKVClear(options = {}) {
12356
12379
  }
12357
12380
 
12358
12381
  // src/commands/kv/delete.ts
12359
- import { join as join36 } from "path";
12382
+ import { join as join37 } from "path";
12360
12383
  import { Miniflare as Miniflare5 } from "miniflare";
12361
12384
  async function runKVDelete(key, options = {}) {
12362
12385
  try {
@@ -12397,7 +12420,7 @@ async function runKVDelete(key, options = {}) {
12397
12420
  }
12398
12421
  process.exit(1);
12399
12422
  }
12400
- const kvDir = join36(getWorkspace(), CLI_DIRECTORIES.KV);
12423
+ const kvDir = join37(getWorkspace(), CLI_DIRECTORIES.KV);
12401
12424
  const mf = new Miniflare5({
12402
12425
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12403
12426
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12433,7 +12456,7 @@ async function runKVDelete(key, options = {}) {
12433
12456
  }
12434
12457
 
12435
12458
  // src/commands/kv/get.ts
12436
- import { join as join37 } from "path";
12459
+ import { join as join38 } from "path";
12437
12460
  import { Miniflare as Miniflare6 } from "miniflare";
12438
12461
  async function runKVGet(key, options = {}) {
12439
12462
  try {
@@ -12474,7 +12497,7 @@ async function runKVGet(key, options = {}) {
12474
12497
  }
12475
12498
  process.exit(1);
12476
12499
  }
12477
- const kvDir = join37(getWorkspace(), CLI_DIRECTORIES.KV);
12500
+ const kvDir = join38(getWorkspace(), CLI_DIRECTORIES.KV);
12478
12501
  const mf = new Miniflare6({
12479
12502
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12480
12503
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12603,7 +12626,7 @@ async function runKVInit() {
12603
12626
  }
12604
12627
 
12605
12628
  // src/commands/kv/inspect.ts
12606
- import { join as join38 } from "path";
12629
+ import { join as join39 } from "path";
12607
12630
  import { Miniflare as Miniflare7 } from "miniflare";
12608
12631
  async function runKVInspect(key, options = {}) {
12609
12632
  try {
@@ -12644,7 +12667,7 @@ async function runKVInspect(key, options = {}) {
12644
12667
  }
12645
12668
  process.exit(1);
12646
12669
  }
12647
- const kvDir = join38(getWorkspace(), CLI_DIRECTORIES.KV);
12670
+ const kvDir = join39(getWorkspace(), CLI_DIRECTORIES.KV);
12648
12671
  const mf = new Miniflare7({
12649
12672
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12650
12673
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12730,7 +12753,7 @@ async function runKVInspect(key, options = {}) {
12730
12753
  }
12731
12754
 
12732
12755
  // src/commands/kv/list.ts
12733
- import { join as join39 } from "path";
12756
+ import { join as join40 } from "path";
12734
12757
  import { Miniflare as Miniflare8 } from "miniflare";
12735
12758
  async function runKVList(options = {}) {
12736
12759
  try {
@@ -12762,7 +12785,7 @@ async function runKVList(options = {}) {
12762
12785
  }
12763
12786
  process.exit(1);
12764
12787
  }
12765
- const kvDir = join39(getWorkspace(), CLI_DIRECTORIES.KV);
12788
+ const kvDir = join40(getWorkspace(), CLI_DIRECTORIES.KV);
12766
12789
  const mf = new Miniflare8({
12767
12790
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12768
12791
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12809,7 +12832,7 @@ async function runKVList(options = {}) {
12809
12832
 
12810
12833
  // src/commands/kv/seed.ts
12811
12834
  init_file_loader();
12812
- import { join as join40 } from "path";
12835
+ import { join as join41 } from "path";
12813
12836
  import { confirm as confirm11 } from "@inquirer/prompts";
12814
12837
  import { Miniflare as Miniflare9 } from "miniflare";
12815
12838
  async function runKVSeed(seedFile, options = {}) {
@@ -12875,7 +12898,7 @@ async function runKVSeed(seedFile, options = {}) {
12875
12898
  }
12876
12899
  process.exit(1);
12877
12900
  }
12878
- const kvDir = join40(workspace, CLI_DIRECTORIES.KV);
12901
+ const kvDir = join41(workspace, CLI_DIRECTORIES.KV);
12879
12902
  const mf = new Miniflare9({
12880
12903
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
12881
12904
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -12955,7 +12978,7 @@ async function runKVSeed(seedFile, options = {}) {
12955
12978
 
12956
12979
  // src/commands/kv/set.ts
12957
12980
  init_file_loader();
12958
- import { join as join41 } from "path";
12981
+ import { join as join42 } from "path";
12959
12982
  import { Miniflare as Miniflare10 } from "miniflare";
12960
12983
  async function runKVSet(key, value, options = {}) {
12961
12984
  try {
@@ -13025,7 +13048,7 @@ async function runKVSet(key, value, options = {}) {
13025
13048
  }
13026
13049
  process.exit(1);
13027
13050
  }
13028
- const kvDir = join41(getWorkspace(), CLI_DIRECTORIES.KV);
13051
+ const kvDir = join42(getWorkspace(), CLI_DIRECTORIES.KV);
13029
13052
  const mf = new Miniflare10({
13030
13053
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13031
13054
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -13061,7 +13084,7 @@ async function runKVSet(key, value, options = {}) {
13061
13084
  }
13062
13085
 
13063
13086
  // src/commands/kv/stats.ts
13064
- import { join as join42 } from "path";
13087
+ import { join as join43 } from "path";
13065
13088
  import { Miniflare as Miniflare11 } from "miniflare";
13066
13089
  async function runKVStats(options = {}) {
13067
13090
  try {
@@ -13093,7 +13116,7 @@ async function runKVStats(options = {}) {
13093
13116
  }
13094
13117
  process.exit(1);
13095
13118
  }
13096
- const kvDir = join42(getWorkspace(), CLI_DIRECTORIES.KV);
13119
+ const kvDir = join43(getWorkspace(), CLI_DIRECTORIES.KV);
13097
13120
  const mf = new Miniflare11({
13098
13121
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13099
13122
  kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
@@ -13210,7 +13233,7 @@ import { Command as Command20 } from "commander";
13210
13233
 
13211
13234
  // src/commands/bucket/bulk.ts
13212
13235
  import { existsSync as existsSync25, statSync as statSync3 } from "fs";
13213
- import { join as join43 } from "path";
13236
+ import { join as join44 } from "path";
13214
13237
  import { Miniflare as Miniflare12 } from "miniflare";
13215
13238
  async function runBucketBulkRemote(directory, options) {
13216
13239
  const environment = ensureEnvironment(options.env);
@@ -13272,7 +13295,7 @@ async function runBucketBulkLocal(directory, options) {
13272
13295
  outputDryRunResults(files, totalSize, options.prefix, options.json, options.raw);
13273
13296
  return;
13274
13297
  }
13275
- const bucketDir = join43(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13298
+ const bucketDir = join44(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13276
13299
  const mf = new Miniflare12({
13277
13300
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13278
13301
  r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
@@ -13351,7 +13374,7 @@ async function runBucketBulk(directory, options = {}) {
13351
13374
  }
13352
13375
 
13353
13376
  // src/commands/bucket/delete.ts
13354
- import { join as join44 } from "path";
13377
+ import { join as join45 } from "path";
13355
13378
  import { Miniflare as Miniflare13 } from "miniflare";
13356
13379
  async function runBucketDeleteRemote(key, options) {
13357
13380
  const environment = ensureEnvironment(options.env);
@@ -13407,7 +13430,7 @@ async function runBucketDeleteLocal(key, options) {
13407
13430
  }
13408
13431
  process.exit(1);
13409
13432
  }
13410
- const bucketDir = join44(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13433
+ const bucketDir = join45(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13411
13434
  const mf = new Miniflare13({
13412
13435
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13413
13436
  r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
@@ -13470,7 +13493,7 @@ async function runBucketDelete(key, options = {}) {
13470
13493
 
13471
13494
  // src/commands/bucket/get.ts
13472
13495
  import { writeFileSync as writeFileSync14 } from "fs";
13473
- import { join as join45 } from "path";
13496
+ import { join as join46 } from "path";
13474
13497
  import { Miniflare as Miniflare14 } from "miniflare";
13475
13498
  async function runBucketGetRemote(key, options) {
13476
13499
  const environment = ensureEnvironment(options.env);
@@ -13563,7 +13586,7 @@ async function runBucketGetLocal(key, options) {
13563
13586
  }
13564
13587
  process.exit(1);
13565
13588
  }
13566
- const bucketDir = join45(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13589
+ const bucketDir = join46(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13567
13590
  const mf = new Miniflare14({
13568
13591
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13569
13592
  r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
@@ -13718,7 +13741,7 @@ async function runBucketInit() {
13718
13741
  }
13719
13742
 
13720
13743
  // src/commands/bucket/list.ts
13721
- import { join as join46 } from "path";
13744
+ import { join as join47 } from "path";
13722
13745
  import { Miniflare as Miniflare15 } from "miniflare";
13723
13746
  async function runBucketListRemote(options) {
13724
13747
  const environment = ensureEnvironment(options.env);
@@ -13785,7 +13808,7 @@ async function runBucketListLocal(options) {
13785
13808
  }
13786
13809
  process.exit(1);
13787
13810
  }
13788
- const bucketDir = join46(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13811
+ const bucketDir = join47(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13789
13812
  const mf = new Miniflare15({
13790
13813
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13791
13814
  r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
@@ -13869,7 +13892,7 @@ function formatBytes2(bytes) {
13869
13892
 
13870
13893
  // src/commands/bucket/put.ts
13871
13894
  import { readFileSync as readFileSync13, statSync as statSync4 } from "fs";
13872
- import { join as join47 } from "path";
13895
+ import { join as join48 } from "path";
13873
13896
  import { Miniflare as Miniflare16 } from "miniflare";
13874
13897
  async function runBucketPutRemote(key, filePath, options) {
13875
13898
  const environment = ensureEnvironment(options.env);
@@ -13954,7 +13977,7 @@ async function runBucketPutLocal(key, filePath, options) {
13954
13977
  }
13955
13978
  process.exit(1);
13956
13979
  }
13957
- const bucketDir = join47(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13980
+ const bucketDir = join48(getWorkspace(), CLI_DIRECTORIES.BUCKET);
13958
13981
  const mf = new Miniflare16({
13959
13982
  modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
13960
13983
  r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
@@ -14892,7 +14915,7 @@ import { Command as Command38 } from "commander";
14892
14915
 
14893
14916
  // src/commands/debug/bundle.ts
14894
14917
  import { writeFileSync as writeFileSync15 } from "fs";
14895
- import { join as join48 } from "path";
14918
+ import { join as join49 } from "path";
14896
14919
  import { Command as Command37 } from "commander";
14897
14920
  var bundleCommand = new Command37("bundle").description("Bundle and inspect the project backend worker code (for debugging)").option("-o, --output <path>", "Output file path", CLI_DEFAULT_OUTPUTS.WORKER_BUNDLE).option("--minify", "Minify the output").option("--sourcemap", "Include source maps").action(async (options) => {
14898
14921
  try {
@@ -14922,7 +14945,7 @@ var bundleCommand = new Command37("bundle").description("Bundle and inspect the
14922
14945
  }),
14923
14946
  (result) => `Bundled ${formatSize(result.code.length)}`
14924
14947
  );
14925
- const outputPath = join48(workspace, options.output);
14948
+ const outputPath = join49(workspace, options.output);
14926
14949
  writeFileSync15(outputPath, bundle.code, "utf-8");
14927
14950
  logger.success(`Bundle saved to ${options.output}`);
14928
14951
  logger.newLine();