@sapphire/plugin-api 6.0.0-pr-513.f0e9a18.0 → 6.0.0
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 +18 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/cjs/register.cjs.map +1 -1
- package/dist/cjs/register.d.ts +0 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/register.d.mts +0 -1
- package/dist/esm/register.mjs +1 -1
- package/dist/esm/register.mjs.map +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
# [@sapphire/plugin-api@6.0.0](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-api@6.0.0...@sapphire/plugin-api@6.0.0) - (2023-12-05)
|
|
6
|
+
|
|
7
|
+
## 🏠 Refactor
|
|
8
|
+
|
|
9
|
+
- **register:** Cleanup unnecessary side effect imports of index ([dede596](https://github.com/sapphiredev/plugins/commit/dede596ae22ceec2700dd860287a1260f092b502))
|
|
10
|
+
|
|
11
|
+
## 🐛 Bug Fixes
|
|
12
|
+
|
|
13
|
+
- **api:** Expose `load*` methods on the `index` level in case register isn't used ([3fcd9a2](https://github.com/sapphiredev/plugins/commit/3fcd9a29b5007e364ff358c2c3f8fbeabea6c575))
|
|
14
|
+
- Update transitive dependencies ([9fd4cfa](https://github.com/sapphiredev/plugins/commit/9fd4cfae031b20044aad8ae1051ade3dd29c69dd))
|
|
15
|
+
|
|
16
|
+
## 🚀 Features
|
|
17
|
+
|
|
18
|
+
- Split ESM and CJS bundles for proper ESM and CJS loading (#512) ([d9aa006](https://github.com/sapphiredev/plugins/commit/d9aa006ff8c7f78a613dcca605d3353b992b7a46))
|
|
19
|
+
- 💥 **BREAKING CHANGE:** This ensures that the plugins will properly load the
|
|
20
|
+
either only ESM or only CJS files. This is done by outputting
|
|
21
|
+
dist/cjs and dist/esm folders. This requires @sapphire/framework v5.x!
|
|
22
|
+
|
|
5
23
|
# [@sapphire/plugin-api@5.2.0](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-api@5.2.0...@sapphire/plugin-api@5.2.0) - (2023-11-16)
|
|
6
24
|
|
|
7
25
|
## 🏠 Refactor
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ var _load_cjs$2 = require('./middlewares/_load.cjs');
|
|
|
21
21
|
var _load_cjs$3 = require('./routes/_load.cjs');
|
|
22
22
|
|
|
23
23
|
// src/index.ts
|
|
24
|
-
var version = "6.0.0
|
|
24
|
+
var version = "6.0.0";
|
|
25
25
|
|
|
26
26
|
Object.defineProperty(exports, 'loadListeners', {
|
|
27
27
|
enumerable: true,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AA+BpB,IAAM,UAAkB","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MediaParserStore } from './lib/structures/MediaParserStore';\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/MediaParser';\nexport * from './lib/structures/MediaParserStore';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/RouteStore';\nexport * from './lib/utils/MimeTypes';\nexport * from './lib/utils/RouteData';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMediaParsers } from './mediaParsers/_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\tmediaParsers: MediaParserStore;\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 = '6.0.0
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AA+BpB,IAAM,UAAkB","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MediaParserStore } from './lib/structures/MediaParserStore';\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/MediaParser';\nexport * from './lib/structures/MediaParserStore';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/RouteStore';\nexport * from './lib/utils/MimeTypes';\nexport * from './lib/utils/RouteData';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMediaParsers } from './mediaParsers/_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\tmediaParsers: MediaParserStore;\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 = '6.0.0';\n"]}
|
package/dist/cjs/register.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index_cjs = require('./index.cjs');
|
|
4
3
|
var framework = require('@sapphire/framework');
|
|
4
|
+
var index_cjs = require('./index.cjs');
|
|
5
5
|
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AAAA,SAAS,QAAQ,oBAAoB,UAAU,sBAAsB;AAErE,SAAS,eAAe,kBAAkB,iBAAiB,YAAY,cAAc;AAK9E,IAAM,OAAN,MAAM,aAAY,OAAO;AAAA;AAAA;AAAA;AAAA,EAI/B,QAAe,kBAAkB,EAAwB,SAA8B;AACtF,SAAK,SAAS,IAAI,OAAO,QAAQ,GAAG;AACpC,SAAK,OACH,SAAS,KAAK,OAAO,MAAM,EAC3B,SAAS,KAAK,OAAO,YAAY,EACjC,SAAS,KAAK,OAAO,WAAW;AAElC,kBAAc;AACd,qBAAiB;AACjB,oBAAgB;AAChB,eAAW;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA,EAKA,cAAqB,QAAQ,IAAuC;AACnE,QAAI,EAAE,KAAK,OAAO,QAAQ,wBAAwB,OAAO;AACxD;AAAA,IACD;AAEA,UAAM,KAAK,OAAO,QAAQ;AAAA,EAC3B;AACD;AA3BgC;AAAzB,IAAM,MAAN;AA6BP,eAAe,QAAQ,+BAA+B,IAAI,kBAAkB,GAAG,wBAAwB;AACvG,eAAe,QAAQ,qBAAqB,IAAI,QAAQ,GAAG,cAAc","sourcesContent":["import { Plugin, postInitialization, preLogin, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, loadMediaParsers, loadMiddlewares, loadRoutes, Server } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class Api extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tthis.server = new Server(options.api);\n\t\tthis.stores\n\t\t\t.register(this.server.routes) //\n\t\t\t.register(this.server.mediaParsers)\n\t\t\t.register(this.server.middlewares);\n\n\t\tloadListeners();\n\t\tloadMediaParsers();\n\t\tloadMiddlewares();\n\t\tloadRoutes();\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static async [preLogin](this: SapphireClient): Promise<void> {\n\t\tif (!(this.server.options.automaticallyConnect ?? true)) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.server.connect();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(Api[postInitialization], 'API-PostInitialization');\nSapphireClient.plugins.registerPreLoginHook(Api[preLogin], 'API-PreLogin');\n"]}
|
package/dist/cjs/register.d.ts
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ export { loadMediaParsers } from './mediaParsers/_load.mjs';
|
|
|
19
19
|
export { loadMiddlewares } from './middlewares/_load.mjs';
|
|
20
20
|
export { loadRoutes } from './routes/_load.mjs';
|
|
21
21
|
|
|
22
|
-
var version = "6.0.0
|
|
22
|
+
var version = "6.0.0";
|
|
23
23
|
|
|
24
24
|
export { version };
|
|
25
25
|
//# sourceMappingURL=out.js.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AA+BpB,IAAM,UAAkB","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MediaParserStore } from './lib/structures/MediaParserStore';\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/MediaParser';\nexport * from './lib/structures/MediaParserStore';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/RouteStore';\nexport * from './lib/utils/MimeTypes';\nexport * from './lib/utils/RouteData';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMediaParsers } from './mediaParsers/_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\tmediaParsers: MediaParserStore;\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 = '6.0.0
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AA+BpB,IAAM,UAAkB","sourcesContent":["import type { Server, ServerOptions } from './lib/structures/http/Server';\nimport type { MediaParserStore } from './lib/structures/MediaParserStore';\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/MediaParser';\nexport * from './lib/structures/MediaParserStore';\nexport * from './lib/structures/Middleware';\nexport * from './lib/structures/MiddlewareStore';\nexport * from './lib/structures/Route';\nexport * from './lib/structures/RouteStore';\nexport * from './lib/utils/MimeTypes';\nexport * from './lib/utils/RouteData';\n\nexport { loadListeners } from './listeners/_load';\nexport { loadMediaParsers } from './mediaParsers/_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\tmediaParsers: MediaParserStore;\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 = '6.0.0';\n"]}
|
package/dist/esm/register.d.mts
CHANGED
package/dist/esm/register.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __name } from './chunk-PYETHG4R.mjs';
|
|
2
|
-
import { Server, loadListeners, loadMediaParsers, loadMiddlewares, loadRoutes } from './index.mjs';
|
|
3
2
|
import { SapphireClient, postInitialization, preLogin, Plugin } from '@sapphire/framework';
|
|
3
|
+
import { Server, loadListeners, loadMediaParsers, loadMiddlewares, loadRoutes } from './index.mjs';
|
|
4
4
|
|
|
5
5
|
var _Api = class _Api extends Plugin {
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,QAAQ,oBAAoB,UAAU,sBAAsB;AAErE,SAAS,eAAe,kBAAkB,iBAAiB,YAAY,cAAc;AAK9E,IAAM,OAAN,MAAM,aAAY,OAAO;AAAA;AAAA;AAAA;AAAA,EAI/B,QAAe,kBAAkB,EAAwB,SAA8B;AACtF,SAAK,SAAS,IAAI,OAAO,QAAQ,GAAG;AACpC,SAAK,OACH,SAAS,KAAK,OAAO,MAAM,EAC3B,SAAS,KAAK,OAAO,YAAY,EACjC,SAAS,KAAK,OAAO,WAAW;AAElC,kBAAc;AACd,qBAAiB;AACjB,oBAAgB;AAChB,eAAW;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA,EAKA,cAAqB,QAAQ,IAAuC;AACnE,QAAI,EAAE,KAAK,OAAO,QAAQ,wBAAwB,OAAO;AACxD;AAAA,IACD;AAEA,UAAM,KAAK,OAAO,QAAQ;AAAA,EAC3B;AACD;AA3BgC;AAAzB,IAAM,MAAN;AA6BP,eAAe,QAAQ,+BAA+B,IAAI,kBAAkB,GAAG,wBAAwB;AACvG,eAAe,QAAQ,qBAAqB,IAAI,QAAQ,GAAG,cAAc","sourcesContent":["import { Plugin, postInitialization, preLogin, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, loadMediaParsers, loadMiddlewares, loadRoutes, Server } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class Api extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tthis.server = new Server(options.api);\n\t\tthis.stores\n\t\t\t.register(this.server.routes) //\n\t\t\t.register(this.server.mediaParsers)\n\t\t\t.register(this.server.middlewares);\n\n\t\tloadListeners();\n\t\tloadMediaParsers();\n\t\tloadMiddlewares();\n\t\tloadRoutes();\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static async [preLogin](this: SapphireClient): Promise<void> {\n\t\tif (!(this.server.options.automaticallyConnect ?? true)) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.server.connect();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(Api[postInitialization], 'API-PostInitialization');\nSapphireClient.plugins.registerPreLoginHook(Api[preLogin], 'API-PreLogin');\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-api",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Plugin for @sapphire/framework to expose a REST API",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,8 +60,7 @@
|
|
|
60
60
|
"directory": "packages/api"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
|
63
|
-
"dist/"
|
|
64
|
-
"!dist/.tsbuildinfo"
|
|
63
|
+
"dist/"
|
|
65
64
|
],
|
|
66
65
|
"engines": {
|
|
67
66
|
"node": ">=v18",
|
|
@@ -85,7 +84,7 @@
|
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
86
|
"@favware/cliff-jumper": "^2.2.3",
|
|
88
|
-
"@favware/rollup-type-bundler": "^3.2.
|
|
87
|
+
"@favware/rollup-type-bundler": "^3.2.1",
|
|
89
88
|
"concurrently": "^8.2.2",
|
|
90
89
|
"tsup": "^8.0.1",
|
|
91
90
|
"tsx": "^4.6.2",
|