@playcademy/vite-plugin 0.1.22 → 0.1.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 +62 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -160047,7 +160047,7 @@ var logger2 = (fn = console.log) => {
|
|
|
160047
160047
|
};
|
|
160048
160048
|
var package_default = {
|
|
160049
160049
|
name: "@playcademy/sandbox",
|
|
160050
|
-
version: "0.1.
|
|
160050
|
+
version: "0.1.9",
|
|
160051
160051
|
description: "Local development server for Playcademy game development",
|
|
160052
160052
|
type: "module",
|
|
160053
160053
|
exports: {
|
|
@@ -193154,6 +193154,62 @@ function createD1Namespace(config2) {
|
|
|
193154
193154
|
error: error2
|
|
193155
193155
|
});
|
|
193156
193156
|
}
|
|
193157
|
+
},
|
|
193158
|
+
async reset(databaseName) {
|
|
193159
|
+
log2.debug("[CloudflareProvider] Resetting D1 database", { databaseName });
|
|
193160
|
+
const databases = await client2.d1.database.list({ account_id: accountId });
|
|
193161
|
+
let databaseId = null;
|
|
193162
|
+
for await (const db2 of databases) {
|
|
193163
|
+
if (db2.name === databaseName && db2.uuid) {
|
|
193164
|
+
databaseId = db2.uuid;
|
|
193165
|
+
break;
|
|
193166
|
+
}
|
|
193167
|
+
}
|
|
193168
|
+
if (!databaseId) {
|
|
193169
|
+
throw new Error(`D1 database not found: ${databaseName}`);
|
|
193170
|
+
}
|
|
193171
|
+
const tablesResult = await client2.d1.database.query(databaseId, {
|
|
193172
|
+
account_id: accountId,
|
|
193173
|
+
sql: "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%'"
|
|
193174
|
+
});
|
|
193175
|
+
const tables = tablesResult.result?.[0]?.results || [];
|
|
193176
|
+
if (tables.length === 0) {
|
|
193177
|
+
log2.info("[CloudflareProvider] No tables to drop", { databaseName, databaseId });
|
|
193178
|
+
return;
|
|
193179
|
+
}
|
|
193180
|
+
log2.debug("[CloudflareProvider] Found tables to drop", {
|
|
193181
|
+
databaseId,
|
|
193182
|
+
count: tables.length,
|
|
193183
|
+
tables: tables.map((t2) => t2.name)
|
|
193184
|
+
});
|
|
193185
|
+
await client2.d1.database.query(databaseId, {
|
|
193186
|
+
account_id: accountId,
|
|
193187
|
+
sql: "PRAGMA defer_foreign_keys = on"
|
|
193188
|
+
});
|
|
193189
|
+
for (const table16 of tables) {
|
|
193190
|
+
if (!table16.name) {
|
|
193191
|
+
log2.warn("[CloudflareProvider] Skipping table with undefined name", { table: table16 });
|
|
193192
|
+
continue;
|
|
193193
|
+
}
|
|
193194
|
+
log2.debug("[CloudflareProvider] Dropping table", {
|
|
193195
|
+
databaseName,
|
|
193196
|
+
databaseId,
|
|
193197
|
+
table: table16.name
|
|
193198
|
+
});
|
|
193199
|
+
await client2.d1.database.query(databaseId, {
|
|
193200
|
+
account_id: accountId,
|
|
193201
|
+
sql: `DROP TABLE IF EXISTS "${table16.name}"`
|
|
193202
|
+
});
|
|
193203
|
+
}
|
|
193204
|
+
await client2.d1.database.query(databaseId, {
|
|
193205
|
+
account_id: accountId,
|
|
193206
|
+
sql: "PRAGMA defer_foreign_keys = off"
|
|
193207
|
+
});
|
|
193208
|
+
log2.info("[CloudflareProvider] D1 database reset complete", {
|
|
193209
|
+
databaseName,
|
|
193210
|
+
databaseId,
|
|
193211
|
+
tablesDropped: tables.length
|
|
193212
|
+
});
|
|
193157
193213
|
}
|
|
193158
193214
|
};
|
|
193159
193215
|
}
|
|
@@ -193477,6 +193533,7 @@ class CloudflareProvider {
|
|
|
193477
193533
|
client;
|
|
193478
193534
|
config;
|
|
193479
193535
|
workers;
|
|
193536
|
+
d1;
|
|
193480
193537
|
constructor(config2) {
|
|
193481
193538
|
this.config = {
|
|
193482
193539
|
dispatchNamespace: DISPATCH_NAMESPACE_NAME,
|
|
@@ -193485,6 +193542,10 @@ class CloudflareProvider {
|
|
|
193485
193542
|
this.client = new cloudflare_default({
|
|
193486
193543
|
apiToken: config2.apiToken
|
|
193487
193544
|
});
|
|
193545
|
+
this.d1 = createD1Namespace({
|
|
193546
|
+
client: this.client,
|
|
193547
|
+
accountId: this.config.accountId
|
|
193548
|
+
});
|
|
193488
193549
|
this.workers = createWorkersNamespace({
|
|
193489
193550
|
client: this.client,
|
|
193490
193551
|
accountId: this.config.accountId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"archiver": "^7.0.1",
|
|
27
27
|
"picocolors": "^1.1.1",
|
|
28
|
-
"playcademy": "0.
|
|
28
|
+
"playcademy": "0.14.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@inquirer/prompts": "^7.8.6",
|
|
32
|
-
"@playcademy/sandbox": "0.1.
|
|
32
|
+
"@playcademy/sandbox": "0.1.9",
|
|
33
33
|
"@types/archiver": "^6.0.3",
|
|
34
34
|
"@types/bun": "latest",
|
|
35
35
|
"yocto-spinner": "^0.2.2"
|