meocord 4.0.0-beta.5 → 4.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 CHANGED
@@ -1,5 +1,116 @@
1
1
  # meocord
2
2
 
3
+ ## 4.0.0
4
+
5
+ MeoCord 4 builds with Rsbuild instead of webpack, requires Node.js 22.13 and dotenv 18, and can
6
+ deploy a bot without `node_modules`. Most bots need two changes; see the
7
+ [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md).
8
+
9
+ ### Major Changes
10
+
11
+ - [#22](https://github.com/l7aromeo/meocord/pull/22) [`4deb96f`](https://github.com/l7aromeo/meocord/commit/4deb96fd73f86a29c46b9bb080c13e6267246cb1) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Build with [Rsbuild](https://rsbuild.rs) instead of webpack. Production builds are several times
12
+ faster, and webpack and its four loader and plugin packages are no longer installed with MeoCord.
13
+ The output layout is unchanged: `dist/main.js`, and assets under `dist/assets/` with the same names.
14
+ Production source maps now list sources as `../src/...` paths instead of `webpack://` URLs.
15
+
16
+ **Breaking:** the `webpack` hook in `meocord.config.ts` is replaced by `rsbuild`, which receives
17
+ Rsbuild's configuration. A config that still declares `webpack` stops the build with a message
18
+ saying so. `MeoCordWebpackConfig` is removed; import `RsbuildConfig` from `meocord/interface`
19
+ instead. The [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md#2-replace-the-webpack-hook-with-rsbuild) shows where each
20
+ webpack setting goes.
21
+
22
+ - [#44](https://github.com/l7aromeo/meocord/pull/44) [`e48472e`](https://github.com/l7aromeo/meocord/commit/e48472e9ffee2f0371a7a2a71a4063e99ce61674) Thanks [@l7aromeo](https://github.com/l7aromeo)! - **Breaking:** `meocord/decorator` exports only the decorators. The routing helpers it also exported
23
+ — `getCommandMap`, `getMessageHandlers`, `getReactionHandlers`, `getAutocompleteHandlers`,
24
+ `findAmbiguousRoutes` and `PARAM_SEPARATOR` — are internal to MeoCord now. See the
25
+ [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md#internal-helpers-are-no-longer-exported).
26
+
27
+ - [#19](https://github.com/l7aromeo/meocord/pull/19) [`204c7be`](https://github.com/l7aromeo/meocord/commit/204c7bec74886c931732cb771d9178b47fbec5e8) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Require dotenv 18. The `dotenv` peer dependency moves from `^17.4.2` to `^18.0.3`, so install
28
+ `dotenv@18` alongside MeoCord 4. No application code changes — `import 'dotenv/config'` behaves
29
+ the same. See the [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md#1-upgrade-dotenv-to-18).
30
+
31
+ - [#33](https://github.com/l7aromeo/meocord/pull/33) [`21b06ae`](https://github.com/l7aromeo/meocord/commit/21b06ae6810cfe203abadcadc6f7b7247c7b305b) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Require Node.js 22.13 or newer, up from 22.0. A built bot loads its compiled config with `require()`
32
+ of an ES module. Node 22.12 runs that without a flag but still warns on every start and crashes on a
33
+ config that throws; 22.13 is the first 22 release that does neither. Bun is unaffected. See the
34
+ [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md#before-you-start-nodejs-2213).
35
+
36
+ - [#36](https://github.com/l7aromeo/meocord/pull/36) [`45e564e`](https://github.com/l7aromeo/meocord/commit/45e564e6baff17313037372ec56baa1711a3584c) Thanks [@l7aromeo](https://github.com/l7aromeo)! - **Breaking:** `app.start()` rejects when the login fails. It logged the error and resolved, so a bot
37
+ with an invalid token went on to log "Application started" and exit with code 0, which Docker's
38
+ `restart: on-failure`, systemd and CI all read as success. It now sets the exit code to 1 before
39
+ rejecting, so a bot that fails to log in exits 1 with its entry point unchanged. See the
40
+ [migration guide](https://github.com/l7aromeo/meocord/blob/main/docs/MIGRATING.md#4-build-and-start).
41
+
42
+ ### Minor Changes
43
+
44
+ - [#22](https://github.com/l7aromeo/meocord/pull/22) [`4deb96f`](https://github.com/l7aromeo/meocord/commit/4deb96fd73f86a29c46b9bb080c13e6267246cb1) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Add `bundleDependencies`, which puts everything a bot needs inside `dist`, so it deploys without
45
+ `node_modules` or an install step. Plain JavaScript dependencies are bundled into `main.js`. Native
46
+ addons such as `sharp` are found while building and copied, with their platform binary, into
47
+ `dist/node_modules` — nothing has to be listed. Only binaries for the platform building are copied,
48
+ whichever package manager installed them.
49
+
50
+ A build carrying native addons records its platform in `dist/meocord.platform.json`, and a bot
51
+ started on another platform stops before going online with a message naming both. Build on the
52
+ platform you deploy to. See
53
+ [Self-contained builds](https://github.com/l7aromeo/meocord#self-contained-builds).
54
+
55
+ - [#47](https://github.com/l7aromeo/meocord/pull/47) [`9652436`](https://github.com/l7aromeo/meocord/commit/965243660323277827a64851f28da9cda2c2fe0c) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Add `resolveRoute` and `findRouteConflicts` to `meocord/testing`, for testing which handler a
56
+ component's customId reaches. `resolveRoute(App, { type, customId })` gives the answer dispatch
57
+ gives — across every controller the app registers, for that component type, most specific pattern
58
+ first — as the controller, the handler method and its name, and the captured params, or `undefined`.
59
+ `findRouteConflicts(App)` returns the pattern pairs that can match the same customId, which MeoCord
60
+ otherwise only warns about at startup. Both read decorator metadata only, and dispatch runs on the
61
+ same matcher.
62
+
63
+ ### Patch Changes
64
+
65
+ - [#22](https://github.com/l7aromeo/meocord/pull/22) [`4deb96f`](https://github.com/l7aromeo/meocord/commit/4deb96fd73f86a29c46b9bb080c13e6267246cb1) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Read `meocord.config.ts` on every build. `meocord build` read the compiled `dist/meocord.config.mjs`
66
+ left by the previous build, so a config edit took effect one build late, and the watcher's reload
67
+ on a config change reloaded nothing.
68
+
69
+ - [#22](https://github.com/l7aromeo/meocord/pull/22) [`4deb96f`](https://github.com/l7aromeo/meocord/commit/4deb96fd73f86a29c46b9bb080c13e6267246cb1) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Start the bot with `bun --no-install` from `meocord start`. Without it, bun downloads any package it
70
+ cannot find while the bot runs, which a bot deployed without `node_modules` would do in
71
+ production. If you start `dist/main.js` with bun yourself, pass the flag too.
72
+
73
+ - [#37](https://github.com/l7aromeo/meocord/pull/37) [`a9452c2`](https://github.com/l7aromeo/meocord/commit/a9452c256beace70141bb87ed33c693d14064d14) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Type the CommonJS build as CommonJS. Every entry point's `require` condition resolved to the ESM
74
+ declarations, so a CommonJS TypeScript project was told `meocord/core` is an ES module it cannot
75
+ `require`, even with `skipLibCheck`. Each entry now ships `.d.cts` declarations for `require`, and
76
+ `meocord/eslint` types its `module.exports` array as what `require` returns.
77
+
78
+ - [#33](https://github.com/l7aromeo/meocord/pull/33) [`21b06ae`](https://github.com/l7aromeo/meocord/commit/21b06ae6810cfe203abadcadc6f7b7247c7b305b) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Load the compiled config without a transpiler. A built bot reads `dist/meocord.config.mjs` with
79
+ `require()` and no longer falls back to `meocord.config.ts` when it is missing, so jiti stays out of
80
+ a bot bundled with `bundleDependencies`. `meocord build` fails when the config does not compile,
81
+ instead of warning and producing a bot that cannot start.
82
+
83
+ - [#35](https://github.com/l7aromeo/meocord/pull/35) [`b93a771`](https://github.com/l7aromeo/meocord/commit/b93a771b19664345fec4222d5a2c29dcf5b31a0d) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Generate code that passes a new application's own `lint`. A generated guard failed `tsc` and ESLint
84
+ — `GuardInterface` imported as a value, and an unused `context` parameter — and generated message and
85
+ reaction controllers imported names they never used, which only the application's ESLint, run in the
86
+ background after generating, removed. New applications also typecheck `meocord.config.ts`: the
87
+ template's `tsconfig.json` includes it instead of excluding it, so a type error in the config fails
88
+ `lint`, and editors resolve `paths` aliases imported there. `noEmit` stays on, so `tsc` writes nothing
89
+ beside it.
90
+
91
+ - [#25](https://github.com/l7aromeo/meocord/pull/25) [`2179f85`](https://github.com/l7aromeo/meocord/commit/2179f85c2912d45e3fefbf996ca267c19a1a773c) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Stop `meocord generate` overwriting files. Slash, context-menu and primary entry point controllers
92
+ all wrote one shared `builders/sample.builder.ts`, so generating a second controller replaced a
93
+ builder you had already edited. Each controller now gets its own `builders/<name>.builder.ts`
94
+ exporting `<Name>CommandBuilder`, and registers a command named after it — `admin/ban` registers
95
+ `admin-ban` — rather than every one registering `sample-slash`. Generating a controller, service or
96
+ guard refuses if any file it would write already exists.
97
+
98
+ - [#40](https://github.com/l7aromeo/meocord/pull/40) [`3629edd`](https://github.com/l7aromeo/meocord/commit/3629eddaf20bd0947d24e5582aa167b2c0ca0d47) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Lint `meocord.config.ts`. The shared ESLint config from `meocord/eslint` ignored it, so the config
99
+ alone skipped the rules every other file follows — unused imports, formatting. It is linted like the
100
+ rest now; the typecheck it already gets is unchanged.
101
+
102
+ - [#24](https://github.com/l7aromeo/meocord/pull/24) [`5e2a54b`](https://github.com/l7aromeo/meocord/commit/5e2a54b67a1f9f51c4c3a3e8cf51247de2ac2528) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Type `deleted` on `createMockMessage()`. The mock tracks and documents it, but it was missing from
103
+ the type, so `message.deleted` did not compile.
104
+
105
+ - [#24](https://github.com/l7aromeo/meocord/pull/24) [`5e2a54b`](https://github.com/l7aromeo/meocord/commit/5e2a54b67a1f9f51c4c3a3e8cf51247de2ac2528) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Accept slash command builders that add options. `@CommandBuilder(CommandType.SLASH)` rejected
106
+ `new SlashCommandBuilder().addStringOption(...)`, whose type narrows to
107
+ `SlashCommandOptionsOnlyBuilder`, so the most common builder — one command with an option — did
108
+ not compile.
109
+
110
+ - [#21](https://github.com/l7aromeo/meocord/pull/21) [`bebf116`](https://github.com/l7aromeo/meocord/commit/bebf1168466595546017a317b62acd3707ff2d1c) Thanks [@l7aromeo](https://github.com/l7aromeo)! - Generate applications with current test tooling: vitest and `@vitest/coverage-istanbul` 5,
111
+ `unplugin-swc` 2, and current eslint, prettier and typescript-eslint. A new application's
112
+ `test:coverage` no longer fails on its decorated entry files.
113
+
3
114
  ## 4.0.0-beta.5
4
115
 
5
116
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- var version = "4.0.0-beta.5";
1
+ var version = "4.0.0";
2
2
  var packageJson = {
3
3
  version: version};
4
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "meocord",
3
3
  "description": "Decorator-based Discord bot framework built on discord.js. Brings NestJS-style controllers, dependency injection, guards, and testing utilities to bot development — with a full CLI and TypeScript-first design.",
4
- "version": "4.0.0-beta.5",
4
+ "version": "4.0.0",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=22.13"