nitro-queue 0.0.3 → 0.0.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/README.ko.md CHANGED
@@ -29,30 +29,29 @@ nitro-queue는 wrangler로 생성한 type을 프로젝트 queue 타입에 맞게
29
29
  "scripts": {
30
30
  "prepare": "pnpm types:cloudflare && pnpm types:cloudflare",
31
31
  "types:cloudflare": "wrangler types cloudflare.d.ts --config ./.output/server/wrangler.json",
32
- "types:queue": "npx nitro-queue types cloudflare.d.ts",
33
- },
32
+ "types:queue": "npx nitro-queue types cloudflare.d.ts"
33
+ }
34
34
  }
35
-
36
35
  ```
37
36
  # How to use
38
37
  ```ts
39
38
  // queues/user/remove.ts
40
39
  export default defineQueue<{
41
- userId: string,
40
+ userId: string
42
41
  }>({
43
- run(payload) {
44
- console.log(payload.userId)
45
- }
42
+ run(payload) {
43
+ console.log(payload.userId)
44
+ }
46
45
  })
47
46
 
48
47
  // routes/publish.ts
49
48
  export default defineHandler(async (e) => {
50
- e.runtime.cloudflare.env.MY_QUEUE.send({
51
- type: 'user:remove',
52
- payload: { userId }
53
- })
49
+ e.runtime.cloudflare.env.MY_QUEUE.send({
50
+ type: 'user:remove',
51
+ payload: { userId }
52
+ })
54
53
  })
55
54
  ```
56
55
 
57
56
  # 주의점
58
- - 테스트를 면밀히 거치지 않았습니다. 버그가 발생한다면 이슈를 통해 알려주시면 감사드리겠습니다.
57
+ - 테스트를 면밀히 거치지 않았습니다. 버그가 발생한다면 이슈를 통해 알려주시면 감사드리겠습니다.
package/README.md CHANGED
@@ -46,22 +46,22 @@ nitro-queue then modifies the types generated by wrangler to match your project'
46
46
  ```ts
47
47
  // queues/user/remove.ts
48
48
  export default defineQueue<{
49
- userId: string,
49
+ userId: string
50
50
  }>({
51
- run(payload) {
52
- console.log(payload.userId)
53
- }
51
+ run(payload) {
52
+ console.log(payload.userId)
53
+ }
54
54
  })
55
55
 
56
56
  // routes/publish.ts
57
57
  export default defineHandler(async (e) => {
58
- e.runtime.cloudflare.env.MY_QUEUE.send({
59
- type: 'user:remove',
60
- payload: { userId }
61
- })
58
+ e.runtime.cloudflare.env.MY_QUEUE.send({
59
+ type: 'user:remove',
60
+ payload: { userId }
61
+ })
62
62
  })
63
63
  ```
64
64
 
65
65
  # Note
66
66
 
67
- This module has not been thoroughly tested. If you encounter any bugs, please feel free to open an issue. Your feedback is greatly appreciated.
67
+ This module has not been thoroughly tested. If you encounter any bugs, please feel free to open an issue. Your feedback is greatly appreciated.
package/dist/cli.mjs CHANGED
@@ -19,7 +19,7 @@ if (command === "types") {
19
19
  replaceInFileSync({
20
20
  files: targetFile,
21
21
  from: /^/,
22
- to: `import type { QueueMessageBody } from './node_modules/.nitro/server/nitro-queue'
22
+ to: `import type { QueueMessageBody } from './node_modules/.nitro/types/nitro-queue'
23
23
  `
24
24
  });
25
25
  replaceInFileSync({
package/dist/index.mjs CHANGED
@@ -58,7 +58,7 @@ function initQueue() {
58
58
  async setup(nitro) {
59
59
  const serverDir = nitro.options.serverDir || nitro.options.rootDir;
60
60
  const queuesDir = join(serverDir, "queues");
61
- const outputPath = join(nitro.options.rootDir, "node_modules/.nitro/server/nitro-queue.d.ts");
61
+ const outputPath = join(nitro.options.rootDir, "node_modules/.nitro/types/nitro-queue.d.ts");
62
62
  async function generateTypes() {
63
63
  const queues = await scanQueues(queuesDir);
64
64
  await generateQueueTypes(queues, outputPath);
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "nitro-queue",
3
3
  "type": "module",
4
+ "version": "0.0.4",
4
5
  "private": false,
5
- "version": "0.0.3",
6
6
  "description": "Queue module for Nitro",
7
7
  "license": "MIT",
8
- "bin": {
9
- "nitro-queue": "./dist/cli.mjs"
10
- },
11
8
  "exports": {
12
9
  ".": {
13
10
  "types": "./dist/index.d.ts",
@@ -17,6 +14,9 @@
17
14
  "main": "./dist/index.mjs",
18
15
  "module": "./dist/index.mjs",
19
16
  "types": "./dist/index.d.ts",
17
+ "bin": {
18
+ "nitro-queue": "./dist/cli.mjs"
19
+ },
20
20
  "files": [
21
21
  "dist"
22
22
  ],