@playcademy/vite-plugin 0.2.2 → 0.2.3

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/dist/index.js +53 -53
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -186453,6 +186453,55 @@ async function verifyGameAccessBySlug(slug2, user) {
186453
186453
  function getGameWorkerApiKeyName(slug2) {
186454
186454
  return `game-worker-${slug2}`.substring(0, 32);
186455
186455
  }
186456
+ var import_client_s32 = __toESM2(require_dist_cjs81(), 1);
186457
+ function getSecretsConfig() {
186458
+ const bucketName = process.env.GAME_SECRETS_BUCKET;
186459
+ const masterKey = process.env.GAME_SECRETS_MASTER_KEY;
186460
+ if (!bucketName || !masterKey) {
186461
+ throw new Error("Secrets storage not configured");
186462
+ }
186463
+ const accessKeyId = process.env.CLOUDFLARE_R2_ACCESS_KEY_ID;
186464
+ const secretAccessKey = process.env.CLOUDFLARE_R2_SECRET_ACCESS_KEY;
186465
+ const endpoint = process.env.CLOUDFLARE_R2_DEFAULT_ENDPOINT;
186466
+ if (!accessKeyId || !secretAccessKey || !endpoint) {
186467
+ throw new Error("R2 credentials not configured");
186468
+ }
186469
+ return {
186470
+ bucketName,
186471
+ credentials: {
186472
+ accessKeyId,
186473
+ secretAccessKey,
186474
+ endpoint
186475
+ },
186476
+ masterKey
186477
+ };
186478
+ }
186479
+ function getSecretsKey(gameId) {
186480
+ return `${gameId}.json.enc`;
186481
+ }
186482
+ function createR2Client(config2) {
186483
+ return new import_client_s32.S3Client({
186484
+ region: "auto",
186485
+ endpoint: config2.credentials.endpoint,
186486
+ credentials: {
186487
+ accessKeyId: config2.credentials.accessKeyId,
186488
+ secretAccessKey: config2.credentials.secretAccessKey
186489
+ }
186490
+ });
186491
+ }
186492
+ async function deleteSecrets(gameId, config2) {
186493
+ const client = createR2Client(config2);
186494
+ const key = getSecretsKey(gameId);
186495
+ try {
186496
+ await client.send(new import_client_s32.DeleteObjectCommand({
186497
+ Bucket: config2.bucketName,
186498
+ Key: key
186499
+ }));
186500
+ } catch (error2) {
186501
+ log2.error("[SecretsStorage] Failed to delete secrets", { gameId, error: error2 });
186502
+ throw new Error(`Failed to delete secrets for game ${gameId}`);
186503
+ }
186504
+ }
186456
186505
  async function seedAchievements(db) {
186457
186506
  const now2 = new Date;
186458
186507
  for (const def of ACHIEVEMENT_DEFINITIONS) {
@@ -192214,55 +192263,6 @@ usersRouter.all("/", async (c3) => {
192214
192263
  const error2 = ApiError.methodNotAllowed("Method not allowed");
192215
192264
  return c3.json(createErrorResponse(error2), 405);
192216
192265
  });
192217
- var import_client_s32 = __toESM2(require_dist_cjs81(), 1);
192218
- function getSecretsConfig() {
192219
- const bucketName = process.env.GAME_SECRETS_BUCKET;
192220
- const masterKey = process.env.GAME_SECRETS_MASTER_KEY;
192221
- if (!bucketName || !masterKey) {
192222
- throw new Error("Secrets storage not configured");
192223
- }
192224
- const accessKeyId = process.env.CLOUDFLARE_R2_ACCESS_KEY_ID;
192225
- const secretAccessKey = process.env.CLOUDFLARE_R2_SECRET_ACCESS_KEY;
192226
- const endpoint = process.env.CLOUDFLARE_R2_DEFAULT_ENDPOINT;
192227
- if (!accessKeyId || !secretAccessKey || !endpoint) {
192228
- throw new Error("R2 credentials not configured");
192229
- }
192230
- return {
192231
- bucketName,
192232
- credentials: {
192233
- accessKeyId,
192234
- secretAccessKey,
192235
- endpoint
192236
- },
192237
- masterKey
192238
- };
192239
- }
192240
- function getSecretsKey(gameId) {
192241
- return `${gameId}.json.enc`;
192242
- }
192243
- function createR2Client(config2) {
192244
- return new import_client_s32.S3Client({
192245
- region: "auto",
192246
- endpoint: config2.credentials.endpoint,
192247
- credentials: {
192248
- accessKeyId: config2.credentials.accessKeyId,
192249
- secretAccessKey: config2.credentials.secretAccessKey
192250
- }
192251
- });
192252
- }
192253
- async function deleteSecrets(gameId, config2) {
192254
- const client = createR2Client(config2);
192255
- const key = getSecretsKey(gameId);
192256
- try {
192257
- await client.send(new import_client_s32.DeleteObjectCommand({
192258
- Bucket: config2.bucketName,
192259
- Key: key
192260
- }));
192261
- } catch (error2) {
192262
- log2.error("[SecretsStorage] Failed to delete secrets", { gameId, error: error2 });
192263
- throw new Error(`Failed to delete secrets for game ${gameId}`);
192264
- }
192265
- }
192266
192266
  function assertError(err2) {
192267
192267
  if (!isError(err2)) {
192268
192268
  throw new Error("Parameter was not an error");
@@ -198908,12 +198908,12 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
198908
198908
  // package.json
198909
198909
  var package_default2 = {
198910
198910
  name: "@playcademy/vite-plugin",
198911
- version: "0.2.2",
198911
+ version: "0.2.3",
198912
198912
  type: "module",
198913
198913
  exports: {
198914
198914
  ".": {
198915
- import: "./dist/index.js",
198916
- types: "./dist/index.d.ts"
198915
+ types: "./dist/index.d.ts",
198916
+ import: "./dist/index.js"
198917
198917
  }
198918
198918
  },
198919
198919
  main: "dist/index.js",
@@ -198927,7 +198927,6 @@ var package_default2 = {
198927
198927
  pub: "bun publish.ts"
198928
198928
  },
198929
198929
  dependencies: {
198930
- "@playcademy/utils": "workspace:*",
198931
198930
  archiver: "^7.0.1",
198932
198931
  picocolors: "^1.1.1",
198933
198932
  playcademy: "workspace:*"
@@ -198935,6 +198934,7 @@ var package_default2 = {
198935
198934
  devDependencies: {
198936
198935
  "@inquirer/prompts": "^7.8.6",
198937
198936
  "@playcademy/sandbox": "workspace:*",
198937
+ "@playcademy/utils": "workspace:*",
198938
198938
  "@types/archiver": "^6.0.3",
198939
198939
  "@types/bun": "latest"
198940
198940
  },
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@playcademy/vite-plugin",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
- "import": "./dist/index.js",
8
- "types": "./dist/index.d.ts"
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
9
  }
10
10
  },
11
11
  "main": "dist/index.js",
@@ -19,7 +19,6 @@
19
19
  "pub": "bun publish.ts"
20
20
  },
21
21
  "dependencies": {
22
- "@playcademy/utils": "0.0.1",
23
22
  "archiver": "^7.0.1",
24
23
  "picocolors": "^1.1.1",
25
24
  "playcademy": "0.14.28"
@@ -27,6 +26,7 @@
27
26
  "devDependencies": {
28
27
  "@inquirer/prompts": "^7.8.6",
29
28
  "@playcademy/sandbox": "0.3.6",
29
+ "@playcademy/utils": "0.0.1",
30
30
  "@types/archiver": "^6.0.3",
31
31
  "@types/bun": "latest"
32
32
  },