nuxt-processor 0.0.10 → 0.0.12

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
@@ -52,6 +52,15 @@ export default defineNuxtConfig({
52
52
  password: process.env.NUXT_REDIS_PASSWORD ?? '',
53
53
  username: process.env.NUXT_REDIS_USERNAME,
54
54
  db: Number(process.env.NUXT_REDIS_DB ?? 0),
55
+ // Optional connection behavior
56
+ // Delay connecting until first Redis command (useful to avoid build-time connects)
57
+ lazyConnect: process.env.NUXT_REDIS_LAZY_CONNECT
58
+ ? process.env.NUXT_REDIS_LAZY_CONNECT === 'true'
59
+ : undefined,
60
+ // Milliseconds to wait before giving up when establishing the connection
61
+ connectTimeout: process.env.NUXT_REDIS_CONNECT_TIMEOUT
62
+ ? Number(process.env.NUXT_REDIS_CONNECT_TIMEOUT)
63
+ : undefined,
55
64
  },
56
65
  },
57
66
  })
package/dist/cli.cjs CHANGED
@@ -8,7 +8,7 @@ const pathe = require('pathe');
8
8
  const consola = require('consola');
9
9
  const citty = require('citty');
10
10
  const kit = require('@nuxt/kit');
11
- const _package = require('./shared/nuxt-processor.CIZw0pFs.cjs');
11
+ const _package = require('./shared/nuxt-processor.XeX-J1zD.cjs');
12
12
 
13
13
  const ensureNuxtProject = async (args) => {
14
14
  const dir = pathe.resolve(args.dir);
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import { resolve } from 'pathe';
6
6
  import { consola } from 'consola';
7
7
  import { createMain, defineCommand } from 'citty';
8
8
  import { loadNuxtConfig } from '@nuxt/kit';
9
- import { v as version, d as description, n as name } from './shared/nuxt-processor.IJ4IK9ZI.mjs';
9
+ import { v as version, d as description, n as name } from './shared/nuxt-processor.Bp92mFhC.mjs';
10
10
 
11
11
  const ensureNuxtProject = async (args) => {
12
12
  const dir = resolve(args.dir);
package/dist/module.cjs CHANGED
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const kit = require('@nuxt/kit');
4
- const _package = require('./shared/nuxt-processor.CIZw0pFs.cjs');
4
+ const _package = require('./shared/nuxt-processor.XeX-J1zD.cjs');
5
5
  const node_path = require('node:path');
6
6
  const fg = require('fast-glob');
7
- const workers_js = require('../dist/runtime/server/utils/workers.js');
8
7
 
9
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -42,14 +41,29 @@ const module$1 = kit.defineNuxtModule({
42
41
  // needs Redis >= 6
43
42
  db: Number(process.env.NUXT_REDIS_DB ?? 0),
44
43
  // Defaults to 0 on ioredis
44
+ lazyConnect: process.env.NUXT_REDIS_LAZY_CONNECT === "true" ? true : void 0,
45
+ connectTimeout: process.env.NUXT_REDIS_CONNECT_TIMEOUT ? Number(process.env.NUXT_REDIS_CONNECT_TIMEOUT) : void 0,
45
46
  url: process.env.NUXT_REDIS_URL ?? void 0
46
47
  },
47
48
  workers: "server/workers"
48
49
  },
49
50
  async setup(_options, nuxt) {
50
51
  const { resolve } = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
51
- const { setConnection } = workers_js.$workers();
52
- setConnection(_options.redis);
52
+ const redisInline = JSON.stringify(_options.redis ?? {});
53
+ const nitroPlugin = `
54
+ import { defineNitroPlugin } from '#imports'
55
+ import { $workers } from '#processor-utils'
56
+
57
+ export default defineNitroPlugin(() => {
58
+ $workers().setConnection(${redisInline})
59
+ })
60
+ `;
61
+ const tpl = kit.addTemplate({
62
+ filename: "0.processor-nuxt-plugin.ts",
63
+ write: true,
64
+ getContents: () => nitroPlugin
65
+ });
66
+ kit.addServerPlugin(tpl.dst);
53
67
  function generateWorkersEntryContent(workerFiles) {
54
68
  const toImportArray = workerFiles.map((id) => `() => import(${JSON.stringify(id)})`).join(",\n ");
55
69
  return `
@@ -61,7 +75,7 @@ import { $workers } from '#processor-utils'
61
75
  // Initialize connection as early as possible so any imports that register
62
76
  // workers/queues have a valid connection available.
63
77
  const api = $workers()
64
- api.setConnection(${JSON.stringify(_options.redis ?? {})})
78
+ api.setConnection(${redisInline})
65
79
 
66
80
  export async function createWorkersApp() {
67
81
  // Avoid EPIPE when stdout/stderr are closed by terminal (e.g., Ctrl+C piping)
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-processor",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0 || ^3.0.0"
6
6
  },
package/dist/module.mjs CHANGED
@@ -1,8 +1,7 @@
1
- import { useNuxt, createResolver, defineNuxtModule, addTypeTemplate } from '@nuxt/kit';
2
- import { c as configKey, a as compatibility, v as version, n as name } from './shared/nuxt-processor.IJ4IK9ZI.mjs';
1
+ import { useNuxt, createResolver, defineNuxtModule, addTemplate, addServerPlugin, addTypeTemplate } from '@nuxt/kit';
2
+ import { c as configKey, a as compatibility, v as version, n as name } from './shared/nuxt-processor.Bp92mFhC.mjs';
3
3
  import { relative } from 'node:path';
4
4
  import fg from 'fast-glob';
5
- import { $workers } from '../dist/runtime/server/utils/workers.js';
6
5
 
7
6
  const scanFolder = async (path) => {
8
7
  const nuxt = useNuxt();
@@ -35,14 +34,29 @@ const module = defineNuxtModule({
35
34
  // needs Redis >= 6
36
35
  db: Number(process.env.NUXT_REDIS_DB ?? 0),
37
36
  // Defaults to 0 on ioredis
37
+ lazyConnect: process.env.NUXT_REDIS_LAZY_CONNECT === "true" ? true : void 0,
38
+ connectTimeout: process.env.NUXT_REDIS_CONNECT_TIMEOUT ? Number(process.env.NUXT_REDIS_CONNECT_TIMEOUT) : void 0,
38
39
  url: process.env.NUXT_REDIS_URL ?? void 0
39
40
  },
40
41
  workers: "server/workers"
41
42
  },
42
43
  async setup(_options, nuxt) {
43
44
  const { resolve } = createResolver(import.meta.url);
44
- const { setConnection } = $workers();
45
- setConnection(_options.redis);
45
+ const redisInline = JSON.stringify(_options.redis ?? {});
46
+ const nitroPlugin = `
47
+ import { defineNitroPlugin } from '#imports'
48
+ import { $workers } from '#processor-utils'
49
+
50
+ export default defineNitroPlugin(() => {
51
+ $workers().setConnection(${redisInline})
52
+ })
53
+ `;
54
+ const tpl = addTemplate({
55
+ filename: "0.processor-nuxt-plugin.ts",
56
+ write: true,
57
+ getContents: () => nitroPlugin
58
+ });
59
+ addServerPlugin(tpl.dst);
46
60
  function generateWorkersEntryContent(workerFiles) {
47
61
  const toImportArray = workerFiles.map((id) => `() => import(${JSON.stringify(id)})`).join(",\n ");
48
62
  return `
@@ -54,7 +68,7 @@ import { $workers } from '#processor-utils'
54
68
  // Initialize connection as early as possible so any imports that register
55
69
  // workers/queues have a valid connection available.
56
70
  const api = $workers()
57
- api.setConnection(${JSON.stringify(_options.redis ?? {})})
71
+ api.setConnection(${redisInline})
58
72
 
59
73
  export async function createWorkersApp() {
60
74
  // Avoid EPIPE when stdout/stderr are closed by terminal (e.g., Ctrl+C piping)
@@ -20,5 +20,6 @@ export declare function $workers(): {
20
20
  stopAll: () => Promise<void>;
21
21
  readonly queues: Queue<any, any, any, any, any, any>[];
22
22
  readonly workers: Worker<any, any, any>[];
23
+ readonly connection: import("bullmq").ConnectionOptions | undefined;
23
24
  };
24
25
  export type { Queue, Worker, Processor, QueueOptions, WorkerOptions, JobsOptions, Job };
@@ -49,6 +49,9 @@ export function $workers() {
49
49
  },
50
50
  get workers() {
51
51
  return registry.workers;
52
+ },
53
+ get connection() {
54
+ return registry.connection;
52
55
  }
53
56
  };
54
57
  }
@@ -1,5 +1,5 @@
1
1
  const name = "nuxt-processor";
2
- const version = "0.0.10";
2
+ const version = "0.0.12";
3
3
  const description = "Nuxt Processor";
4
4
  const configKey = "processor";
5
5
  const compatibility = {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const name = "nuxt-processor";
4
- const version = "0.0.10";
4
+ const version = "0.0.12";
5
5
  const description = "Nuxt Processor";
6
6
  const configKey = "processor";
7
7
  const compatibility = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-processor",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Nuxt Processor",
5
5
  "repository": "https://github.com/aidanhibbard/nuxt-processor",
6
6
  "license": "MIT",
@@ -35,6 +35,7 @@
35
35
  "dev": "npm run dev:prepare && nuxi dev playground",
36
36
  "dev:build": "nuxi build playground",
37
37
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
38
+ "ci:dev:build": "npm run dev:prepare && cd playground && npm i && cd ../ && npm run dev:build",
38
39
  "release": "npm run lint && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
39
40
  "lint": "eslint .",
40
41
  "test": "vitest run",