@2byte/tgbot-framework 1.0.8 → 1.0.9
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/package.json
CHANGED
package/src/core/App.ts
CHANGED
|
@@ -731,19 +731,23 @@ export class App {
|
|
|
731
731
|
throw new Error(`Section ${sectionId} not found at path ${pathSectionModule}.ts`);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
//
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
734
|
+
// For bypassing cache in Bun, we need to clear the module cache
|
|
735
|
+
if (freshVersion && typeof Bun !== 'undefined') {
|
|
736
|
+
// Clear Bun's module cache for this specific module
|
|
737
|
+
const modulePath = pathSectionModule + ".ts";
|
|
738
|
+
this.debugLog('Clearing cache for fresh version of section:', modulePath);
|
|
739
|
+
|
|
740
|
+
// In Bun, we can use dynamic import with a unique query to bypass cache
|
|
741
|
+
// But we need to resolve the absolute path first
|
|
742
|
+
const absolutePath = path.resolve(modulePath);
|
|
743
|
+
|
|
744
|
+
// Try to delete from require cache if it exists
|
|
745
|
+
if (require.cache && require.cache[absolutePath]) {
|
|
746
|
+
delete require.cache[absolutePath];
|
|
747
|
+
}
|
|
745
748
|
}
|
|
746
|
-
|
|
749
|
+
|
|
750
|
+
const sectionClass = (await import(pathSectionModule)).default as typeof Section;
|
|
747
751
|
this.debugLog("Loaded section", sectionId);
|
|
748
752
|
|
|
749
753
|
return sectionClass;
|
|
@@ -46,9 +46,9 @@ export class Artisan {
|
|
|
46
46
|
* Возвращает шаблон для новой секции
|
|
47
47
|
*/
|
|
48
48
|
private getSectionTemplate(name: string): string {
|
|
49
|
-
return `import { Section } from "
|
|
50
|
-
import { SectionOptions } from "
|
|
51
|
-
import { InlineKeyboard } from "
|
|
49
|
+
return `import { Section } from "@2byte/tgbot-framework";
|
|
50
|
+
import { SectionOptions } from "@2byte/tgbot-framework";
|
|
51
|
+
import { InlineKeyboard } from "@2byte/tgbot-framework";
|
|
52
52
|
|
|
53
53
|
export default class ${name}Section extends Section {
|
|
54
54
|
static command = "${name.toLowerCase()}";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
2
|
import { MakeManualPaginateButtonsParams, ModelPaginateParams, PaginateResult } from "@2byte/tgbot-framework";
|
|
3
3
|
import { Section } from "@2byte/tgbot-framework";
|
|
4
|
+
import { Model as BaseModel } from "@2byte/tgbot-framework";
|
|
4
5
|
|
|
5
|
-
export abstract class Model {
|
|
6
|
+
export abstract class Model extends BaseModel {
|
|
6
7
|
|
|
7
8
|
}
|