nuxt-processor 0.0.15 → 1.0.0
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 +10 -10
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/module.cjs +22 -15
- package/dist/module.json +1 -1
- package/dist/module.mjs +22 -15
- package/dist/runtime/server/utils/workers.d.ts +2 -2
- package/dist/shared/{nuxt-processor.anOQG_7p.cjs → nuxt-processor.BbReXIMn.cjs} +1 -1
- package/dist/shared/{nuxt-processor.Ff27cxgy.mjs → nuxt-processor.DCy15jfQ.mjs} +1 -1
- package/package.json +20 -17
package/README.md
CHANGED
|
@@ -54,20 +54,20 @@ export default defineNuxtConfig({
|
|
|
54
54
|
redis: {
|
|
55
55
|
// Prefer a single URL if available (takes precedence over other fields)
|
|
56
56
|
// e.g. redis://user:pass@host:6379/0
|
|
57
|
-
url: process.env.
|
|
58
|
-
host: process.env.
|
|
59
|
-
port: Number(process.env.
|
|
60
|
-
password: process.env.
|
|
61
|
-
username: process.env.
|
|
62
|
-
db: Number(process.env.
|
|
57
|
+
url: process.env.REDIS_URL,
|
|
58
|
+
host: process.env.REDIS_HOST ?? '127.0.0.1',
|
|
59
|
+
port: Number(process.env.REDIS_PORT ?? 6379),
|
|
60
|
+
password: process.env.REDIS_PASSWORD ?? '',
|
|
61
|
+
username: process.env.REDIS_USERNAME,
|
|
62
|
+
db: Number(process.env.REDIS_DB ?? 0),
|
|
63
63
|
// Optional connection behavior
|
|
64
64
|
// Delay connecting until first Redis command (useful to avoid build-time connects)
|
|
65
|
-
lazyConnect: process.env.
|
|
66
|
-
? process.env.
|
|
65
|
+
lazyConnect: process.env.REDIS_LAZY_CONNECT
|
|
66
|
+
? process.env.REDIS_LAZY_CONNECT === 'true'
|
|
67
67
|
: undefined,
|
|
68
68
|
// Milliseconds to wait before giving up when establishing the connection
|
|
69
|
-
connectTimeout: process.env.
|
|
70
|
-
? Number(process.env.
|
|
69
|
+
connectTimeout: process.env.REDIS_CONNECT_TIMEOUT
|
|
70
|
+
? Number(process.env.REDIS_CONNECT_TIMEOUT)
|
|
71
71
|
: undefined,
|
|
72
72
|
},
|
|
73
73
|
},
|
package/dist/cli.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const node_fs = require('node:fs');
|
|
|
5
5
|
const pathe = require('pathe');
|
|
6
6
|
const citty = require('citty');
|
|
7
7
|
const kit = require('@nuxt/kit');
|
|
8
|
-
const logger = require('./shared/nuxt-processor.
|
|
8
|
+
const logger = require('./shared/nuxt-processor.BbReXIMn.cjs');
|
|
9
9
|
const promises = require('node:readline/promises');
|
|
10
10
|
const node_process = require('node:process');
|
|
11
11
|
require('consola');
|
package/dist/cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
4
|
import { createMain, defineCommand } from 'citty';
|
|
5
5
|
import { loadNuxtConfig } from '@nuxt/kit';
|
|
6
|
-
import { l as logger, v as version, d as description, n as name } from './shared/nuxt-processor.
|
|
6
|
+
import { l as logger, v as version, d as description, n as name } from './shared/nuxt-processor.DCy15jfQ.mjs';
|
|
7
7
|
import { createInterface } from 'node:readline/promises';
|
|
8
8
|
import { stdout, stdin } from 'node:process';
|
|
9
9
|
import 'consola';
|
package/dist/module.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const kit = require('@nuxt/kit');
|
|
4
|
-
const logger = require('./shared/nuxt-processor.
|
|
4
|
+
const logger = require('./shared/nuxt-processor.BbReXIMn.cjs');
|
|
5
5
|
const node_path = require('node:path');
|
|
6
6
|
const fg = require('fast-glob');
|
|
7
7
|
require('consola');
|
|
@@ -28,18 +28,20 @@ const scanFolder = async (path) => {
|
|
|
28
28
|
return files;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
function generateWorkersEntryContent(workerFiles
|
|
31
|
+
function generateWorkersEntryContent(workerFiles) {
|
|
32
32
|
const toImportArray = workerFiles.map((id) => `() => import(${JSON.stringify(id)})`).join(",\n ");
|
|
33
33
|
return `
|
|
34
34
|
import { fileURLToPath } from 'node:url'
|
|
35
35
|
import { resolve as resolvePath } from 'node:path'
|
|
36
36
|
import { consola } from 'consola'
|
|
37
|
+
import { useRuntimeConfig } from '#imports'
|
|
37
38
|
import { $workers } from '#processor-utils'
|
|
38
39
|
|
|
39
40
|
// Initialize connection as early as possible so any imports that register
|
|
40
41
|
// workers/queues have a valid connection available.
|
|
41
42
|
const api = $workers()
|
|
42
|
-
|
|
43
|
+
const { redis } = useRuntimeConfig()
|
|
44
|
+
api.setConnection(process.env.REDIS_URL ? { ...redis, url: process.env.REDIS_URL } : redis)
|
|
43
45
|
|
|
44
46
|
export async function createWorkersApp() {
|
|
45
47
|
// Avoid EPIPE when stdout/stderr are closed by terminal (e.g., Ctrl+C piping)
|
|
@@ -146,28 +148,33 @@ const module$1 = kit.defineNuxtModule({
|
|
|
146
148
|
// Default configuration options of the Nuxt module
|
|
147
149
|
defaults: {
|
|
148
150
|
redis: {
|
|
149
|
-
host: process.env.
|
|
150
|
-
port: Number(process.env.
|
|
151
|
-
password: process.env.
|
|
152
|
-
username: process.env.
|
|
151
|
+
host: process.env.REDIS_HOST ?? "127.0.0.1",
|
|
152
|
+
port: Number(process.env.REDIS_PORT ?? 6379),
|
|
153
|
+
password: process.env.REDIS_PASSWORD ?? "",
|
|
154
|
+
username: process.env.REDIS_USERNAME ?? void 0,
|
|
153
155
|
// needs Redis >= 6
|
|
154
|
-
db: Number(process.env.
|
|
156
|
+
db: Number(process.env.REDIS_DB ?? 0),
|
|
155
157
|
// Defaults to 0 on ioredis
|
|
156
|
-
lazyConnect: process.env.
|
|
157
|
-
connectTimeout: process.env.
|
|
158
|
-
url: process.env.
|
|
158
|
+
lazyConnect: process.env.REDIS_LAZY_CONNECT === "true" ? true : void 0,
|
|
159
|
+
connectTimeout: process.env.REDIS_CONNECT_TIMEOUT ? Number(process.env.REDIS_CONNECT_TIMEOUT) : void 0,
|
|
160
|
+
url: process.env.REDIS_URL ?? void 0
|
|
159
161
|
},
|
|
160
162
|
workers: "server/workers"
|
|
161
163
|
},
|
|
162
164
|
async setup(_options, nuxt) {
|
|
163
165
|
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)));
|
|
164
|
-
const
|
|
166
|
+
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
167
|
+
runtimeConfig.redis = {
|
|
168
|
+
..._options.redis ?? {},
|
|
169
|
+
...runtimeConfig.redis ?? {}
|
|
170
|
+
};
|
|
165
171
|
const nitroPlugin = `
|
|
166
|
-
import { defineNitroPlugin } from '#imports'
|
|
172
|
+
import { defineNitroPlugin, useRuntimeConfig } from '#imports'
|
|
167
173
|
import { $workers } from '#processor-utils'
|
|
168
174
|
|
|
169
175
|
export default defineNitroPlugin(() => {
|
|
170
|
-
|
|
176
|
+
const { redis } = useRuntimeConfig()
|
|
177
|
+
$workers().setConnection(process.env.REDIS_URL ? { ...redis, url: process.env.REDIS_URL } : redis)
|
|
171
178
|
})
|
|
172
179
|
`;
|
|
173
180
|
const tpl = kit.addTemplate({
|
|
@@ -217,7 +224,7 @@ declare module '#bullmq' {
|
|
|
217
224
|
virtualCode = "";
|
|
218
225
|
return;
|
|
219
226
|
}
|
|
220
|
-
virtualCode = generateWorkersEntryContent(workerFiles
|
|
227
|
+
virtualCode = generateWorkersEntryContent(workerFiles);
|
|
221
228
|
for (const id of workerFiles) {
|
|
222
229
|
this.addWatchFile(id);
|
|
223
230
|
}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useNuxt, createResolver, defineNuxtModule, addTemplate, addServerPlugin, addTypeTemplate } from '@nuxt/kit';
|
|
2
|
-
import { l as logger, c as configKey, a as compatibility, v as version, n as name } from './shared/nuxt-processor.
|
|
2
|
+
import { l as logger, c as configKey, a as compatibility, v as version, n as name } from './shared/nuxt-processor.DCy15jfQ.mjs';
|
|
3
3
|
import { relative } from 'node:path';
|
|
4
4
|
import fg from 'fast-glob';
|
|
5
5
|
import 'consola';
|
|
@@ -21,18 +21,20 @@ const scanFolder = async (path) => {
|
|
|
21
21
|
return files;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
function generateWorkersEntryContent(workerFiles
|
|
24
|
+
function generateWorkersEntryContent(workerFiles) {
|
|
25
25
|
const toImportArray = workerFiles.map((id) => `() => import(${JSON.stringify(id)})`).join(",\n ");
|
|
26
26
|
return `
|
|
27
27
|
import { fileURLToPath } from 'node:url'
|
|
28
28
|
import { resolve as resolvePath } from 'node:path'
|
|
29
29
|
import { consola } from 'consola'
|
|
30
|
+
import { useRuntimeConfig } from '#imports'
|
|
30
31
|
import { $workers } from '#processor-utils'
|
|
31
32
|
|
|
32
33
|
// Initialize connection as early as possible so any imports that register
|
|
33
34
|
// workers/queues have a valid connection available.
|
|
34
35
|
const api = $workers()
|
|
35
|
-
|
|
36
|
+
const { redis } = useRuntimeConfig()
|
|
37
|
+
api.setConnection(process.env.REDIS_URL ? { ...redis, url: process.env.REDIS_URL } : redis)
|
|
36
38
|
|
|
37
39
|
export async function createWorkersApp() {
|
|
38
40
|
// Avoid EPIPE when stdout/stderr are closed by terminal (e.g., Ctrl+C piping)
|
|
@@ -139,28 +141,33 @@ const module$1 = defineNuxtModule({
|
|
|
139
141
|
// Default configuration options of the Nuxt module
|
|
140
142
|
defaults: {
|
|
141
143
|
redis: {
|
|
142
|
-
host: process.env.
|
|
143
|
-
port: Number(process.env.
|
|
144
|
-
password: process.env.
|
|
145
|
-
username: process.env.
|
|
144
|
+
host: process.env.REDIS_HOST ?? "127.0.0.1",
|
|
145
|
+
port: Number(process.env.REDIS_PORT ?? 6379),
|
|
146
|
+
password: process.env.REDIS_PASSWORD ?? "",
|
|
147
|
+
username: process.env.REDIS_USERNAME ?? void 0,
|
|
146
148
|
// needs Redis >= 6
|
|
147
|
-
db: Number(process.env.
|
|
149
|
+
db: Number(process.env.REDIS_DB ?? 0),
|
|
148
150
|
// Defaults to 0 on ioredis
|
|
149
|
-
lazyConnect: process.env.
|
|
150
|
-
connectTimeout: process.env.
|
|
151
|
-
url: process.env.
|
|
151
|
+
lazyConnect: process.env.REDIS_LAZY_CONNECT === "true" ? true : void 0,
|
|
152
|
+
connectTimeout: process.env.REDIS_CONNECT_TIMEOUT ? Number(process.env.REDIS_CONNECT_TIMEOUT) : void 0,
|
|
153
|
+
url: process.env.REDIS_URL ?? void 0
|
|
152
154
|
},
|
|
153
155
|
workers: "server/workers"
|
|
154
156
|
},
|
|
155
157
|
async setup(_options, nuxt) {
|
|
156
158
|
const { resolve } = createResolver(import.meta.url);
|
|
157
|
-
const
|
|
159
|
+
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
160
|
+
runtimeConfig.redis = {
|
|
161
|
+
..._options.redis ?? {},
|
|
162
|
+
...runtimeConfig.redis ?? {}
|
|
163
|
+
};
|
|
158
164
|
const nitroPlugin = `
|
|
159
|
-
import { defineNitroPlugin } from '#imports'
|
|
165
|
+
import { defineNitroPlugin, useRuntimeConfig } from '#imports'
|
|
160
166
|
import { $workers } from '#processor-utils'
|
|
161
167
|
|
|
162
168
|
export default defineNitroPlugin(() => {
|
|
163
|
-
|
|
169
|
+
const { redis } = useRuntimeConfig()
|
|
170
|
+
$workers().setConnection(process.env.REDIS_URL ? { ...redis, url: process.env.REDIS_URL } : redis)
|
|
164
171
|
})
|
|
165
172
|
`;
|
|
166
173
|
const tpl = addTemplate({
|
|
@@ -210,7 +217,7 @@ declare module '#bullmq' {
|
|
|
210
217
|
virtualCode = "";
|
|
211
218
|
return;
|
|
212
219
|
}
|
|
213
|
-
virtualCode = generateWorkersEntryContent(workerFiles
|
|
220
|
+
virtualCode = generateWorkersEntryContent(workerFiles);
|
|
214
221
|
for (const id of workerFiles) {
|
|
215
222
|
this.addWatchFile(id);
|
|
216
223
|
}
|
|
@@ -8,8 +8,8 @@ export declare function $workers(): {
|
|
|
8
8
|
} & {
|
|
9
9
|
path: string;
|
|
10
10
|
}> & {
|
|
11
|
-
disconnectTimeout?: number;
|
|
12
|
-
tls?: import("node:tls").ConnectionOptions;
|
|
11
|
+
disconnectTimeout?: number | undefined;
|
|
12
|
+
tls?: import("node:tls").ConnectionOptions | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
url?: string;
|
|
15
15
|
})) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-processor",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Nuxt Processor",
|
|
5
5
|
"repository": "https://github.com/aidanhibbard/nuxt-processor",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,10 +35,12 @@
|
|
|
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
|
-
"release": "npm run
|
|
38
|
+
"release": "npm run ci && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
39
39
|
"lint": "eslint .",
|
|
40
40
|
"lint:fix": "eslint . --fix",
|
|
41
|
+
"typecheck": "nuxi typecheck",
|
|
41
42
|
"test": "vitest run",
|
|
43
|
+
"ci": "npm run lint && npm run typecheck && npm run test",
|
|
42
44
|
"test:coverage": "vitest run --coverage",
|
|
43
45
|
"test:watch": "vitest watch",
|
|
44
46
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
@@ -47,30 +49,31 @@
|
|
|
47
49
|
"vp:preview": "vitepress preview docs"
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
|
-
"@nuxt/kit": "^4.
|
|
51
|
-
"bullmq": "^5.
|
|
52
|
-
"citty": "^0.2.
|
|
52
|
+
"@nuxt/kit": "^4.4.5",
|
|
53
|
+
"bullmq": "^5.76.7",
|
|
54
|
+
"citty": "^0.2.2",
|
|
53
55
|
"consola": "^3.4.2",
|
|
54
56
|
"fast-glob": "^3.3.3",
|
|
55
|
-
"ioredis": "^5.
|
|
57
|
+
"ioredis": "^5.10.1",
|
|
56
58
|
"pathe": "^2.0.3"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
|
-
"@nuxt/devtools": "^
|
|
60
|
-
"@nuxt/eslint": "^1.
|
|
61
|
-
"@nuxt/eslint-config": "^1.
|
|
61
|
+
"@nuxt/devtools": "^4.0.0-alpha.4",
|
|
62
|
+
"@nuxt/eslint": "^1.15.2",
|
|
63
|
+
"@nuxt/eslint-config": "^1.15.2",
|
|
62
64
|
"@nuxt/module-builder": "^1.0.2",
|
|
63
|
-
"@nuxt/schema": "^4.
|
|
64
|
-
"@nuxt/test-utils": "^
|
|
65
|
+
"@nuxt/schema": "^4.4.5",
|
|
66
|
+
"@nuxt/test-utils": "^4.0.3",
|
|
65
67
|
"@types/node": "latest",
|
|
66
|
-
"@vitest/coverage-v8": "^
|
|
68
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
67
69
|
"changelogen": "^0.6.2",
|
|
68
|
-
"eslint": "^
|
|
69
|
-
"happy-dom": "^20.0
|
|
70
|
-
"nuxt": "^4.
|
|
70
|
+
"eslint": "^10.3.0",
|
|
71
|
+
"happy-dom": "^20.9.0",
|
|
72
|
+
"nuxt": "^4.4.5",
|
|
71
73
|
"typescript": "~5.9.2",
|
|
74
|
+
"unbuild": "^3.6.1",
|
|
72
75
|
"vitepress": "^2.0.0-alpha.12",
|
|
73
|
-
"vitest": "^
|
|
74
|
-
"vue-tsc": "^3.
|
|
76
|
+
"vitest": "^4.1.5",
|
|
77
|
+
"vue-tsc": "^3.2.8"
|
|
75
78
|
}
|
|
76
79
|
}
|