playcademy 0.14.16 → 0.14.17

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 CHANGED
@@ -6091,6 +6091,7 @@ init_core();
6091
6091
  import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
6092
6092
  import { tmpdir as tmpdir2 } from "os";
6093
6093
  import { join as join14, relative as relative2 } from "path";
6094
+ import { pathToFileURL as pathToFileURL2 } from "url";
6094
6095
 
6095
6096
  // src/lib/deploy/hash.ts
6096
6097
  init_file_loader();
@@ -6154,7 +6155,8 @@ async function discoverRoutes(apiDir) {
6154
6155
  async function detectExportedMethods(filePath) {
6155
6156
  try {
6156
6157
  const importPath = await transpileRoute(filePath);
6157
- const module = await import(importPath);
6158
+ const specifier = pathToFileURL2(importPath).href;
6159
+ const module = await import(specifier);
6158
6160
  const methods = [];
6159
6161
  if (module.GET) methods.push("GET");
6160
6162
  if (module.POST) methods.push("POST");
@@ -6210,7 +6212,8 @@ async function registerCustomRoutes(app, routes) {
6210
6212
  for (const route of routes) {
6211
6213
  try {
6212
6214
  const importPath = await transpileRoute(route.absolutePath);
6213
- const handler = await import(`${importPath}?t=${Date.now()}`);
6215
+ const specifier = `${pathToFileURL2(importPath).href}?t=${Date.now()}`;
6216
+ const handler = await import(specifier);
6214
6217
  if (handler.GET) app.get(route.path, handler.GET);
6215
6218
  if (handler.POST) app.post(route.path, handler.POST);
6216
6219
  if (handler.PUT) app.put(route.path, handler.PUT);
@@ -6368,15 +6371,20 @@ async function bundleBackend(config, options = {}) {
6368
6371
  customRoutes: customRouteData
6369
6372
  };
6370
6373
  }
6374
+ function buildCustomRouteImportStatements(customRoutes, customRoutesDir) {
6375
+ const normalizedRoutesDir = customRoutesDir.replace(/\\/g, "/").replace(/\/+/g, "/");
6376
+ const customRoutesPrefix = normalizedRoutesDir.endsWith("/") ? normalizedRoutesDir : `${normalizedRoutesDir}/`;
6377
+ return customRoutes.map((route, i) => {
6378
+ const normalizedFile = route.file.replace(/\\/g, "/").replace(/\/+/g, "/");
6379
+ const importPath = normalizedFile.startsWith(customRoutesPrefix) ? normalizedFile.slice(customRoutesPrefix.length) : normalizedFile;
6380
+ return `import * as customRoute${i} from '@game-api/${importPath}'`;
6381
+ }).join("\n");
6382
+ }
6371
6383
  function generateEntryCode(customRoutes, customRoutesDir, hasAuth) {
6372
6384
  if (customRoutes.length === 0) {
6373
6385
  return entryTemplate;
6374
6386
  }
6375
- const customRoutesPrefix = customRoutesDir.endsWith("/") ? customRoutesDir : `${customRoutesDir}/`;
6376
- const importStatements = customRoutes.map((route, i) => {
6377
- const importPath = route.file.startsWith(customRoutesPrefix) ? route.file.slice(customRoutesPrefix.length) : route.file;
6378
- return `import * as customRoute${i} from '@game-api/${importPath}'`;
6379
- }).join("\n");
6387
+ const importStatements = buildCustomRouteImportStatements(customRoutes, customRoutesDir);
6380
6388
  const withImports = entryTemplate.replace(
6381
6389
  "// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTE_IMPORTS \u26A0\uFE0F",
6382
6390
  importStatements
@@ -7222,7 +7230,7 @@ import { join as join18 } from "path";
7222
7230
  // package.json
7223
7231
  var package_default2 = {
7224
7232
  name: "playcademy",
7225
- version: "0.14.15",
7233
+ version: "0.14.16",
7226
7234
  type: "module",
7227
7235
  exports: {
7228
7236
  ".": {
@@ -15050,6 +15058,7 @@ export {
15050
15058
  addEmailProvider,
15051
15059
  addOAuthProvider,
15052
15060
  analyzeChanges,
15061
+ buildCustomRouteImportStatements,
15053
15062
  bundleBackend,
15054
15063
  bundleSeedWorker,
15055
15064
  calculateConfigDiff,
package/dist/utils.js CHANGED
@@ -3580,6 +3580,7 @@ init_file_loader();
3580
3580
  import { mkdir, writeFile } from "fs/promises";
3581
3581
  import { tmpdir as tmpdir2 } from "os";
3582
3582
  import { join as join9, relative } from "path";
3583
+ import { pathToFileURL as pathToFileURL2 } from "url";
3583
3584
 
3584
3585
  // src/lib/deploy/hash.ts
3585
3586
  import { createHash } from "crypto";
@@ -3614,7 +3615,8 @@ async function discoverRoutes(apiDir) {
3614
3615
  async function detectExportedMethods(filePath) {
3615
3616
  try {
3616
3617
  const importPath = await transpileRoute(filePath);
3617
- const module = await import(importPath);
3618
+ const specifier = pathToFileURL2(importPath).href;
3619
+ const module = await import(specifier);
3618
3620
  const methods = [];
3619
3621
  if (module.GET) methods.push("GET");
3620
3622
  if (module.POST) methods.push("POST");
@@ -3811,15 +3813,20 @@ async function bundleBackend(config, options = {}) {
3811
3813
  customRoutes: customRouteData
3812
3814
  };
3813
3815
  }
3816
+ function buildCustomRouteImportStatements(customRoutes, customRoutesDir) {
3817
+ const normalizedRoutesDir = customRoutesDir.replace(/\\/g, "/").replace(/\/+/g, "/");
3818
+ const customRoutesPrefix = normalizedRoutesDir.endsWith("/") ? normalizedRoutesDir : `${normalizedRoutesDir}/`;
3819
+ return customRoutes.map((route, i) => {
3820
+ const normalizedFile = route.file.replace(/\\/g, "/").replace(/\/+/g, "/");
3821
+ const importPath = normalizedFile.startsWith(customRoutesPrefix) ? normalizedFile.slice(customRoutesPrefix.length) : normalizedFile;
3822
+ return `import * as customRoute${i} from '@game-api/${importPath}'`;
3823
+ }).join("\n");
3824
+ }
3814
3825
  function generateEntryCode(customRoutes, customRoutesDir, hasAuth) {
3815
3826
  if (customRoutes.length === 0) {
3816
3827
  return entryTemplate;
3817
3828
  }
3818
- const customRoutesPrefix = customRoutesDir.endsWith("/") ? customRoutesDir : `${customRoutesDir}/`;
3819
- const importStatements = customRoutes.map((route, i) => {
3820
- const importPath = route.file.startsWith(customRoutesPrefix) ? route.file.slice(customRoutesPrefix.length) : route.file;
3821
- return `import * as customRoute${i} from '@game-api/${importPath}'`;
3822
- }).join("\n");
3829
+ const importStatements = buildCustomRouteImportStatements(customRoutes, customRoutesDir);
3823
3830
  const withImports = entryTemplate.replace(
3824
3831
  "// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTE_IMPORTS \u26A0\uFE0F",
3825
3832
  importStatements
@@ -3863,7 +3870,7 @@ import { join as join11 } from "path";
3863
3870
  // package.json
3864
3871
  var package_default2 = {
3865
3872
  name: "playcademy",
3866
- version: "0.14.15",
3873
+ version: "0.14.16",
3867
3874
  type: "module",
3868
3875
  exports: {
3869
3876
  ".": {
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "playcademy",
4
- version: "0.14.15",
4
+ version: "0.14.16",
5
5
  type: "module",
6
6
  exports: {
7
7
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.14.16",
3
+ "version": "0.14.17",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {