playcademy 0.13.20 → 0.13.22
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/db.js +4 -0
- package/dist/index.js +88 -170
- package/dist/utils.js +5 -0
- package/package.json +2 -2
package/dist/db.js
CHANGED
|
@@ -592,6 +592,10 @@ var logger = {
|
|
|
592
592
|
const spaces = " ".repeat(indent);
|
|
593
593
|
console.log(`${spaces}${text}`);
|
|
594
594
|
},
|
|
595
|
+
customRaw: (text, indent = 0) => {
|
|
596
|
+
const spaces = " ".repeat(indent);
|
|
597
|
+
console.log(`${spaces}${customTransform(text)}`);
|
|
598
|
+
},
|
|
595
599
|
/**
|
|
596
600
|
* Display a configuration error with helpful suggestions
|
|
597
601
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2580,6 +2580,10 @@ var init_logger = __esm({
|
|
|
2580
2580
|
const spaces = " ".repeat(indent);
|
|
2581
2581
|
console.log(`${spaces}${text5}`);
|
|
2582
2582
|
},
|
|
2583
|
+
customRaw: (text5, indent = 0) => {
|
|
2584
|
+
const spaces = " ".repeat(indent);
|
|
2585
|
+
console.log(`${spaces}${customTransform(text5)}`);
|
|
2586
|
+
},
|
|
2583
2587
|
/**
|
|
2584
2588
|
* Display a configuration error with helpful suggestions
|
|
2585
2589
|
*/
|
|
@@ -5254,6 +5258,7 @@ function filePathToRoutePath(filePath) {
|
|
|
5254
5258
|
routePath = routePath.replace(/\/?index$/, "");
|
|
5255
5259
|
}
|
|
5256
5260
|
let urlPath = "/" + routePath.replace(/\\/g, "/");
|
|
5261
|
+
urlPath = urlPath.replace(/\[\.\.\.([^\]]+)\]/g, ":$1{.*}");
|
|
5257
5262
|
urlPath = urlPath.replace(/\[([^\]]+)\]/g, ":$1");
|
|
5258
5263
|
urlPath = urlPath === "/" ? "/api" : `/api${urlPath}`;
|
|
5259
5264
|
return urlPath;
|
|
@@ -7989,6 +7994,57 @@ init_constants4();
|
|
|
7989
7994
|
|
|
7990
7995
|
// src/lib/dev/display.ts
|
|
7991
7996
|
init_core();
|
|
7997
|
+
|
|
7998
|
+
// src/lib/dev/route-sorting.ts
|
|
7999
|
+
function getSegmentType(segment) {
|
|
8000
|
+
if (segment.startsWith(":") && segment.includes("{.*}")) {
|
|
8001
|
+
return 2 /* CatchAll */;
|
|
8002
|
+
}
|
|
8003
|
+
if (segment.startsWith(":")) {
|
|
8004
|
+
return 1 /* Dynamic */;
|
|
8005
|
+
}
|
|
8006
|
+
return 0 /* Static */;
|
|
8007
|
+
}
|
|
8008
|
+
function compareSegments(a, b) {
|
|
8009
|
+
const typeA = getSegmentType(a);
|
|
8010
|
+
const typeB = getSegmentType(b);
|
|
8011
|
+
if (typeA !== typeB) {
|
|
8012
|
+
if (typeA === 1 /* Dynamic */ && typeB === 0 /* Static */) {
|
|
8013
|
+
return -1;
|
|
8014
|
+
}
|
|
8015
|
+
if (typeA === 0 /* Static */ && typeB === 1 /* Dynamic */) {
|
|
8016
|
+
return 1;
|
|
8017
|
+
}
|
|
8018
|
+
if (typeA === 2 /* CatchAll */ && typeB === 0 /* Static */) {
|
|
8019
|
+
return -1;
|
|
8020
|
+
}
|
|
8021
|
+
if (typeA === 0 /* Static */ && typeB === 2 /* CatchAll */) {
|
|
8022
|
+
return 1;
|
|
8023
|
+
}
|
|
8024
|
+
return typeA - typeB;
|
|
8025
|
+
}
|
|
8026
|
+
return a.localeCompare(b);
|
|
8027
|
+
}
|
|
8028
|
+
function sortRoutes(routes) {
|
|
8029
|
+
return [...routes].sort((a, b) => {
|
|
8030
|
+
const segmentsA = a.path.split("/").filter(Boolean);
|
|
8031
|
+
const segmentsB = b.path.split("/").filter(Boolean);
|
|
8032
|
+
const maxLength = Math.max(segmentsA.length, segmentsB.length);
|
|
8033
|
+
for (let i = 0; i < maxLength; i++) {
|
|
8034
|
+
const segA = segmentsA[i];
|
|
8035
|
+
const segB = segmentsB[i];
|
|
8036
|
+
if (segA === void 0) return -1;
|
|
8037
|
+
if (segB === void 0) return 1;
|
|
8038
|
+
const comparison = compareSegments(segA, segB);
|
|
8039
|
+
if (comparison !== 0) {
|
|
8040
|
+
return comparison;
|
|
8041
|
+
}
|
|
8042
|
+
}
|
|
8043
|
+
return 0;
|
|
8044
|
+
});
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
// src/lib/dev/display.ts
|
|
7992
8048
|
function displayRegisteredRoutes(integrations, customRoutes = []) {
|
|
7993
8049
|
const healthRoutes = [
|
|
7994
8050
|
{ path: ROUTES.HEALTH, method: "GET" }
|
|
@@ -7999,23 +8055,21 @@ function displayRegisteredRoutes(integrations, customRoutes = []) {
|
|
|
7999
8055
|
const method = hasSandboxCreds ? "POST" : "POST (not configured)";
|
|
8000
8056
|
timebackRoutes.push({ path: ROUTES.TIMEBACK.END_ACTIVITY, method });
|
|
8001
8057
|
}
|
|
8002
|
-
const customRoutesList = customRoutes.map((route) =>
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8058
|
+
const customRoutesList = customRoutes.map((route) => {
|
|
8059
|
+
const methods = route.methods?.join(", ") || "*";
|
|
8060
|
+
const isCatchAll = /{\.\*}/.test(route.path);
|
|
8061
|
+
return {
|
|
8062
|
+
path: route.path,
|
|
8063
|
+
method: isCatchAll ? `${methods} (catch-all)` : methods
|
|
8064
|
+
};
|
|
8065
|
+
});
|
|
8006
8066
|
const allRoutes = [...healthRoutes, ...timebackRoutes, ...customRoutesList];
|
|
8007
|
-
const
|
|
8008
|
-
const
|
|
8067
|
+
const sortedRoutes = sortRoutes(allRoutes);
|
|
8068
|
+
const maxPathLength = Math.max(...sortedRoutes.map((r) => r.path.length));
|
|
8069
|
+
sortedRoutes.forEach((route) => {
|
|
8009
8070
|
const paddedPath = route.path.padEnd(maxPathLength + 2, " ");
|
|
8010
|
-
logger.
|
|
8011
|
-
};
|
|
8012
|
-
healthRoutes.forEach(displayRoute);
|
|
8013
|
-
if (timebackRoutes.length > 0) {
|
|
8014
|
-
timebackRoutes.forEach(displayRoute);
|
|
8015
|
-
}
|
|
8016
|
-
if (customRoutesList.length > 0) {
|
|
8017
|
-
customRoutesList.forEach(displayRoute);
|
|
8018
|
-
}
|
|
8071
|
+
logger.customRaw(`<${paddedPath}> ${dim5(route.method)}`, 1);
|
|
8072
|
+
});
|
|
8019
8073
|
}
|
|
8020
8074
|
|
|
8021
8075
|
// src/lib/dev/reload.ts
|
|
@@ -9241,7 +9295,7 @@ async function runDevServer(options) {
|
|
|
9241
9295
|
logger: options.logger !== false
|
|
9242
9296
|
});
|
|
9243
9297
|
serverRef.current = server;
|
|
9244
|
-
logger.success(`Game API started: ${underline2(
|
|
9298
|
+
logger.success(`Game API started: ${underline2(`<http://localhost:${port}/api>`)}`);
|
|
9245
9299
|
logger.newLine();
|
|
9246
9300
|
const customRoutesDir = getCustomRoutesDirectory(workspace, config);
|
|
9247
9301
|
const customRoutes = await discoverRoutes(customRoutesDir);
|
|
@@ -9452,7 +9506,6 @@ async function runDbInit() {
|
|
|
9452
9506
|
}
|
|
9453
9507
|
|
|
9454
9508
|
// src/commands/db/reset.ts
|
|
9455
|
-
init_src2();
|
|
9456
9509
|
init_src();
|
|
9457
9510
|
import { spawn } from "child_process";
|
|
9458
9511
|
import { existsSync as existsSync19, rmSync as rmSync2 } from "fs";
|
|
@@ -9503,24 +9556,10 @@ async function runDbReset() {
|
|
|
9503
9556
|
logger.newLine();
|
|
9504
9557
|
return;
|
|
9505
9558
|
}
|
|
9506
|
-
|
|
9507
|
-
const { code } = await bundleBackend(config);
|
|
9559
|
+
await loadConfig();
|
|
9508
9560
|
try {
|
|
9509
9561
|
const mf = new Miniflare2({
|
|
9510
|
-
|
|
9511
|
-
// Random available port
|
|
9512
|
-
modules: [
|
|
9513
|
-
{
|
|
9514
|
-
type: "ESModule",
|
|
9515
|
-
path: "index.mjs",
|
|
9516
|
-
contents: code
|
|
9517
|
-
}
|
|
9518
|
-
],
|
|
9519
|
-
bindings: {
|
|
9520
|
-
PLAYCADEMY_API_KEY: "dev-api-key",
|
|
9521
|
-
GAME_ID: CORE_GAME_UUIDS.PLAYGROUND,
|
|
9522
|
-
PLAYCADEMY_BASE_URL: "http://localhost:5174"
|
|
9523
|
-
},
|
|
9562
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
9524
9563
|
d1Databases: ["DB"],
|
|
9525
9564
|
d1Persist: dbDir,
|
|
9526
9565
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -9544,7 +9583,7 @@ async function runDbReset() {
|
|
|
9544
9583
|
// stdin: ignore, stdout: ignore, stderr: inherit
|
|
9545
9584
|
env: process.env
|
|
9546
9585
|
});
|
|
9547
|
-
child.on("close", (
|
|
9586
|
+
child.on("close", (code) => resolve11(code || 0));
|
|
9548
9587
|
child.on("error", () => resolve11(1));
|
|
9549
9588
|
});
|
|
9550
9589
|
return exitCode2;
|
|
@@ -9642,19 +9681,9 @@ async function runKVClear(options = {}) {
|
|
|
9642
9681
|
}
|
|
9643
9682
|
process.exit(1);
|
|
9644
9683
|
}
|
|
9645
|
-
const bundle = await bundleBackend(config, {
|
|
9646
|
-
sourcemap: false,
|
|
9647
|
-
minify: false
|
|
9648
|
-
});
|
|
9649
9684
|
const kvDir = join24(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
9650
9685
|
const mf = new Miniflare3({
|
|
9651
|
-
modules: [
|
|
9652
|
-
{
|
|
9653
|
-
type: "ESModule",
|
|
9654
|
-
path: "index.mjs",
|
|
9655
|
-
contents: bundle.code
|
|
9656
|
-
}
|
|
9657
|
-
],
|
|
9686
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
9658
9687
|
kvNamespaces: ["KV"],
|
|
9659
9688
|
kvPersist: kvDir,
|
|
9660
9689
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -9765,19 +9794,9 @@ async function runKVDelete(key, options = {}) {
|
|
|
9765
9794
|
}
|
|
9766
9795
|
process.exit(1);
|
|
9767
9796
|
}
|
|
9768
|
-
const bundle = await bundleBackend(config, {
|
|
9769
|
-
sourcemap: false,
|
|
9770
|
-
minify: false
|
|
9771
|
-
});
|
|
9772
9797
|
const kvDir = join25(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
9773
9798
|
const mf = new Miniflare4({
|
|
9774
|
-
modules: [
|
|
9775
|
-
{
|
|
9776
|
-
type: "ESModule",
|
|
9777
|
-
path: "index.mjs",
|
|
9778
|
-
contents: bundle.code
|
|
9779
|
-
}
|
|
9780
|
-
],
|
|
9799
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
9781
9800
|
kvNamespaces: ["KV"],
|
|
9782
9801
|
kvPersist: kvDir,
|
|
9783
9802
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -9853,19 +9872,9 @@ async function runKVGet(key, options = {}) {
|
|
|
9853
9872
|
}
|
|
9854
9873
|
process.exit(1);
|
|
9855
9874
|
}
|
|
9856
|
-
const bundle = await bundleBackend(config, {
|
|
9857
|
-
sourcemap: false,
|
|
9858
|
-
minify: false
|
|
9859
|
-
});
|
|
9860
9875
|
const kvDir = join26(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
9861
9876
|
const mf = new Miniflare5({
|
|
9862
|
-
modules: [
|
|
9863
|
-
{
|
|
9864
|
-
type: "ESModule",
|
|
9865
|
-
path: "index.mjs",
|
|
9866
|
-
contents: bundle.code
|
|
9867
|
-
}
|
|
9868
|
-
],
|
|
9877
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
9869
9878
|
kvNamespaces: ["KV"],
|
|
9870
9879
|
kvPersist: kvDir,
|
|
9871
9880
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10043,19 +10052,9 @@ async function runKVInspect(key, options = {}) {
|
|
|
10043
10052
|
}
|
|
10044
10053
|
process.exit(1);
|
|
10045
10054
|
}
|
|
10046
|
-
const bundle = await bundleBackend(config, {
|
|
10047
|
-
sourcemap: false,
|
|
10048
|
-
minify: false
|
|
10049
|
-
});
|
|
10050
10055
|
const kvDir = join27(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
10051
10056
|
const mf = new Miniflare6({
|
|
10052
|
-
modules: [
|
|
10053
|
-
{
|
|
10054
|
-
type: "ESModule",
|
|
10055
|
-
path: "index.mjs",
|
|
10056
|
-
contents: bundle.code
|
|
10057
|
-
}
|
|
10058
|
-
],
|
|
10057
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10059
10058
|
kvNamespaces: ["KV"],
|
|
10060
10059
|
kvPersist: kvDir,
|
|
10061
10060
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10173,19 +10172,9 @@ async function runKVList(options = {}) {
|
|
|
10173
10172
|
}
|
|
10174
10173
|
process.exit(1);
|
|
10175
10174
|
}
|
|
10176
|
-
const bundle = await bundleBackend(config, {
|
|
10177
|
-
sourcemap: false,
|
|
10178
|
-
minify: false
|
|
10179
|
-
});
|
|
10180
10175
|
const kvDir = join28(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
10181
10176
|
const mf = new Miniflare7({
|
|
10182
|
-
modules: [
|
|
10183
|
-
{
|
|
10184
|
-
type: "ESModule",
|
|
10185
|
-
path: "index.mjs",
|
|
10186
|
-
contents: bundle.code
|
|
10187
|
-
}
|
|
10188
|
-
],
|
|
10177
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10189
10178
|
kvNamespaces: ["KV"],
|
|
10190
10179
|
kvPersist: kvDir,
|
|
10191
10180
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10298,19 +10287,9 @@ async function runKVSeed(seedFile, options = {}) {
|
|
|
10298
10287
|
}
|
|
10299
10288
|
process.exit(1);
|
|
10300
10289
|
}
|
|
10301
|
-
const bundle = await bundleBackend(config, {
|
|
10302
|
-
sourcemap: false,
|
|
10303
|
-
minify: false
|
|
10304
|
-
});
|
|
10305
10290
|
const kvDir = join29(workspace, CLI_DIRECTORIES.KV);
|
|
10306
10291
|
const mf = new Miniflare8({
|
|
10307
|
-
modules: [
|
|
10308
|
-
{
|
|
10309
|
-
type: "ESModule",
|
|
10310
|
-
path: "index.mjs",
|
|
10311
|
-
contents: bundle.code
|
|
10312
|
-
}
|
|
10313
|
-
],
|
|
10292
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10314
10293
|
kvNamespaces: ["KV"],
|
|
10315
10294
|
kvPersist: kvDir,
|
|
10316
10295
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10459,19 +10438,9 @@ async function runKVSet(key, value, options = {}) {
|
|
|
10459
10438
|
}
|
|
10460
10439
|
process.exit(1);
|
|
10461
10440
|
}
|
|
10462
|
-
const bundle = await bundleBackend(config, {
|
|
10463
|
-
sourcemap: false,
|
|
10464
|
-
minify: false
|
|
10465
|
-
});
|
|
10466
10441
|
const kvDir = join30(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
10467
10442
|
const mf = new Miniflare9({
|
|
10468
|
-
modules: [
|
|
10469
|
-
{
|
|
10470
|
-
type: "ESModule",
|
|
10471
|
-
path: "index.mjs",
|
|
10472
|
-
contents: bundle.code
|
|
10473
|
-
}
|
|
10474
|
-
],
|
|
10443
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10475
10444
|
kvNamespaces: ["KV"],
|
|
10476
10445
|
kvPersist: kvDir,
|
|
10477
10446
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10539,19 +10508,9 @@ async function runKVStats(options = {}) {
|
|
|
10539
10508
|
}
|
|
10540
10509
|
process.exit(1);
|
|
10541
10510
|
}
|
|
10542
|
-
const bundle = await bundleBackend(config, {
|
|
10543
|
-
sourcemap: false,
|
|
10544
|
-
minify: false
|
|
10545
|
-
});
|
|
10546
10511
|
const kvDir = join31(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
10547
10512
|
const mf = new Miniflare10({
|
|
10548
|
-
modules: [
|
|
10549
|
-
{
|
|
10550
|
-
type: "ESModule",
|
|
10551
|
-
path: "index.mjs",
|
|
10552
|
-
contents: bundle.code
|
|
10553
|
-
}
|
|
10554
|
-
],
|
|
10513
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10555
10514
|
kvNamespaces: ["KV"],
|
|
10556
10515
|
kvPersist: kvDir,
|
|
10557
10516
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10707,19 +10666,9 @@ async function runBucketDelete(key, options = {}) {
|
|
|
10707
10666
|
}
|
|
10708
10667
|
process.exit(1);
|
|
10709
10668
|
}
|
|
10710
|
-
const bundle = await bundleBackend(config, {
|
|
10711
|
-
sourcemap: false,
|
|
10712
|
-
minify: false
|
|
10713
|
-
});
|
|
10714
10669
|
const bucketDir = join32(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
10715
10670
|
const mf = new Miniflare11({
|
|
10716
|
-
modules: [
|
|
10717
|
-
{
|
|
10718
|
-
type: "ESModule",
|
|
10719
|
-
path: "index.mjs",
|
|
10720
|
-
contents: bundle.code
|
|
10721
|
-
}
|
|
10722
|
-
],
|
|
10671
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10723
10672
|
r2Buckets: ["BUCKET"],
|
|
10724
10673
|
r2Persist: bucketDir,
|
|
10725
10674
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -10811,19 +10760,9 @@ async function runBucketGet(key, options = {}) {
|
|
|
10811
10760
|
}
|
|
10812
10761
|
process.exit(1);
|
|
10813
10762
|
}
|
|
10814
|
-
const bundle = await bundleBackend(config, {
|
|
10815
|
-
sourcemap: false,
|
|
10816
|
-
minify: false
|
|
10817
|
-
});
|
|
10818
10763
|
const bucketDir = join33(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
10819
10764
|
const mf = new Miniflare12({
|
|
10820
|
-
modules: [
|
|
10821
|
-
{
|
|
10822
|
-
type: "ESModule",
|
|
10823
|
-
path: "index.mjs",
|
|
10824
|
-
contents: bundle.code
|
|
10825
|
-
}
|
|
10826
|
-
],
|
|
10765
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
10827
10766
|
r2Buckets: ["BUCKET"],
|
|
10828
10767
|
r2Persist: bucketDir,
|
|
10829
10768
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -11002,19 +10941,9 @@ async function runBucketList(options = {}) {
|
|
|
11002
10941
|
}
|
|
11003
10942
|
process.exit(1);
|
|
11004
10943
|
}
|
|
11005
|
-
const bundle = await bundleBackend(config, {
|
|
11006
|
-
sourcemap: false,
|
|
11007
|
-
minify: false
|
|
11008
|
-
});
|
|
11009
10944
|
const bucketDir = join34(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
11010
10945
|
const mf = new Miniflare13({
|
|
11011
|
-
modules: [
|
|
11012
|
-
{
|
|
11013
|
-
type: "ESModule",
|
|
11014
|
-
path: "index.mjs",
|
|
11015
|
-
contents: bundle.code
|
|
11016
|
-
}
|
|
11017
|
-
],
|
|
10946
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
11018
10947
|
r2Buckets: ["BUCKET"],
|
|
11019
10948
|
r2Persist: bucketDir,
|
|
11020
10949
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
@@ -11143,29 +11072,18 @@ async function runBucketPut(key, filePath, options = {}) {
|
|
|
11143
11072
|
}
|
|
11144
11073
|
process.exit(1);
|
|
11145
11074
|
}
|
|
11146
|
-
const bundle = await bundleBackend(config, {
|
|
11147
|
-
sourcemap: false,
|
|
11148
|
-
minify: false
|
|
11149
|
-
});
|
|
11150
11075
|
const bucketDir = join35(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
11151
11076
|
const mf = new Miniflare14({
|
|
11152
|
-
modules: [
|
|
11153
|
-
{
|
|
11154
|
-
type: "ESModule",
|
|
11155
|
-
path: "index.mjs",
|
|
11156
|
-
contents: bundle.code
|
|
11157
|
-
}
|
|
11158
|
-
],
|
|
11077
|
+
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
11159
11078
|
r2Buckets: ["BUCKET"],
|
|
11160
11079
|
r2Persist: bucketDir,
|
|
11161
11080
|
compatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE
|
|
11162
11081
|
});
|
|
11163
11082
|
try {
|
|
11164
11083
|
const bucket = await mf.getR2Bucket("BUCKET");
|
|
11165
|
-
|
|
11166
|
-
await bucket.put(key, fileBuffer, {
|
|
11084
|
+
await bucket.put(key, new Uint8Array(fileBuffer).buffer, {
|
|
11167
11085
|
httpMetadata: {
|
|
11168
|
-
contentType
|
|
11086
|
+
contentType: getContentType(filePath)
|
|
11169
11087
|
}
|
|
11170
11088
|
});
|
|
11171
11089
|
if (options.json) {
|
|
@@ -11184,7 +11102,7 @@ async function runBucketPut(key, filePath, options = {}) {
|
|
|
11184
11102
|
logger.success(`Uploaded '${filePath}' to '${key}'`);
|
|
11185
11103
|
logger.newLine();
|
|
11186
11104
|
logger.data("Size", `${fileSize} bytes`, 1);
|
|
11187
|
-
logger.data("Content-Type",
|
|
11105
|
+
logger.data("Content-Type", getContentType(filePath), 1);
|
|
11188
11106
|
logger.newLine();
|
|
11189
11107
|
} finally {
|
|
11190
11108
|
await mf.dispose();
|
package/dist/utils.js
CHANGED
|
@@ -990,6 +990,10 @@ var init_logger = __esm({
|
|
|
990
990
|
const spaces = " ".repeat(indent);
|
|
991
991
|
console.log(`${spaces}${text}`);
|
|
992
992
|
},
|
|
993
|
+
customRaw: (text, indent = 0) => {
|
|
994
|
+
const spaces = " ".repeat(indent);
|
|
995
|
+
console.log(`${spaces}${customTransform(text)}`);
|
|
996
|
+
},
|
|
993
997
|
/**
|
|
994
998
|
* Display a configuration error with helpful suggestions
|
|
995
999
|
*/
|
|
@@ -1723,6 +1727,7 @@ function filePathToRoutePath(filePath) {
|
|
|
1723
1727
|
routePath = routePath.replace(/\/?index$/, "");
|
|
1724
1728
|
}
|
|
1725
1729
|
let urlPath = "/" + routePath.replace(/\\/g, "/");
|
|
1730
|
+
urlPath = urlPath.replace(/\[\.\.\.([^\]]+)\]/g, ":$1{.*}");
|
|
1726
1731
|
urlPath = urlPath.replace(/\[([^\]]+)\]/g, ":$1");
|
|
1727
1732
|
urlPath = urlPath === "/" ? "/api" : `/api${urlPath}`;
|
|
1728
1733
|
return urlPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playcademy",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inquirer/prompts": "^7.8.6",
|
|
43
|
-
"@playcademy/sdk": "0.1.
|
|
43
|
+
"@playcademy/sdk": "0.1.10",
|
|
44
44
|
"better-sqlite3": "^12.4.1",
|
|
45
45
|
"chokidar": "^4.0.3",
|
|
46
46
|
"colorette": "^2.0.20",
|