@playcademy/vite-plugin 0.2.4 → 0.2.5
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 +98 -81
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -42224,7 +42224,7 @@ ${t}`), i3 = h(this, y2).getSize();
|
|
|
42224
42224
|
};
|
|
42225
42225
|
});
|
|
42226
42226
|
var require_main = __commonJS2((exports, module2) => {
|
|
42227
|
-
var __dirname2 = "/Users/hbauer/work/
|
|
42227
|
+
var __dirname2 = "/Users/hbauer/work/clones/playcademy-test/node_modules/esbuild/lib", __filename2 = "/Users/hbauer/work/clones/playcademy-test/node_modules/esbuild/lib/main.js";
|
|
42228
42228
|
var __defProp22 = Object.defineProperty;
|
|
42229
42229
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
42230
42230
|
var __getOwnPropNames22 = Object.getOwnPropertyNames;
|
|
@@ -128991,9 +128991,9 @@ var require_serde = __commonJS2((exports, module2) => {
|
|
|
128991
128991
|
strictParseShort: () => strictParseShort2
|
|
128992
128992
|
});
|
|
128993
128993
|
module2.exports = __toCommonJS(serde_exports);
|
|
128994
|
-
var
|
|
128994
|
+
var import_schema3 = require_schema();
|
|
128995
128995
|
var copyDocumentWithTransform2 = (source, schemaRef, transform = (_5) => _5) => {
|
|
128996
|
-
const ns =
|
|
128996
|
+
const ns = import_schema3.NormalizedSchema.of(schemaRef);
|
|
128997
128997
|
switch (typeof source) {
|
|
128998
128998
|
case "undefined":
|
|
128999
128999
|
case "boolean":
|
|
@@ -129604,7 +129604,7 @@ var require_protocols = __commonJS2((exports, module2) => {
|
|
|
129604
129604
|
return "%" + c3.charCodeAt(0).toString(16).toUpperCase();
|
|
129605
129605
|
});
|
|
129606
129606
|
}
|
|
129607
|
-
var
|
|
129607
|
+
var import_schema22 = require_schema();
|
|
129608
129608
|
var import_protocol_http2 = require_dist_cjs2();
|
|
129609
129609
|
var import_schema3 = require_schema();
|
|
129610
129610
|
var import_serde = require_serde();
|
|
@@ -129770,7 +129770,7 @@ var require_protocols = __commonJS2((exports, module2) => {
|
|
|
129770
129770
|
const query = {};
|
|
129771
129771
|
const headers = {};
|
|
129772
129772
|
const endpoint = await context.endpoint();
|
|
129773
|
-
const ns =
|
|
129773
|
+
const ns = import_schema22.NormalizedSchema.of(operationSchema?.input);
|
|
129774
129774
|
const schema4 = ns.getSchema();
|
|
129775
129775
|
let hasNonHttpBindingMember = false;
|
|
129776
129776
|
let payload;
|
|
@@ -129787,7 +129787,7 @@ var require_protocols = __commonJS2((exports, module2) => {
|
|
|
129787
129787
|
if (endpoint) {
|
|
129788
129788
|
this.updateServiceEndpoint(request3, endpoint);
|
|
129789
129789
|
this.setHostPrefix(request3, operationSchema, input);
|
|
129790
|
-
const opTraits =
|
|
129790
|
+
const opTraits = import_schema22.NormalizedSchema.translateTraits(operationSchema.traits);
|
|
129791
129791
|
if (opTraits.http) {
|
|
129792
129792
|
request3.method = opTraits.http[0];
|
|
129793
129793
|
const [path32, search] = opTraits.http[1].split("?");
|
|
@@ -129865,7 +129865,7 @@ var require_protocols = __commonJS2((exports, module2) => {
|
|
|
129865
129865
|
if (traits.httpQueryParams) {
|
|
129866
129866
|
for (const [key, val2] of Object.entries(data)) {
|
|
129867
129867
|
if (!(key in query)) {
|
|
129868
|
-
this.serializeQuery(
|
|
129868
|
+
this.serializeQuery(import_schema22.NormalizedSchema.of([
|
|
129869
129869
|
ns.getValueSchema(),
|
|
129870
129870
|
{
|
|
129871
129871
|
...traits,
|
|
@@ -129895,12 +129895,12 @@ var require_protocols = __commonJS2((exports, module2) => {
|
|
|
129895
129895
|
}
|
|
129896
129896
|
async deserializeResponse(operationSchema, context, response) {
|
|
129897
129897
|
const deserializer = this.deserializer;
|
|
129898
|
-
const ns =
|
|
129898
|
+
const ns = import_schema22.NormalizedSchema.of(operationSchema.output);
|
|
129899
129899
|
const dataObject = {};
|
|
129900
129900
|
if (response.statusCode >= 300) {
|
|
129901
129901
|
const bytes = await collectBody2(response.body, context);
|
|
129902
129902
|
if (bytes.byteLength > 0) {
|
|
129903
|
-
Object.assign(dataObject, await deserializer.read(
|
|
129903
|
+
Object.assign(dataObject, await deserializer.read(import_schema22.SCHEMA.DOCUMENT, bytes));
|
|
129904
129904
|
}
|
|
129905
129905
|
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
129906
129906
|
throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
|
|
@@ -134540,7 +134540,7 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
134540
134540
|
this.serdeContext = serdeContext;
|
|
134541
134541
|
}
|
|
134542
134542
|
};
|
|
134543
|
-
var
|
|
134543
|
+
var import_schema4 = require_schema();
|
|
134544
134544
|
var import_serde2 = require_serde();
|
|
134545
134545
|
var import_util_base64 = require_dist_cjs9();
|
|
134546
134546
|
var import_serde = require_serde();
|
|
@@ -134631,7 +134631,7 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
134631
134631
|
}
|
|
134632
134632
|
_read(schema4, value) {
|
|
134633
134633
|
const isObject4 = value !== null && typeof value === "object";
|
|
134634
|
-
const ns =
|
|
134634
|
+
const ns = import_schema4.NormalizedSchema.of(schema4);
|
|
134635
134635
|
if (ns.isListSchema() && Array.isArray(value)) {
|
|
134636
134636
|
const listMember = ns.getValueSchema();
|
|
134637
134637
|
const out2 = [];
|
|
@@ -134675,13 +134675,13 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
134675
134675
|
}
|
|
134676
134676
|
if (ns.isTimestampSchema()) {
|
|
134677
134677
|
const options = this.settings.timestampFormat;
|
|
134678
|
-
const format = options.useTrait ? ns.getSchema() ===
|
|
134678
|
+
const format = options.useTrait ? ns.getSchema() === import_schema4.SCHEMA.TIMESTAMP_DEFAULT ? options.default : ns.getSchema() ?? options.default : options.default;
|
|
134679
134679
|
switch (format) {
|
|
134680
|
-
case
|
|
134680
|
+
case import_schema4.SCHEMA.TIMESTAMP_DATE_TIME:
|
|
134681
134681
|
return (0, import_serde2.parseRfc3339DateTimeWithOffset)(value);
|
|
134682
|
-
case
|
|
134682
|
+
case import_schema4.SCHEMA.TIMESTAMP_HTTP_DATE:
|
|
134683
134683
|
return (0, import_serde2.parseRfc7231DateTime)(value);
|
|
134684
|
-
case
|
|
134684
|
+
case import_schema4.SCHEMA.TIMESTAMP_EPOCH_SECONDS:
|
|
134685
134685
|
return (0, import_serde2.parseEpochTimestamp)(value);
|
|
134686
134686
|
default:
|
|
134687
134687
|
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
@@ -134990,7 +134990,7 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
134990
134990
|
}
|
|
134991
134991
|
};
|
|
134992
134992
|
var import_protocols2 = require_protocols();
|
|
134993
|
-
var
|
|
134993
|
+
var import_schema42 = require_schema();
|
|
134994
134994
|
var import_util_body_length_browser2 = require_dist_cjs21();
|
|
134995
134995
|
var AwsRestJsonProtocol = class extends import_protocols2.HttpBindingProtocol {
|
|
134996
134996
|
static {
|
|
@@ -135006,7 +135006,7 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
135006
135006
|
const settings = {
|
|
135007
135007
|
timestampFormat: {
|
|
135008
135008
|
useTrait: true,
|
|
135009
|
-
default:
|
|
135009
|
+
default: import_schema42.SCHEMA.TIMESTAMP_EPOCH_SECONDS
|
|
135010
135010
|
},
|
|
135011
135011
|
httpBindings: true,
|
|
135012
135012
|
jsonName: true
|
|
@@ -135027,7 +135027,7 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
135027
135027
|
}
|
|
135028
135028
|
async serializeRequest(operationSchema, input, context) {
|
|
135029
135029
|
const request3 = await super.serializeRequest(operationSchema, input, context);
|
|
135030
|
-
const inputSchema =
|
|
135030
|
+
const inputSchema = import_schema42.NormalizedSchema.of(operationSchema.input);
|
|
135031
135031
|
const members = inputSchema.getMemberSchemas();
|
|
135032
135032
|
if (!request3.headers["content-type"]) {
|
|
135033
135033
|
const httpPayloadMember = Object.values(members).find((m5) => {
|
|
@@ -135071,19 +135071,19 @@ var require_protocols2 = __commonJS2((exports, module2) => {
|
|
|
135071
135071
|
if (errorIdentifier.includes("#")) {
|
|
135072
135072
|
[namespace, errorName] = errorIdentifier.split("#");
|
|
135073
135073
|
}
|
|
135074
|
-
const registry2 =
|
|
135074
|
+
const registry2 = import_schema42.TypeRegistry.for(namespace);
|
|
135075
135075
|
let errorSchema;
|
|
135076
135076
|
try {
|
|
135077
135077
|
errorSchema = registry2.getSchema(errorIdentifier);
|
|
135078
135078
|
} catch (e2) {
|
|
135079
|
-
const baseExceptionSchema =
|
|
135079
|
+
const baseExceptionSchema = import_schema42.TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace).getBaseException();
|
|
135080
135080
|
if (baseExceptionSchema) {
|
|
135081
135081
|
const ErrorCtor = baseExceptionSchema.ctor;
|
|
135082
135082
|
throw Object.assign(new ErrorCtor(errorName), dataObject);
|
|
135083
135083
|
}
|
|
135084
135084
|
throw new Error(errorName);
|
|
135085
135085
|
}
|
|
135086
|
-
const ns =
|
|
135086
|
+
const ns = import_schema42.NormalizedSchema.of(errorSchema);
|
|
135087
135087
|
const message2 = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
135088
135088
|
const exception = new errorSchema.ctor(message2);
|
|
135089
135089
|
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
@@ -161572,7 +161572,7 @@ Stop the other server or specify a different port with --port <number>.`);
|
|
|
161572
161572
|
}
|
|
161573
161573
|
var package_default = {
|
|
161574
161574
|
name: "@playcademy/sandbox",
|
|
161575
|
-
version: "0.3.
|
|
161575
|
+
version: "0.3.7",
|
|
161576
161576
|
description: "Local development server for Playcademy game development",
|
|
161577
161577
|
type: "module",
|
|
161578
161578
|
exports: {
|
|
@@ -185140,6 +185140,15 @@ function createCustomHostnamesNamespace(config2) {
|
|
|
185140
185140
|
}
|
|
185141
185141
|
};
|
|
185142
185142
|
}
|
|
185143
|
+
function buildSchemaSql(sql3) {
|
|
185144
|
+
const trimmed = sql3.trim();
|
|
185145
|
+
if (!trimmed) {
|
|
185146
|
+
return "";
|
|
185147
|
+
}
|
|
185148
|
+
return `PRAGMA defer_foreign_keys = on;
|
|
185149
|
+
${trimmed}
|
|
185150
|
+
PRAGMA defer_foreign_keys = off;`;
|
|
185151
|
+
}
|
|
185143
185152
|
function createD1Namespace(config2) {
|
|
185144
185153
|
const { client, accountId } = config2;
|
|
185145
185154
|
return {
|
|
@@ -185173,26 +185182,22 @@ function createD1Namespace(config2) {
|
|
|
185173
185182
|
async executeSchema(databaseId, schema4) {
|
|
185174
185183
|
log2.debug("[Cloudflare D1] Executing schema", {
|
|
185175
185184
|
databaseId,
|
|
185176
|
-
schemaHash: schema4.hash
|
|
185185
|
+
schemaHash: schema4.hash,
|
|
185186
|
+
sqlLength: schema4.sql.length
|
|
185177
185187
|
});
|
|
185178
185188
|
try {
|
|
185179
|
-
const
|
|
185180
|
-
|
|
185181
|
-
|
|
185182
|
-
|
|
185183
|
-
|
|
185184
|
-
|
|
185185
|
-
|
|
185186
|
-
|
|
185187
|
-
|
|
185188
|
-
sql: statement
|
|
185189
|
-
});
|
|
185190
|
-
}
|
|
185191
|
-
}
|
|
185189
|
+
const sql3 = buildSchemaSql(schema4.sql);
|
|
185190
|
+
log2.debug("[Cloudflare D1] Executing schema", {
|
|
185191
|
+
databaseId,
|
|
185192
|
+
sql: sql3
|
|
185193
|
+
});
|
|
185194
|
+
await client.d1.database.query(databaseId, {
|
|
185195
|
+
account_id: accountId,
|
|
185196
|
+
sql: sql3
|
|
185197
|
+
});
|
|
185192
185198
|
log2.info("[Cloudflare D1] Schema executed", {
|
|
185193
185199
|
databaseId,
|
|
185194
|
-
schemaHash: schema4.hash
|
|
185195
|
-
statementsExecuted: statements.length
|
|
185200
|
+
schemaHash: schema4.hash
|
|
185196
185201
|
});
|
|
185197
185202
|
} catch (error2) {
|
|
185198
185203
|
log2.error("[Cloudflare D1] Failed to execute schema", {
|
|
@@ -185222,52 +185227,31 @@ function createD1Namespace(config2) {
|
|
|
185222
185227
|
},
|
|
185223
185228
|
async reset(name4) {
|
|
185224
185229
|
log2.debug("[Cloudflare D1] Resetting database", { name: name4 });
|
|
185225
|
-
|
|
185226
|
-
|
|
185227
|
-
|
|
185228
|
-
|
|
185229
|
-
|
|
185230
|
-
|
|
185230
|
+
try {
|
|
185231
|
+
const databases = await client.d1.database.list({ account_id: accountId });
|
|
185232
|
+
for await (const db of databases) {
|
|
185233
|
+
if (db.name === name4 && db.uuid) {
|
|
185234
|
+
log2.debug("[Cloudflare D1] Deleting existing database", {
|
|
185235
|
+
name: name4,
|
|
185236
|
+
uuid: db.uuid
|
|
185237
|
+
});
|
|
185238
|
+
await client.d1.database.delete(db.uuid, { account_id: accountId });
|
|
185239
|
+
log2.info("[Cloudflare D1] Deleted existing database", { name: name4 });
|
|
185240
|
+
break;
|
|
185241
|
+
}
|
|
185231
185242
|
}
|
|
185243
|
+
} catch (error2) {
|
|
185244
|
+
log2.warn("[Cloudflare D1] Failed to delete existing database", { name: name4, error: error2 });
|
|
185232
185245
|
}
|
|
185233
|
-
|
|
185234
|
-
throw new Error(`D1 database not found: ${name4}`);
|
|
185235
|
-
}
|
|
185236
|
-
const tablesResult = await client.d1.database.query(databaseId, {
|
|
185237
|
-
account_id: accountId,
|
|
185238
|
-
sql: "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%'"
|
|
185239
|
-
});
|
|
185240
|
-
const tables = tablesResult.result?.[0]?.results || [];
|
|
185241
|
-
if (tables.length === 0) {
|
|
185242
|
-
log2.info("[Cloudflare D1] No tables to drop", { name: name4, databaseId });
|
|
185243
|
-
return;
|
|
185244
|
-
}
|
|
185245
|
-
log2.debug("[Cloudflare D1] Found tables to drop", {
|
|
185246
|
-
databaseId,
|
|
185247
|
-
count: tables.length,
|
|
185248
|
-
tables: tables.map((t2) => t2.name)
|
|
185249
|
-
});
|
|
185250
|
-
await client.d1.database.query(databaseId, {
|
|
185246
|
+
const result = await client.d1.database.create({
|
|
185251
185247
|
account_id: accountId,
|
|
185252
|
-
|
|
185248
|
+
name: name4
|
|
185253
185249
|
});
|
|
185254
|
-
|
|
185255
|
-
|
|
185256
|
-
continue;
|
|
185257
|
-
await client.d1.database.query(databaseId, {
|
|
185258
|
-
account_id: accountId,
|
|
185259
|
-
sql: `DROP TABLE IF EXISTS "${table14.name}"`
|
|
185260
|
-
});
|
|
185250
|
+
if (!result.uuid) {
|
|
185251
|
+
throw new Error("Database creation succeeded but no UUID returned");
|
|
185261
185252
|
}
|
|
185262
|
-
|
|
185263
|
-
|
|
185264
|
-
sql: "PRAGMA defer_foreign_keys = off"
|
|
185265
|
-
});
|
|
185266
|
-
log2.info("[Cloudflare D1] Database reset complete", {
|
|
185267
|
-
name: name4,
|
|
185268
|
-
databaseId,
|
|
185269
|
-
tablesDropped: tables.length
|
|
185270
|
-
});
|
|
185253
|
+
log2.info("[Cloudflare D1] Database reset complete", { name: name4, uuid: result.uuid });
|
|
185254
|
+
return result.uuid;
|
|
185271
185255
|
}
|
|
185272
185256
|
};
|
|
185273
185257
|
}
|
|
@@ -194616,6 +194600,7 @@ gameUploadsRouter.post("/uploads/initiate", async (c3) => {
|
|
|
194616
194600
|
});
|
|
194617
194601
|
var gameVerifyRouter = new Hono2;
|
|
194618
194602
|
gameVerifyRouter.post("/verify", async (c3) => {
|
|
194603
|
+
const clonedRequest = c3.req.raw.clone();
|
|
194619
194604
|
const body2 = await c3.req.json().catch(() => ({}));
|
|
194620
194605
|
const token2 = body2?.token;
|
|
194621
194606
|
if (!token2) {
|
|
@@ -194644,11 +194629,43 @@ gameVerifyRouter.post("/verify", async (c3) => {
|
|
|
194644
194629
|
}
|
|
194645
194630
|
});
|
|
194646
194631
|
}
|
|
194632
|
+
if (token2.endsWith(".sandbox")) {
|
|
194633
|
+
try {
|
|
194634
|
+
const parts2 = token2.split(".");
|
|
194635
|
+
if (parts2.length === 3) {
|
|
194636
|
+
const payload = JSON.parse(atob(parts2[1]));
|
|
194637
|
+
const userId = payload.uid;
|
|
194638
|
+
const gameIdOrSlug = payload.sub;
|
|
194639
|
+
const db = c3.get("db");
|
|
194640
|
+
const userData = await db.query.users.findFirst({
|
|
194641
|
+
where: (users2, { eq: eq3 }) => eq3(users2.id, userId)
|
|
194642
|
+
});
|
|
194643
|
+
if (!userData) {
|
|
194644
|
+
return c3.json({ error: "User not found in sandbox" }, 500);
|
|
194645
|
+
}
|
|
194646
|
+
return c3.json({
|
|
194647
|
+
claims: payload,
|
|
194648
|
+
gameId: gameIdOrSlug,
|
|
194649
|
+
user: {
|
|
194650
|
+
sub: userData.id,
|
|
194651
|
+
email: userData.email || "",
|
|
194652
|
+
name: userData.name || userData.username || "",
|
|
194653
|
+
email_verified: true,
|
|
194654
|
+
given_name: undefined,
|
|
194655
|
+
family_name: undefined,
|
|
194656
|
+
timeback_id: userData.timebackId || undefined
|
|
194657
|
+
}
|
|
194658
|
+
});
|
|
194659
|
+
}
|
|
194660
|
+
} catch {
|
|
194661
|
+
return c3.json({ error: "Invalid sandbox token" }, 400);
|
|
194662
|
+
}
|
|
194663
|
+
}
|
|
194647
194664
|
const ctx = {
|
|
194648
194665
|
user: undefined,
|
|
194649
194666
|
params: {},
|
|
194650
194667
|
url: new URL(c3.req.url),
|
|
194651
|
-
request:
|
|
194668
|
+
request: clonedRequest
|
|
194652
194669
|
};
|
|
194653
194670
|
try {
|
|
194654
194671
|
const result = await verifyGameToken(ctx);
|
|
@@ -198908,7 +198925,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
198908
198925
|
// package.json
|
|
198909
198926
|
var package_default2 = {
|
|
198910
198927
|
name: "@playcademy/vite-plugin",
|
|
198911
|
-
version: "0.2.
|
|
198928
|
+
version: "0.2.5",
|
|
198912
198929
|
type: "module",
|
|
198913
198930
|
exports: {
|
|
198914
198931
|
".": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"archiver": "^7.0.1",
|
|
23
23
|
"picocolors": "^1.1.1",
|
|
24
|
-
"playcademy": "0.14.
|
|
24
|
+
"playcademy": "0.14.32"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@inquirer/prompts": "^7.8.6",
|
|
28
|
-
"@playcademy/sandbox": "0.3.
|
|
28
|
+
"@playcademy/sandbox": "0.3.7",
|
|
29
29
|
"@playcademy/utils": "0.0.1",
|
|
30
30
|
"@types/archiver": "^6.0.3",
|
|
31
31
|
"@types/bun": "latest"
|