playcademy 0.13.20 → 0.13.21

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 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
- path: route.path,
8004
- method: route.methods?.join(", ") || "*"
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 maxPathLength = Math.max(...allRoutes.map((r) => r.path.length));
8008
- const displayRoute = (route) => {
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.raw(`<${paddedPath}> ${dim5(route.method)}`, 1);
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(`http://localhost:${port}/api`)}`);
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);
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.20",
3
+ "version": "0.13.21",
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.8",
43
+ "@playcademy/sdk": "0.1.9",
44
44
  "better-sqlite3": "^12.4.1",
45
45
  "chokidar": "^4.0.3",
46
46
  "colorette": "^2.0.20",