meocord 1.2.3 → 1.2.4
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 +16 -8
- package/dist/cjs/_shared/{meocord.app-CHjdCAA_.cjs → meocord.app-q-erWOUy.cjs} +1 -1
- package/dist/cjs/_shared/{theme-BdtbtMZX.cjs → theme-TAjboxtz.cjs} +36 -9
- package/dist/cjs/common/index.cjs +1 -1
- package/dist/cjs/core/index.cjs +2 -2
- package/dist/cjs/decorator/index.cjs +2 -2
- package/dist/esm/bin/meocord.js +92 -0
- package/dist/esm/package.json.js +1 -1
- package/dist/esm/util/meocord-config-loader.util.js +35 -8
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.4] - 2026-04-09
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Compile `meocord.config.ts` to `dist/meocord.config.mjs` during `meocord build` so the config can be loaded at runtime without requiring `tsconfig.json`, source files, or path alias resolution. Fixes `@MeoCord` decorator failing with "No container found" in Docker and other environments where only `dist/` is present. ([2765dc8](https://github.com/l7aromeo/meocord/commit/2765dc8))
|
|
13
|
+
- Cache loaded config in `loadMeoCordConfig()` to avoid repeated jiti calls on every invocation (e.g., logger reading `appName` on each log line). ([2765dc8](https://github.com/l7aromeo/meocord/commit/2765dc8))
|
|
14
|
+
|
|
8
15
|
## [1.2.3] - 2026-04-09
|
|
9
16
|
|
|
10
17
|
### Fixed
|
|
11
18
|
|
|
12
|
-
- Move webpack build tools back to dependencies so `meocord start --dev` works automatically after `yarn add meocord` without requiring manual peer dependency installation.
|
|
19
|
+
- Move webpack build tools back to dependencies so `meocord start --dev` works automatically after `yarn add meocord` without requiring manual peer dependency installation. ([8fd1ca8](https://github.com/l7aromeo/meocord/commit/8fd1ca8))
|
|
20
|
+
- Add missing `discord.js` and related dev dependencies to package.json. ([449685a](https://github.com/l7aromeo/meocord/commit/449685a))
|
|
13
21
|
|
|
14
22
|
## [1.2.2] - 2026-04-09
|
|
15
23
|
|
|
@@ -35,16 +43,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
35
43
|
|
|
36
44
|
### Changed
|
|
37
45
|
|
|
38
|
-
- **Breaking:** Migrate build system from Babel to Rollup. Output structure changed from `dist/` to `dist/{esm,cjs,types}/`. Package exports updated accordingly. ([
|
|
39
|
-
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds. ([
|
|
40
|
-
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects. ([
|
|
41
|
-
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation. ([
|
|
46
|
+
- **Breaking:** Migrate build system from Babel to Rollup. Output structure changed from `dist/` to `dist/{esm,cjs,types}/`. Package exports updated accordingly. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
47
|
+
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
48
|
+
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
49
|
+
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation. ([268869b](https://github.com/l7aromeo/meocord/commit/268869b))
|
|
42
50
|
|
|
43
51
|
### Fixed
|
|
44
52
|
|
|
45
|
-
- Resolve webpack config path in CLI after dist structure change. ([
|
|
46
|
-
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`. ([
|
|
47
|
-
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings. ([
|
|
53
|
+
- Resolve webpack config path in CLI after dist structure change. ([76fcc96](https://github.com/l7aromeo/meocord/commit/76fcc96))
|
|
54
|
+
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`. ([69b63ec](https://github.com/l7aromeo/meocord/commit/69b63ec))
|
|
55
|
+
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings. ([1c1cdb4](https://github.com/l7aromeo/meocord/commit/1c1cdb4))
|
|
48
56
|
|
|
49
57
|
## [1.2.1] - 2026-03-18
|
|
50
58
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var discord_js = require('discord.js');
|
|
4
|
-
var theme = require('./theme-
|
|
4
|
+
var theme = require('./theme-TAjboxtz.cjs');
|
|
5
5
|
require('reflect-metadata');
|
|
6
6
|
var inversify = require('inversify');
|
|
7
7
|
var enum_index = require('../enum/index.cjs');
|
|
@@ -42,18 +42,47 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
42
42
|
;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
let cachedConfig;
|
|
46
|
+
let configLoaded = false;
|
|
45
47
|
/**
|
|
46
|
-
* Loads the MeoCord configuration
|
|
47
|
-
*
|
|
48
|
+
* Loads the MeoCord configuration, checking compiled output first then falling back to source.
|
|
49
|
+
*
|
|
50
|
+
* Resolution order:
|
|
51
|
+
* 1. `dist/meocord.config.mjs` — pre-compiled by `meocord build`, no tsconfig or source files needed
|
|
52
|
+
* 2. `meocord.config.ts` — loaded via jiti with tsconfig path aliases (dev mode)
|
|
53
|
+
*
|
|
54
|
+
* The result is cached after the first successful load.
|
|
48
55
|
*
|
|
49
56
|
* @returns {MeoCordConfig | undefined} The loaded configuration object, or undefined if loading fails.
|
|
50
57
|
*/ function loadMeoCordConfig() {
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
if (configLoaded) return cachedConfig;
|
|
59
|
+
configLoaded = true;
|
|
60
|
+
cachedConfig = loadCompiledConfig() ?? loadSourceConfig();
|
|
61
|
+
return cachedConfig;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Loads the pre-compiled config from dist/meocord.config.mjs.
|
|
65
|
+
* This file is generated by `meocord build` and requires no tsconfig or source files.
|
|
66
|
+
*/ function loadCompiledConfig() {
|
|
67
|
+
const compiledPath = path.resolve(process.cwd(), 'dist', 'meocord.config.mjs');
|
|
68
|
+
if (!fs.existsSync(compiledPath)) return undefined;
|
|
69
|
+
try {
|
|
70
|
+
const jiti$1 = jiti.createJiti((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('_shared/theme-TAjboxtz.cjs', document.baseURI).href)), {
|
|
71
|
+
interopDefault: true
|
|
72
|
+
});
|
|
73
|
+
return jiti$1(compiledPath);
|
|
74
|
+
} catch {
|
|
75
|
+
// Fall through to source config
|
|
53
76
|
return undefined;
|
|
54
77
|
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Loads the source config from meocord.config.ts via jiti with tsconfig path alias resolution.
|
|
81
|
+
* Used in development mode where source files and tsconfig.json are available.
|
|
82
|
+
*/ function loadSourceConfig() {
|
|
83
|
+
const configPath = path.resolve(process.cwd(), 'meocord.config.ts');
|
|
84
|
+
if (!fs.existsSync(configPath)) return undefined;
|
|
55
85
|
try {
|
|
56
|
-
// Read user's tsconfig.json to extract path aliases for jiti
|
|
57
86
|
const tsConfigPath = path.resolve(process.cwd(), 'tsconfig.json');
|
|
58
87
|
const aliases = {};
|
|
59
88
|
if (fs.existsSync(tsConfigPath)) {
|
|
@@ -61,14 +90,12 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
61
90
|
const paths = tsConfig?.compilerOptions?.paths;
|
|
62
91
|
if (paths) {
|
|
63
92
|
for (const [key, values] of Object.entries(paths)){
|
|
64
|
-
// Convert TS path alias format "@src/*" -> ["./src/*"] to jiti alias format
|
|
65
93
|
const aliasKey = key.replace('/*', '');
|
|
66
|
-
|
|
67
|
-
aliases[aliasKey] = aliasValue;
|
|
94
|
+
aliases[aliasKey] = path.resolve(process.cwd(), values[0].replace('/*', ''));
|
|
68
95
|
}
|
|
69
96
|
}
|
|
70
97
|
}
|
|
71
|
-
const jiti$1 = jiti.createJiti((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('_shared/theme-
|
|
98
|
+
const jiti$1 = jiti.createJiti((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('_shared/theme-TAjboxtz.cjs', document.baseURI).href)), {
|
|
72
99
|
interopDefault: true,
|
|
73
100
|
alias: aliases,
|
|
74
101
|
moduleCache: false
|
package/dist/cjs/core/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
|
-
var theme = require('../_shared/theme-
|
|
5
|
-
var meocord_app = require('../_shared/meocord.app-
|
|
4
|
+
var theme = require('../_shared/theme-TAjboxtz.cjs');
|
|
5
|
+
var meocord_app = require('../_shared/meocord.app-q-erWOUy.cjs');
|
|
6
6
|
require('inversify');
|
|
7
7
|
require('discord.js');
|
|
8
8
|
require('path');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
|
-
var meocord_app = require('../_shared/meocord.app-
|
|
4
|
+
var meocord_app = require('../_shared/meocord.app-q-erWOUy.cjs');
|
|
5
5
|
var inversify = require('inversify');
|
|
6
6
|
var discord_js = require('discord.js');
|
|
7
|
-
var theme = require('../_shared/theme-
|
|
7
|
+
var theme = require('../_shared/theme-TAjboxtz.cjs');
|
|
8
8
|
require('../enum/index.cjs');
|
|
9
9
|
require('lodash-es');
|
|
10
10
|
require('node:util');
|
package/dist/esm/bin/meocord.js
CHANGED
|
@@ -9,6 +9,7 @@ import wait from '../util/wait.util.js';
|
|
|
9
9
|
import { GeneratorCLI } from './generator.js';
|
|
10
10
|
import * as fs from 'node:fs';
|
|
11
11
|
import { setEnvironment, compileAndValidateConfig } from '../util/common.util.js';
|
|
12
|
+
import { prepareModifiedTsConfig } from '../util/tsconfig.util.js';
|
|
12
13
|
import { Command } from 'commander';
|
|
13
14
|
import { simpleGit } from 'simple-git';
|
|
14
15
|
import chalk from 'chalk';
|
|
@@ -16,6 +17,8 @@ import { execSync } from 'child_process';
|
|
|
16
17
|
import { ensureReady, configureCommandHelp } from '../util/meocord-cli.util.js';
|
|
17
18
|
import packageJson from '../package.json.js';
|
|
18
19
|
import { fileURLToPath } from 'url';
|
|
20
|
+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|
21
|
+
import nodeExternals from 'webpack-node-externals';
|
|
19
22
|
|
|
20
23
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
21
24
|
const __dirname$1 = path.dirname(__filename$1);
|
|
@@ -69,6 +72,7 @@ For full license details, refer to:
|
|
|
69
72
|
setEnvironment(mode);
|
|
70
73
|
await compileAndValidateConfig();
|
|
71
74
|
await this.build(mode);
|
|
75
|
+
await this.compileConfig();
|
|
72
76
|
});
|
|
73
77
|
program.command('start').description('Start the application').option('-b, --build', 'Pre-build before starting').option('-d, --dev', 'Start in development mode').option('-p, --prod', 'Start in production mode').action(async (options)=>{
|
|
74
78
|
await ensureReady();
|
|
@@ -79,6 +83,7 @@ For full license details, refer to:
|
|
|
79
83
|
}
|
|
80
84
|
if (options.build) {
|
|
81
85
|
await this.build(mode);
|
|
86
|
+
await this.compileConfig();
|
|
82
87
|
}
|
|
83
88
|
options.prod ? await this.startProd() : await this.startDev();
|
|
84
89
|
});
|
|
@@ -190,6 +195,93 @@ For full license details, refer to:
|
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
/**
|
|
198
|
+
* Compiles meocord.config.ts to dist/meocord.config.mjs so the config
|
|
199
|
+
* can be loaded at runtime without jiti, tsconfig, or source files.
|
|
200
|
+
*/ async compileConfig() {
|
|
201
|
+
const configPath = path.resolve(this.projectRoot, 'meocord.config.ts');
|
|
202
|
+
if (!fs.existsSync(configPath)) return;
|
|
203
|
+
try {
|
|
204
|
+
const tsConfigPath = prepareModifiedTsConfig();
|
|
205
|
+
const compiler = webpack({
|
|
206
|
+
entry: configPath,
|
|
207
|
+
target: 'node',
|
|
208
|
+
mode: 'production',
|
|
209
|
+
externals: [
|
|
210
|
+
nodeExternals({
|
|
211
|
+
importType: 'module'
|
|
212
|
+
})
|
|
213
|
+
],
|
|
214
|
+
module: {
|
|
215
|
+
rules: [
|
|
216
|
+
{
|
|
217
|
+
test: /\.ts$/,
|
|
218
|
+
use: {
|
|
219
|
+
loader: 'swc-loader',
|
|
220
|
+
options: {
|
|
221
|
+
jsc: {
|
|
222
|
+
parser: {
|
|
223
|
+
syntax: 'typescript',
|
|
224
|
+
tsx: false,
|
|
225
|
+
decorators: true
|
|
226
|
+
},
|
|
227
|
+
transform: {
|
|
228
|
+
decoratorMetadata: true,
|
|
229
|
+
legacyDecorator: true
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
exclude: /node_modules/
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
resolve: {
|
|
239
|
+
extensions: [
|
|
240
|
+
'.ts',
|
|
241
|
+
'.js'
|
|
242
|
+
],
|
|
243
|
+
plugins: [
|
|
244
|
+
new TsconfigPathsPlugin({
|
|
245
|
+
configFile: tsConfigPath
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
output: {
|
|
250
|
+
filename: 'meocord.config.mjs',
|
|
251
|
+
path: path.resolve(this.projectRoot, 'dist'),
|
|
252
|
+
library: {
|
|
253
|
+
type: 'module'
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
experiments: {
|
|
257
|
+
outputModule: true
|
|
258
|
+
},
|
|
259
|
+
optimization: {
|
|
260
|
+
minimize: false
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
await new Promise((resolve)=>{
|
|
264
|
+
compiler.run((err, stats)=>{
|
|
265
|
+
if (err || stats?.hasErrors()) {
|
|
266
|
+
this.logger.warn('Failed to compile meocord.config.ts — runtime will fall back to source config.');
|
|
267
|
+
resolve();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
compiler.close((closeErr)=>{
|
|
271
|
+
if (closeErr) {
|
|
272
|
+
resolve();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.logger.info('Config compiled to dist/meocord.config.mjs');
|
|
276
|
+
resolve();
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
} catch {
|
|
281
|
+
this.logger.warn('Failed to compile meocord.config.ts — runtime will fall back to source config.');
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
193
285
|
* Starts the MeoCord application in development mode with live updates.
|
|
194
286
|
*/ async startDev() {
|
|
195
287
|
try {
|
package/dist/esm/package.json.js
CHANGED
|
@@ -3,18 +3,47 @@ import { existsSync, readFileSync } from 'fs';
|
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
4
|
import { fixJSON } from './json.util.js';
|
|
5
5
|
|
|
6
|
+
let cachedConfig;
|
|
7
|
+
let configLoaded = false;
|
|
6
8
|
/**
|
|
7
|
-
* Loads the MeoCord configuration
|
|
8
|
-
*
|
|
9
|
+
* Loads the MeoCord configuration, checking compiled output first then falling back to source.
|
|
10
|
+
*
|
|
11
|
+
* Resolution order:
|
|
12
|
+
* 1. `dist/meocord.config.mjs` — pre-compiled by `meocord build`, no tsconfig or source files needed
|
|
13
|
+
* 2. `meocord.config.ts` — loaded via jiti with tsconfig path aliases (dev mode)
|
|
14
|
+
*
|
|
15
|
+
* The result is cached after the first successful load.
|
|
9
16
|
*
|
|
10
17
|
* @returns {MeoCordConfig | undefined} The loaded configuration object, or undefined if loading fails.
|
|
11
18
|
*/ function loadMeoCordConfig() {
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
if (configLoaded) return cachedConfig;
|
|
20
|
+
configLoaded = true;
|
|
21
|
+
cachedConfig = loadCompiledConfig() ?? loadSourceConfig();
|
|
22
|
+
return cachedConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Loads the pre-compiled config from dist/meocord.config.mjs.
|
|
26
|
+
* This file is generated by `meocord build` and requires no tsconfig or source files.
|
|
27
|
+
*/ function loadCompiledConfig() {
|
|
28
|
+
const compiledPath = path.resolve(process.cwd(), 'dist', 'meocord.config.mjs');
|
|
29
|
+
if (!existsSync(compiledPath)) return undefined;
|
|
30
|
+
try {
|
|
31
|
+
const jiti = createJiti(import.meta.url, {
|
|
32
|
+
interopDefault: true
|
|
33
|
+
});
|
|
34
|
+
return jiti(compiledPath);
|
|
35
|
+
} catch {
|
|
36
|
+
// Fall through to source config
|
|
14
37
|
return undefined;
|
|
15
38
|
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Loads the source config from meocord.config.ts via jiti with tsconfig path alias resolution.
|
|
42
|
+
* Used in development mode where source files and tsconfig.json are available.
|
|
43
|
+
*/ function loadSourceConfig() {
|
|
44
|
+
const configPath = path.resolve(process.cwd(), 'meocord.config.ts');
|
|
45
|
+
if (!existsSync(configPath)) return undefined;
|
|
16
46
|
try {
|
|
17
|
-
// Read user's tsconfig.json to extract path aliases for jiti
|
|
18
47
|
const tsConfigPath = path.resolve(process.cwd(), 'tsconfig.json');
|
|
19
48
|
const aliases = {};
|
|
20
49
|
if (existsSync(tsConfigPath)) {
|
|
@@ -22,10 +51,8 @@ import { fixJSON } from './json.util.js';
|
|
|
22
51
|
const paths = tsConfig?.compilerOptions?.paths;
|
|
23
52
|
if (paths) {
|
|
24
53
|
for (const [key, values] of Object.entries(paths)){
|
|
25
|
-
// Convert TS path alias format "@src/*" -> ["./src/*"] to jiti alias format
|
|
26
54
|
const aliasKey = key.replace('/*', '');
|
|
27
|
-
|
|
28
|
-
aliases[aliasKey] = aliasValue;
|
|
55
|
+
aliases[aliasKey] = path.resolve(process.cwd(), values[0].replace('/*', ''));
|
|
29
56
|
}
|
|
30
57
|
}
|
|
31
58
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meocord",
|
|
3
3
|
"description": "MeoCord is a lightweight and modular framework for building scalable Discord bots using TypeScript and Discord.js. It simplifies bot development with an extensible architecture, TypeScript-first approach, and powerful CLI tools.",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.4",
|
|
5
5
|
"packageManager": "yarn@4.12.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"@types/lodash-es": "^4.17.12",
|
|
90
90
|
"@types/webpack-node-externals": "^3.0.4",
|
|
91
91
|
"@typescript-eslint/parser": "^8.58.1",
|
|
92
|
+
"discord.js": "^14.26.2",
|
|
92
93
|
"eslint": "^9.39.4",
|
|
93
94
|
"eslint-config-prettier": "^10.1.8",
|
|
94
95
|
"eslint-plugin-headers": "^1.3.4",
|