@playcademy/vite-plugin 0.1.21 → 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 +72 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -100152,6 +100152,9 @@ var isDevelopment = () => {
|
|
|
100152
100152
|
var isInteractiveTTY = () => {
|
|
100153
100153
|
return typeof process !== "undefined" && Boolean(process.stdout && process.stdout.isTTY);
|
|
100154
100154
|
};
|
|
100155
|
+
var isSilent = () => {
|
|
100156
|
+
return typeof process !== "undefined" && process.env.LOG_SILENT === "true";
|
|
100157
|
+
};
|
|
100155
100158
|
var detectOutputFormat = () => {
|
|
100156
100159
|
if (isBrowser()) {
|
|
100157
100160
|
return "browser";
|
|
@@ -100259,6 +100262,8 @@ var getMinimumLogLevel = () => {
|
|
|
100259
100262
|
return isProduction() ? "info" : "debug";
|
|
100260
100263
|
};
|
|
100261
100264
|
var shouldLog = (level) => {
|
|
100265
|
+
if (isSilent())
|
|
100266
|
+
return false;
|
|
100262
100267
|
const minLevel = getMinimumLogLevel();
|
|
100263
100268
|
return levelPriority[level] >= levelPriority[minLevel];
|
|
100264
100269
|
};
|
|
@@ -160042,7 +160047,7 @@ var logger2 = (fn = console.log) => {
|
|
|
160042
160047
|
};
|
|
160043
160048
|
var package_default = {
|
|
160044
160049
|
name: "@playcademy/sandbox",
|
|
160045
|
-
version: "0.1.
|
|
160050
|
+
version: "0.1.9",
|
|
160046
160051
|
description: "Local development server for Playcademy game development",
|
|
160047
160052
|
type: "module",
|
|
160048
160053
|
exports: {
|
|
@@ -166524,6 +166529,9 @@ var isDevelopment2 = () => {
|
|
|
166524
166529
|
var isInteractiveTTY2 = () => {
|
|
166525
166530
|
return typeof process !== "undefined" && Boolean(process.stdout && process.stdout.isTTY);
|
|
166526
166531
|
};
|
|
166532
|
+
var isSilent2 = () => {
|
|
166533
|
+
return typeof process !== "undefined" && process.env.LOG_SILENT === "true";
|
|
166534
|
+
};
|
|
166527
166535
|
var detectOutputFormat2 = () => {
|
|
166528
166536
|
if (isBrowser2()) {
|
|
166529
166537
|
return "browser";
|
|
@@ -166644,6 +166652,8 @@ var getMinimumLogLevel2 = () => {
|
|
|
166644
166652
|
return isProduction2() ? "info" : "debug";
|
|
166645
166653
|
};
|
|
166646
166654
|
var shouldLog2 = (level) => {
|
|
166655
|
+
if (isSilent2())
|
|
166656
|
+
return false;
|
|
166647
166657
|
const minLevel = getMinimumLogLevel2();
|
|
166648
166658
|
return levelPriority2[level] >= levelPriority2[minLevel];
|
|
166649
166659
|
};
|
|
@@ -193144,6 +193154,62 @@ function createD1Namespace(config2) {
|
|
|
193144
193154
|
error: error2
|
|
193145
193155
|
});
|
|
193146
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
|
+
});
|
|
193147
193213
|
}
|
|
193148
193214
|
};
|
|
193149
193215
|
}
|
|
@@ -193467,6 +193533,7 @@ class CloudflareProvider {
|
|
|
193467
193533
|
client;
|
|
193468
193534
|
config;
|
|
193469
193535
|
workers;
|
|
193536
|
+
d1;
|
|
193470
193537
|
constructor(config2) {
|
|
193471
193538
|
this.config = {
|
|
193472
193539
|
dispatchNamespace: DISPATCH_NAMESPACE_NAME,
|
|
@@ -193475,6 +193542,10 @@ class CloudflareProvider {
|
|
|
193475
193542
|
this.client = new cloudflare_default({
|
|
193476
193543
|
apiToken: config2.apiToken
|
|
193477
193544
|
});
|
|
193545
|
+
this.d1 = createD1Namespace({
|
|
193546
|
+
client: this.client,
|
|
193547
|
+
accountId: this.config.accountId
|
|
193548
|
+
});
|
|
193478
193549
|
this.workers = createWorkersNamespace({
|
|
193479
193550
|
client: this.client,
|
|
193480
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"
|