@sapphire/plugin-api 7.0.1-next.e0e4d74 → 7.0.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [@sapphire/plugin-api@7.0.1](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-api@7.0.0...@sapphire/plugin-api@7.0.1) - (2024-11-05)
6
+
7
+ ## 🏠 Refactor
8
+
9
+ - **route:** Consider `index` as `/` ([3e51fea](https://github.com/sapphiredev/plugins/commit/3e51fea3ba2e0407c3e0ad45f15b148f07ab0836)) ([#656](https://github.com/sapphiredev/plugins/pull/656) by @kyranet)
10
+
5
11
  # [@sapphire/plugin-api@7.0.0](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-api@6.1.1...@sapphire/plugin-api@7.0.0) - (2024-11-02)
6
12
 
7
13
  ## 🏠 Refactor
@@ -19,7 +19,7 @@ var _load_cjs$1 = require('./middlewares/_load.cjs');
19
19
  var _load_cjs$2 = require('./routes/_load.cjs');
20
20
 
21
21
  // src/index.ts
22
- var version = "7.0.1-next.e0e4d74";
22
+ var version = "7.0.1";
23
23
 
24
24
  Object.defineProperty(exports, "loadListeners", {
25
25
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDO,IAAM,OAAkB,GAAA","file":"index.cjs","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MiddlewareStore } from './lib/structures/MiddlewareStore';\nimport type { RouteStore } from './lib/structures/RouteStore';\n\nexport * from './lib/structures/api/ApiRequest';\nexport * from './lib/structures/api/ApiResponse';\nexport * from './lib/structures/api/CookieStore';\nexport * from './lib/structures/http/Auth';\nexport * from './lib/structures/http/HttpCodes';\nexport * from './lib/structures/http/HttpMethods';\nexport * from './lib/structures/http/Server';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/router/RouterBranch';\nexport * from './lib/structures/router/RouterNode';\nexport * from './lib/structures/router/RouterRoot';\nexport * from './lib/structures/RouteStore';\nexport type * from './lib/utils/MimeType';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMiddlewares } from './middlewares/_load';\nexport { loadRoutes } from './routes/_load';\n\ndeclare module 'discord.js' {\n\tinterface Client {\n\t\tserver: Server;\n\t}\n\n\tinterface ClientOptions {\n\t\tapi?: ServerOptions;\n\t}\n}\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\troutes: RouteStore;\n\t\tmiddlewares: MiddlewareStore;\n\t}\n\n\tinterface Container {\n\t\tserver: Server;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-api](https://github.com/sapphiredev/plugins/blob/main/packages/api) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '7.0.1-next.e0e4d74';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDO,IAAM,OAAkB,GAAA","file":"index.cjs","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MiddlewareStore } from './lib/structures/MiddlewareStore';\nimport type { RouteStore } from './lib/structures/RouteStore';\n\nexport * from './lib/structures/api/ApiRequest';\nexport * from './lib/structures/api/ApiResponse';\nexport * from './lib/structures/api/CookieStore';\nexport * from './lib/structures/http/Auth';\nexport * from './lib/structures/http/HttpCodes';\nexport * from './lib/structures/http/HttpMethods';\nexport * from './lib/structures/http/Server';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/router/RouterBranch';\nexport * from './lib/structures/router/RouterNode';\nexport * from './lib/structures/router/RouterRoot';\nexport * from './lib/structures/RouteStore';\nexport type * from './lib/utils/MimeType';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMiddlewares } from './middlewares/_load';\nexport { loadRoutes } from './routes/_load';\n\ndeclare module 'discord.js' {\n\tinterface Client {\n\t\tserver: Server;\n\t}\n\n\tinterface ClientOptions {\n\t\tapi?: ServerOptions;\n\t}\n}\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\troutes: RouteStore;\n\t\tmiddlewares: MiddlewareStore;\n\t}\n\n\tinterface Container {\n\t\tserver: Server;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-api](https://github.com/sapphiredev/plugins/blob/main/packages/api) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '7.0.1';\n"]}
@@ -42,7 +42,9 @@ var _RouterRoot = class _RouterRoot extends RouterBranch_cjs.RouterBranch {
42
42
  if (trimmed.startsWith("(") && trimmed.endsWith(")")) continue;
43
43
  parts.push(trimmed);
44
44
  }
45
- parts.push(name.trim());
45
+ if (name !== "index") {
46
+ parts.push(name.trim());
47
+ }
46
48
  return parts.join("/");
47
49
  }
48
50
  static normalize(path) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/lib/structures/router/RouterRoot.ts"],"names":["RouterBranch","isNullishOrEmpty"],"mappings":";;;;;;;AAMO,IAAM,WAAA,GAAN,MAAM,WAAA,SAAmBA,6BAAa,CAAA;AAAA,EACrC,WAAc,GAAA;AACpB,IAAM,KAAA,CAAA,UAAA,EAAY,OAAO,IAAI,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,IAAI,KAA0B,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,IAAA,CAAK,KA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AAA;AACT;AAGD,IAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,MAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA;AAGhB,IAAO,OAAA,KAAA;AAAA;AACR,EAEA,OAAc,cAAc,IAA4C,EAAA;AACvE,IAAI,IAAA,IAAA,CAAK,MAAW,KAAA,CAAA,EAAU,OAAA,IAAA;AAE9B,IAAM,MAAA,SAAA,GAAY,KAAK,MAAS,GAAA,CAAA;AAChC,IAAM,MAAA,IAAA,GAAO,KAAK,SAAS,CAAA;AAC3B,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,CAAY,GAAG,CAAA;AACxC,IAAA,IAAI,gBAAgB,CAAM,CAAA,IAAA,WAAA,KAAgB,IAAK,CAAA,MAAA,GAAS,GAAU,OAAA,IAAA;AAElE,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,WAAc,GAAA,CAAC,EAAE,WAAY,EAAA;AAAA;AAEjD,CAAA;AApF6C,MAAA,CAAA,WAAA,EAAA,YAAA,CAAA;AAAtC,IAAM,UAAN,GAAA","file":"RouterRoot.cjs","sourcesContent":["import { isNullishOrEmpty } from '@sapphire/utilities';\nimport type { Route } from '../Route';\nimport type { MethodName } from '../http/HttpMethods';\nimport { RouterBranch } from './RouterBranch';\nimport type { RouterNode } from './RouterNode';\n\nexport class RouterRoot extends RouterBranch {\n\tpublic constructor() {\n\t\tsuper('::ROOT::', false, null);\n\t}\n\n\t/**\n\t * Adds a route to the branch\n\t *\n\t * @param route The route to add\n\t * @returns The node the route was added to\n\t */\n\tpublic add(route: Route): RouterNode {\n\t\treturn this._add(route.path, 0, route);\n\t}\n\n\t/**\n\t * Removes a route from the branch\n\t *\n\t * @param route The route to remove\n\t * @returns Whether or not the route was removed\n\t */\n\tpublic remove(route: Route): boolean {\n\t\treturn this._remove(route.path, 0, route);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic override get path(): string {\n\t\treturn '';\n\t}\n\n\tpublic override toString(): string {\n\t\treturn '';\n\t}\n\n\tpublic static makeRoutePathForPiece(directories: readonly string[], name: string): string {\n\t\tconst parts: string[] = [];\n\t\tfor (const directory of directories) {\n\t\t\tconst trimmed = directory.trim();\n\n\t\t\t// If empty, skip:\n\t\t\tif (isNullishOrEmpty(trimmed)) continue;\n\t\t\t// If it's a group, skip:\n\t\t\tif (trimmed.startsWith('(') && trimmed.endsWith(')')) continue;\n\n\t\t\tparts.push(trimmed);\n\t\t}\n\n\t\tparts.push(name.trim());\n\t\treturn parts.join('/');\n\t}\n\n\tpublic static normalize(path: string | null | undefined): string[] {\n\t\tconst parts = [] as string[];\n\t\tif (isNullishOrEmpty(path)) return parts;\n\n\t\tlet part = '';\n\t\tfor (const char of path) {\n\t\t\tif (char === '/') {\n\t\t\t\tif (part.length) {\n\t\t\t\t\tparts.push(part);\n\t\t\t\t\tpart = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpart += char;\n\t\t\t}\n\t\t}\n\n\t\tif (part.length) {\n\t\t\tparts.push(part);\n\t\t}\n\n\t\treturn parts;\n\t}\n\n\tpublic static extractMethod(path: readonly string[]): MethodName | null {\n\t\tif (path.length === 0) return null;\n\n\t\tconst lastIndex = path.length - 1;\n\t\tconst last = path[lastIndex];\n\t\tconst methodIndex = last.lastIndexOf('.');\n\t\tif (methodIndex === -1 || methodIndex === last.length - 1) return null;\n\n\t\treturn last.slice(methodIndex + 1).toUpperCase() as MethodName;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/lib/structures/router/RouterRoot.ts"],"names":["RouterBranch","isNullishOrEmpty"],"mappings":";;;;;;;AAMO,IAAM,WAAA,GAAN,MAAM,WAAA,SAAmBA,6BAAa,CAAA;AAAA,EACrC,WAAc,GAAA;AACpB,IAAM,KAAA,CAAA,UAAA,EAAY,OAAO,IAAI,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,IAAI,KAA0B,EAAA;AACpC,IAAA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UAAO,IAAA,GAAA,EAAA;AAAA;AACR,OACM,MAAA;AACN,QAAQ,IAAA,IAAA,IAAA;AAAA;AACT;AAGD,IAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,MAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA;AAGhB,IAAO,OAAA,KAAA;AAAA;AACR,EAEA,OAAc,cAAc,IAA4C,EAAA;AACvE,IAAI,IAAA,IAAA,CAAK,MAAW,KAAA,CAAA,EAAU,OAAA,IAAA;AAE9B,IAAM,MAAA,SAAA,GAAY,KAAK,MAAS,GAAA,CAAA;AAChC,IAAM,MAAA,IAAA,GAAO,KAAK,SAAS,CAAA;AAC3B,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,CAAY,GAAG,CAAA;AACxC,IAAA,IAAI,gBAAgB,CAAM,CAAA,IAAA,WAAA,KAAgB,IAAK,CAAA,MAAA,GAAS,GAAU,OAAA,IAAA;AAElE,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,WAAc,GAAA,CAAC,EAAE,WAAY,EAAA;AAAA;AAEjD,CAAA;AAvF6C,MAAA,CAAA,WAAA,EAAA,YAAA,CAAA;AAAtC,IAAM,UAAN,GAAA","file":"RouterRoot.cjs","sourcesContent":["import { isNullishOrEmpty } from '@sapphire/utilities';\nimport type { Route } from '../Route';\nimport type { MethodName } from '../http/HttpMethods';\nimport { RouterBranch } from './RouterBranch';\nimport type { RouterNode } from './RouterNode';\n\nexport class RouterRoot extends RouterBranch {\n\tpublic constructor() {\n\t\tsuper('::ROOT::', false, null);\n\t}\n\n\t/**\n\t * Adds a route to the branch\n\t *\n\t * @param route The route to add\n\t * @returns The node the route was added to\n\t */\n\tpublic add(route: Route): RouterNode {\n\t\treturn this._add(route.path, 0, route);\n\t}\n\n\t/**\n\t * Removes a route from the branch\n\t *\n\t * @param route The route to remove\n\t * @returns Whether or not the route was removed\n\t */\n\tpublic remove(route: Route): boolean {\n\t\treturn this._remove(route.path, 0, route);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic override get path(): string {\n\t\treturn '';\n\t}\n\n\tpublic override toString(): string {\n\t\treturn '';\n\t}\n\n\tpublic static makeRoutePathForPiece(directories: readonly string[], name: string): string {\n\t\tconst parts: string[] = [];\n\t\tfor (const directory of directories) {\n\t\t\tconst trimmed = directory.trim();\n\n\t\t\t// If empty, skip:\n\t\t\tif (isNullishOrEmpty(trimmed)) continue;\n\t\t\t// If it's a group, skip:\n\t\t\tif (trimmed.startsWith('(') && trimmed.endsWith(')')) continue;\n\n\t\t\tparts.push(trimmed);\n\t\t}\n\n\t\tif (name !== 'index') {\n\t\t\tparts.push(name.trim());\n\t\t}\n\n\t\treturn parts.join('/');\n\t}\n\n\tpublic static normalize(path: string | null | undefined): string[] {\n\t\tconst parts = [] as string[];\n\t\tif (isNullishOrEmpty(path)) return parts;\n\n\t\tlet part = '';\n\t\tfor (const char of path) {\n\t\t\tif (char === '/') {\n\t\t\t\tif (part.length) {\n\t\t\t\t\tparts.push(part);\n\t\t\t\t\tpart = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpart += char;\n\t\t\t}\n\t\t}\n\n\t\tif (part.length) {\n\t\t\tparts.push(part);\n\t\t}\n\n\t\treturn parts;\n\t}\n\n\tpublic static extractMethod(path: readonly string[]): MethodName | null {\n\t\tif (path.length === 0) return null;\n\n\t\tconst lastIndex = path.length - 1;\n\t\tconst last = path[lastIndex];\n\t\tconst methodIndex = last.lastIndexOf('.');\n\t\tif (methodIndex === -1 || methodIndex === last.length - 1) return null;\n\n\t\treturn last.slice(methodIndex + 1).toUpperCase() as MethodName;\n\t}\n}\n"]}
@@ -17,7 +17,7 @@ export { loadListeners } from './listeners/_load.mjs';
17
17
  export { loadMiddlewares } from './middlewares/_load.mjs';
18
18
  export { loadRoutes } from './routes/_load.mjs';
19
19
 
20
- var version = "7.0.1-next.e0e4d74";
20
+ var version = "7.0.1";
21
21
 
22
22
  export { version };
23
23
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoDO,IAAM,OAAkB,GAAA","file":"index.mjs","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MiddlewareStore } from './lib/structures/MiddlewareStore';\nimport type { RouteStore } from './lib/structures/RouteStore';\n\nexport * from './lib/structures/api/ApiRequest';\nexport * from './lib/structures/api/ApiResponse';\nexport * from './lib/structures/api/CookieStore';\nexport * from './lib/structures/http/Auth';\nexport * from './lib/structures/http/HttpCodes';\nexport * from './lib/structures/http/HttpMethods';\nexport * from './lib/structures/http/Server';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/router/RouterBranch';\nexport * from './lib/structures/router/RouterNode';\nexport * from './lib/structures/router/RouterRoot';\nexport * from './lib/structures/RouteStore';\nexport type * from './lib/utils/MimeType';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMiddlewares } from './middlewares/_load';\nexport { loadRoutes } from './routes/_load';\n\ndeclare module 'discord.js' {\n\tinterface Client {\n\t\tserver: Server;\n\t}\n\n\tinterface ClientOptions {\n\t\tapi?: ServerOptions;\n\t}\n}\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\troutes: RouteStore;\n\t\tmiddlewares: MiddlewareStore;\n\t}\n\n\tinterface Container {\n\t\tserver: Server;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-api](https://github.com/sapphiredev/plugins/blob/main/packages/api) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '7.0.1-next.e0e4d74';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoDO,IAAM,OAAkB,GAAA","file":"index.mjs","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MiddlewareStore } from './lib/structures/MiddlewareStore';\nimport type { RouteStore } from './lib/structures/RouteStore';\n\nexport * from './lib/structures/api/ApiRequest';\nexport * from './lib/structures/api/ApiResponse';\nexport * from './lib/structures/api/CookieStore';\nexport * from './lib/structures/http/Auth';\nexport * from './lib/structures/http/HttpCodes';\nexport * from './lib/structures/http/HttpMethods';\nexport * from './lib/structures/http/Server';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/router/RouterBranch';\nexport * from './lib/structures/router/RouterNode';\nexport * from './lib/structures/router/RouterRoot';\nexport * from './lib/structures/RouteStore';\nexport type * from './lib/utils/MimeType';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMiddlewares } from './middlewares/_load';\nexport { loadRoutes } from './routes/_load';\n\ndeclare module 'discord.js' {\n\tinterface Client {\n\t\tserver: Server;\n\t}\n\n\tinterface ClientOptions {\n\t\tapi?: ServerOptions;\n\t}\n}\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\troutes: RouteStore;\n\t\tmiddlewares: MiddlewareStore;\n\t}\n\n\tinterface Container {\n\t\tserver: Server;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-api](https://github.com/sapphiredev/plugins/blob/main/packages/api) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '7.0.1';\n"]}
@@ -39,7 +39,9 @@ var _RouterRoot = class _RouterRoot extends RouterBranch {
39
39
  if (trimmed.startsWith("(") && trimmed.endsWith(")")) continue;
40
40
  parts.push(trimmed);
41
41
  }
42
- parts.push(name.trim());
42
+ if (name !== "index") {
43
+ parts.push(name.trim());
44
+ }
43
45
  return parts.join("/");
44
46
  }
45
47
  static normalize(path) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/lib/structures/router/RouterRoot.ts"],"names":[],"mappings":";;;;AAMO,IAAM,WAAA,GAAN,MAAM,WAAA,SAAmB,YAAa,CAAA;AAAA,EACrC,WAAc,GAAA;AACpB,IAAM,KAAA,CAAA,UAAA,EAAY,OAAO,IAAI,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,IAAI,KAA0B,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,EAAM,GAAG,KAAK,CAAA;AAAA;AACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,OAAO,KAAuB,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,OAAA,CAAQ,KAAM,CAAA,IAAA,EAAM,GAAG,KAAK,CAAA;AAAA;AACzC;AAAA,EAGA,IAAoB,IAAe,GAAA;AAClC,IAAO,OAAA,EAAA;AAAA;AACR,EAEgB,QAAmB,GAAA;AAClC,IAAO,OAAA,EAAA;AAAA;AACR,EAEA,OAAc,qBAAsB,CAAA,WAAA,EAAgC,IAAsB,EAAA;AACzF,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,KAAA,MAAW,aAAa,WAAa,EAAA;AACpC,MAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAG/B,MAAI,IAAA,gBAAA,CAAiB,OAAO,CAAG,EAAA;AAE/B,MAAA,IAAI,QAAQ,UAAW,CAAA,GAAG,KAAK,OAAQ,CAAA,QAAA,CAAS,GAAG,CAAG,EAAA;AAEtD,MAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAAA;AAGnB,IAAM,KAAA,CAAA,IAAA,CAAK,IAAK,CAAA,IAAA,EAAM,CAAA;AACtB,IAAO,OAAA,KAAA,CAAM,KAAK,GAAG,CAAA;AAAA;AACtB,EAEA,OAAc,UAAU,IAA2C,EAAA;AAClE,IAAA,MAAM,QAAQ,EAAC;AACf,IAAI,IAAA,gBAAA,CAAiB,IAAI,CAAA,EAAU,OAAA,KAAA;AAEnC,IAAA,IAAI,IAAO,GAAA,EAAA;AACX,IAAA,KAAA,MAAW,QAAQ,IAAM,EAAA;AACxB,MAAA,IAAI,SAAS,GAAK,EAAA;AACjB,QAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,UAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AACf,UAAO,IAAA,GAAA,EAAA;AAAA;AACR,OACM,MAAA;AACN,QAAQ,IAAA,IAAA,IAAA;AAAA;AACT;AAGD,IAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,MAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA;AAGhB,IAAO,OAAA,KAAA;AAAA;AACR,EAEA,OAAc,cAAc,IAA4C,EAAA;AACvE,IAAI,IAAA,IAAA,CAAK,MAAW,KAAA,CAAA,EAAU,OAAA,IAAA;AAE9B,IAAM,MAAA,SAAA,GAAY,KAAK,MAAS,GAAA,CAAA;AAChC,IAAM,MAAA,IAAA,GAAO,KAAK,SAAS,CAAA;AAC3B,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,CAAY,GAAG,CAAA;AACxC,IAAA,IAAI,gBAAgB,CAAM,CAAA,IAAA,WAAA,KAAgB,IAAK,CAAA,MAAA,GAAS,GAAU,OAAA,IAAA;AAElE,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,WAAc,GAAA,CAAC,EAAE,WAAY,EAAA;AAAA;AAEjD,CAAA;AApF6C,MAAA,CAAA,WAAA,EAAA,YAAA,CAAA;AAAtC,IAAM,UAAN,GAAA","file":"RouterRoot.mjs","sourcesContent":["import { isNullishOrEmpty } from '@sapphire/utilities';\nimport type { Route } from '../Route';\nimport type { MethodName } from '../http/HttpMethods';\nimport { RouterBranch } from './RouterBranch';\nimport type { RouterNode } from './RouterNode';\n\nexport class RouterRoot extends RouterBranch {\n\tpublic constructor() {\n\t\tsuper('::ROOT::', false, null);\n\t}\n\n\t/**\n\t * Adds a route to the branch\n\t *\n\t * @param route The route to add\n\t * @returns The node the route was added to\n\t */\n\tpublic add(route: Route): RouterNode {\n\t\treturn this._add(route.path, 0, route);\n\t}\n\n\t/**\n\t * Removes a route from the branch\n\t *\n\t * @param route The route to remove\n\t * @returns Whether or not the route was removed\n\t */\n\tpublic remove(route: Route): boolean {\n\t\treturn this._remove(route.path, 0, route);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic override get path(): string {\n\t\treturn '';\n\t}\n\n\tpublic override toString(): string {\n\t\treturn '';\n\t}\n\n\tpublic static makeRoutePathForPiece(directories: readonly string[], name: string): string {\n\t\tconst parts: string[] = [];\n\t\tfor (const directory of directories) {\n\t\t\tconst trimmed = directory.trim();\n\n\t\t\t// If empty, skip:\n\t\t\tif (isNullishOrEmpty(trimmed)) continue;\n\t\t\t// If it's a group, skip:\n\t\t\tif (trimmed.startsWith('(') && trimmed.endsWith(')')) continue;\n\n\t\t\tparts.push(trimmed);\n\t\t}\n\n\t\tparts.push(name.trim());\n\t\treturn parts.join('/');\n\t}\n\n\tpublic static normalize(path: string | null | undefined): string[] {\n\t\tconst parts = [] as string[];\n\t\tif (isNullishOrEmpty(path)) return parts;\n\n\t\tlet part = '';\n\t\tfor (const char of path) {\n\t\t\tif (char === '/') {\n\t\t\t\tif (part.length) {\n\t\t\t\t\tparts.push(part);\n\t\t\t\t\tpart = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpart += char;\n\t\t\t}\n\t\t}\n\n\t\tif (part.length) {\n\t\t\tparts.push(part);\n\t\t}\n\n\t\treturn parts;\n\t}\n\n\tpublic static extractMethod(path: readonly string[]): MethodName | null {\n\t\tif (path.length === 0) return null;\n\n\t\tconst lastIndex = path.length - 1;\n\t\tconst last = path[lastIndex];\n\t\tconst methodIndex = last.lastIndexOf('.');\n\t\tif (methodIndex === -1 || methodIndex === last.length - 1) return null;\n\n\t\treturn last.slice(methodIndex + 1).toUpperCase() as MethodName;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/lib/structures/router/RouterRoot.ts"],"names":[],"mappings":";;;;AAMO,IAAM,WAAA,GAAN,MAAM,WAAA,SAAmB,YAAa,CAAA;AAAA,EACrC,WAAc,GAAA;AACpB,IAAM,KAAA,CAAA,UAAA,EAAY,OAAO,IAAI,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,IAAI,KAA0B,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,EAAM,GAAG,KAAK,CAAA;AAAA;AACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,OAAO,KAAuB,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,OAAA,CAAQ,KAAM,CAAA,IAAA,EAAM,GAAG,KAAK,CAAA;AAAA;AACzC;AAAA,EAGA,IAAoB,IAAe,GAAA;AAClC,IAAO,OAAA,EAAA;AAAA;AACR,EAEgB,QAAmB,GAAA;AAClC,IAAO,OAAA,EAAA;AAAA;AACR,EAEA,OAAc,qBAAsB,CAAA,WAAA,EAAgC,IAAsB,EAAA;AACzF,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,KAAA,MAAW,aAAa,WAAa,EAAA;AACpC,MAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAG/B,MAAI,IAAA,gBAAA,CAAiB,OAAO,CAAG,EAAA;AAE/B,MAAA,IAAI,QAAQ,UAAW,CAAA,GAAG,KAAK,OAAQ,CAAA,QAAA,CAAS,GAAG,CAAG,EAAA;AAEtD,MAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAAA;AAGnB,IAAA,IAAI,SAAS,OAAS,EAAA;AACrB,MAAM,KAAA,CAAA,IAAA,CAAK,IAAK,CAAA,IAAA,EAAM,CAAA;AAAA;AAGvB,IAAO,OAAA,KAAA,CAAM,KAAK,GAAG,CAAA;AAAA;AACtB,EAEA,OAAc,UAAU,IAA2C,EAAA;AAClE,IAAA,MAAM,QAAQ,EAAC;AACf,IAAI,IAAA,gBAAA,CAAiB,IAAI,CAAA,EAAU,OAAA,KAAA;AAEnC,IAAA,IAAI,IAAO,GAAA,EAAA;AACX,IAAA,KAAA,MAAW,QAAQ,IAAM,EAAA;AACxB,MAAA,IAAI,SAAS,GAAK,EAAA;AACjB,QAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,UAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AACf,UAAO,IAAA,GAAA,EAAA;AAAA;AACR,OACM,MAAA;AACN,QAAQ,IAAA,IAAA,IAAA;AAAA;AACT;AAGD,IAAA,IAAI,KAAK,MAAQ,EAAA;AAChB,MAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA;AAGhB,IAAO,OAAA,KAAA;AAAA;AACR,EAEA,OAAc,cAAc,IAA4C,EAAA;AACvE,IAAI,IAAA,IAAA,CAAK,MAAW,KAAA,CAAA,EAAU,OAAA,IAAA;AAE9B,IAAM,MAAA,SAAA,GAAY,KAAK,MAAS,GAAA,CAAA;AAChC,IAAM,MAAA,IAAA,GAAO,KAAK,SAAS,CAAA;AAC3B,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,CAAY,GAAG,CAAA;AACxC,IAAA,IAAI,gBAAgB,CAAM,CAAA,IAAA,WAAA,KAAgB,IAAK,CAAA,MAAA,GAAS,GAAU,OAAA,IAAA;AAElE,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,WAAc,GAAA,CAAC,EAAE,WAAY,EAAA;AAAA;AAEjD,CAAA;AAvF6C,MAAA,CAAA,WAAA,EAAA,YAAA,CAAA;AAAtC,IAAM,UAAN,GAAA","file":"RouterRoot.mjs","sourcesContent":["import { isNullishOrEmpty } from '@sapphire/utilities';\nimport type { Route } from '../Route';\nimport type { MethodName } from '../http/HttpMethods';\nimport { RouterBranch } from './RouterBranch';\nimport type { RouterNode } from './RouterNode';\n\nexport class RouterRoot extends RouterBranch {\n\tpublic constructor() {\n\t\tsuper('::ROOT::', false, null);\n\t}\n\n\t/**\n\t * Adds a route to the branch\n\t *\n\t * @param route The route to add\n\t * @returns The node the route was added to\n\t */\n\tpublic add(route: Route): RouterNode {\n\t\treturn this._add(route.path, 0, route);\n\t}\n\n\t/**\n\t * Removes a route from the branch\n\t *\n\t * @param route The route to remove\n\t * @returns Whether or not the route was removed\n\t */\n\tpublic remove(route: Route): boolean {\n\t\treturn this._remove(route.path, 0, route);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic override get path(): string {\n\t\treturn '';\n\t}\n\n\tpublic override toString(): string {\n\t\treturn '';\n\t}\n\n\tpublic static makeRoutePathForPiece(directories: readonly string[], name: string): string {\n\t\tconst parts: string[] = [];\n\t\tfor (const directory of directories) {\n\t\t\tconst trimmed = directory.trim();\n\n\t\t\t// If empty, skip:\n\t\t\tif (isNullishOrEmpty(trimmed)) continue;\n\t\t\t// If it's a group, skip:\n\t\t\tif (trimmed.startsWith('(') && trimmed.endsWith(')')) continue;\n\n\t\t\tparts.push(trimmed);\n\t\t}\n\n\t\tif (name !== 'index') {\n\t\t\tparts.push(name.trim());\n\t\t}\n\n\t\treturn parts.join('/');\n\t}\n\n\tpublic static normalize(path: string | null | undefined): string[] {\n\t\tconst parts = [] as string[];\n\t\tif (isNullishOrEmpty(path)) return parts;\n\n\t\tlet part = '';\n\t\tfor (const char of path) {\n\t\t\tif (char === '/') {\n\t\t\t\tif (part.length) {\n\t\t\t\t\tparts.push(part);\n\t\t\t\t\tpart = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpart += char;\n\t\t\t}\n\t\t}\n\n\t\tif (part.length) {\n\t\t\tparts.push(part);\n\t\t}\n\n\t\treturn parts;\n\t}\n\n\tpublic static extractMethod(path: readonly string[]): MethodName | null {\n\t\tif (path.length === 0) return null;\n\n\t\tconst lastIndex = path.length - 1;\n\t\tconst last = path[lastIndex];\n\t\tconst methodIndex = last.lastIndexOf('.');\n\t\tif (methodIndex === -1 || methodIndex === last.length - 1) return null;\n\n\t\treturn last.slice(methodIndex + 1).toUpperCase() as MethodName;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/plugin-api",
3
- "version": "7.0.1-next.e0e4d74",
3
+ "version": "7.0.1",
4
4
  "description": "Plugin for @sapphire/framework to expose a REST API",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "build:rename-cjs-register": "tsx ../../scripts/rename-cjs-register.mts",
46
46
  "sync-mime-types": "tsx scripts/sync-mime-types.mts",
47
47
  "typecheck": "tsc -b src",
48
- "docs": "echo \"temporarily disabled\" || typedoc-json-parser",
48
+ "docs": "typedoc-json-parser",
49
49
  "prepack": "yarn build",
50
50
  "bump": "cliff-jumper",
51
51
  "check-update": "cliff-jumper --dry-run"