@dangao/bun-server 2.0.2 → 2.0.3

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Bun Server
2
2
 
3
- [![bun](https://img.shields.io/badge/Bun-1.3%2B-000?logo=bun&logoColor=fff)](https://bun.sh/)
3
+ > Examples: `https://disb-examples-{example-name}.dangaogm.com`
4
+
5
+ [![bun](https://img.shields.io/badge/Bun-1.3.10%2B-000?logo=bun&logoColor=fff)](https://bun.sh/)
4
6
  [![typescript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=fff)](https://www.typescriptlang.org/)
5
7
  [![license](https://img.shields.io/badge/license-MIT-blue)](#license)
6
8
 
@@ -212,7 +214,7 @@ For detailed lifecycle documentation, see
212
214
 
213
215
  ### Requirements
214
216
 
215
- - Bun `1.3.3`
217
+ - Bun >= `1.3.10`
216
218
 
217
219
  ### TypeScript Configuration ⚠️
218
220
 
@@ -563,15 +565,26 @@ macOS/Windows silently ignore it.
563
565
  `docs/error-handling.md`, `docs/request-lifecycle.md`.
564
566
  - **Chinese**: mirrored under `docs/zh/`. If something is missing, please fall
565
567
  back to the English source.
566
- - **Skills & Troubleshooting**: `skills/` directory
567
- - Real-world problems encountered during development with solutions
568
- - Organized by category (events, di, modules, common)
569
- - Each issue includes complete error info, root cause analysis, and fix steps
570
- - [View Skills Repository](./skills/README.md)
568
+ - **Skills & Troubleshooting**:
569
+ - In-repo troubleshooting cases: [`skills/`](./skills/README.md)
570
+ - Agent skills repository: [`bun-server-skills`](https://github.com/dangaogit/bun-server-skills)
571
+ - Install for Cursor (pick one):
572
+ ```bash
573
+ # bun
574
+ bunx skills add https://github.com/dangaogit/bun-server-skills --skill bun-server-best-practices
575
+ # npx
576
+ npx skills add https://github.com/dangaogit/bun-server-skills --skill bun-server-best-practices
577
+ # pnpm
578
+ pnpm dlx skills add https://github.com/dangaogit/bun-server-skills --skill bun-server-best-practices
579
+ # yarn
580
+ yarn dlx skills add https://github.com/dangaogit/bun-server-skills --skill bun-server-best-practices
581
+ # git (manual)
582
+ mkdir -p ~/.cursor/skills && git clone https://github.com/dangaogit/bun-server-skills.git ~/.cursor/skills/bun-server-skills
583
+ ```
571
584
 
572
585
  ## Roadmap
573
586
 
574
- Detailed milestones and history are tracked in the [`.roadmap/`](./.roadmap/)
587
+ Release history and changelogs are tracked in the [`.changelog/`](./.changelog/)
575
588
  directory.
576
589
 
577
590
  ## AI-Assisted Development
package/dist/index.js CHANGED
@@ -11376,10 +11376,13 @@ class QueueModule {
11376
11376
  providers2.push({
11377
11377
  provide: QUEUE_SERVICE_TOKEN,
11378
11378
  useValue: service
11379
+ }, {
11380
+ provide: QueueService,
11381
+ useValue: service
11379
11382
  }, {
11380
11383
  provide: QUEUE_OPTIONS_TOKEN,
11381
11384
  useValue: options
11382
- }, QueueService);
11385
+ });
11383
11386
  const existingMetadata = Reflect.getMetadata(MODULE_METADATA_KEY, QueueModule) || {};
11384
11387
  const metadata = {
11385
11388
  ...existingMetadata,
@@ -1 +1 @@
1
- {"version":3,"file":"queue-module.d.ts","sourceRoot":"","sources":["../../src/queue/queue-module.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,SAAS,CAAC;AAEjB,qBAGa,WAAW;IACtB;;;OAGG;WACW,OAAO,CACnB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,WAAW;CA0CtB"}
1
+ {"version":3,"file":"queue-module.d.ts","sourceRoot":"","sources":["../../src/queue/queue-module.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,SAAS,CAAC;AAEjB,qBAGa,WAAW;IACtB;;;OAGG;WACW,OAAO,CACnB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,WAAW;CA6CtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dangao/bun-server",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -37,11 +37,14 @@ export class QueueModule {
37
37
  provide: QUEUE_SERVICE_TOKEN,
38
38
  useValue: service,
39
39
  },
40
+ {
41
+ provide: QueueService,
42
+ useValue: service,
43
+ },
40
44
  {
41
45
  provide: QUEUE_OPTIONS_TOKEN,
42
46
  useValue: options,
43
47
  },
44
- QueueService,
45
48
  );
46
49
 
47
50
  // 动态更新模块元数据
@@ -37,6 +37,33 @@ describe('QueueModule', () => {
37
37
  expect(queueProvider.useValue).toBeInstanceOf(QueueService);
38
38
  });
39
39
 
40
+ test('should reuse same QueueService instance for class and token providers', () => {
41
+ QueueModule.forRoot({
42
+ enableWorker: true,
43
+ concurrency: 1,
44
+ });
45
+
46
+ const metadata = Reflect.getMetadata(MODULE_METADATA_KEY, QueueModule);
47
+ expect(metadata).toBeDefined();
48
+ expect(metadata.providers).toBeDefined();
49
+
50
+ const tokenProvider = metadata.providers.find(
51
+ (provider: any) => provider.provide === QUEUE_SERVICE_TOKEN,
52
+ );
53
+ const classProvider = metadata.providers.find(
54
+ (provider: any) => provider.provide === QueueService,
55
+ );
56
+
57
+ expect(tokenProvider).toBeDefined();
58
+ expect(classProvider).toBeDefined();
59
+ expect(tokenProvider.useValue).toBeInstanceOf(QueueService);
60
+ expect(classProvider.useValue).toBe(tokenProvider.useValue);
61
+
62
+ // Regression guard: worker path needs an initialized store.
63
+ const queueService = tokenProvider.useValue as QueueService & { store?: unknown };
64
+ expect(queueService.store).toBeDefined();
65
+ });
66
+
40
67
  test('should use custom store when provided', () => {
41
68
  const customStore = new MemoryQueueStore();
42
69
  QueueModule.forRoot({