@wervt/nuxt 0.2.9 → 0.2.11
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/dist/dev.js +1 -1
- package/dist/module.js +14 -2
- package/dist/node_modules/.pnpm/nitro@3.0.260903-beta/node_modules/nitro/dist/runtime/internal/task.js +1 -1
- package/dist/runtime/app/plugins/update.client.js +2 -3
- package/dist/runtime/server/boot.d.ts +1 -1
- package/dist/runtime/server/task-handlers.d.ts +1 -1
- package/dist/runtime/server/task-run-nitro2.d.ts +1 -1
- package/dist/runtime/server/task-run-nitro3.d.ts +1 -1
- package/dist/runtime/server/tool-handlers.d.ts +3 -3
- package/dist/runtime/server/validate.d.ts +1 -1
- package/package.json +2 -2
- /package/dist/node_modules/.pnpm/{h3@2.0.1_crossws@0.4.12_srvx@1.0.5__ocache@0.3.0 → h3@2.0.2_crossws@0.4.15_srvx@1.0.5__ocache@0.3.0}/node_modules/h3/dist/response.js +0 -0
package/dist/dev.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createStorage } from "./storage.js";
|
|
2
2
|
import { appDatabaseUrl, dbRole, provisionDatabase, storageCredentials } from "./provision.js";
|
|
3
3
|
import { useLogger } from "nuxt/kit";
|
|
4
|
+
import { existsSync, watch } from "node:fs";
|
|
4
5
|
import { readFile } from "node:fs/promises";
|
|
5
6
|
import { join } from "node:path";
|
|
6
|
-
import { existsSync, watch } from "node:fs";
|
|
7
7
|
//#region src/dev.ts
|
|
8
8
|
const DEFAULTS = {
|
|
9
9
|
adminUrl: "postgres://postgres:postgres@localhost:5432/wervt",
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveAppName, setupDev } from "./dev.js";
|
|
2
|
-
import { addImports, addPlugin, addServerHandler, addServerPlugin, addServerTemplate, createResolver, defineNuxtModule, getNuxtVersion, hasNuxtModule, installModule } from "nuxt/kit";
|
|
2
|
+
import { addImports, addPlugin, addServerHandler, addServerPlugin, addServerTemplate, createResolver, defineNuxtModule, getNuxtVersion, hasNuxtModule, installModule, useLogger } from "nuxt/kit";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
3
4
|
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
4
5
|
import { builtinModules, createRequire } from "node:module";
|
|
5
6
|
import { dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
@@ -187,6 +188,9 @@ var module_default = defineNuxtModule({
|
|
|
187
188
|
const file = relative(toolsDir, resolve(nuxt.options.srcDir, path));
|
|
188
189
|
if ((event === "add" || event === "unlink") && !file.startsWith("..")) await nuxt.callHook("restart");
|
|
189
190
|
});
|
|
191
|
+
if (nuxt.options.dev && nitroMajor >= 3) {
|
|
192
|
+
if (!hasPackage(nuxt.options.rootDir, "vue")) logger.warn("`vue` is not a dependency of this app, so `nuxt dev` fails with \"module is not defined\". Run `pnpm add vue`.");
|
|
193
|
+
}
|
|
190
194
|
if (nuxt.options.dev && !nuxt.options._prepare) {
|
|
191
195
|
const app = await resolveAppName(nuxt.options.rootDir, options.app);
|
|
192
196
|
await setupDev(nuxt, app, options.dev ?? {}, { storage: useAblage });
|
|
@@ -258,7 +262,7 @@ async function findTools(dir) {
|
|
|
258
262
|
if (!TOOL_EXTENSIONS.has(ext) || file.endsWith(`.d${ext}`)) continue;
|
|
259
263
|
const name = file.slice(0, -ext.length).split(sep).join(".");
|
|
260
264
|
if (!TOOL_NAME_RE.test(name)) {
|
|
261
|
-
|
|
265
|
+
logger.warn(`Skipping server/tools/${file}: tool names can only use A-Z, 0-9, _ and -.`);
|
|
262
266
|
continue;
|
|
263
267
|
}
|
|
264
268
|
tools.push({
|
|
@@ -268,6 +272,14 @@ async function findTools(dir) {
|
|
|
268
272
|
}
|
|
269
273
|
return tools;
|
|
270
274
|
}
|
|
275
|
+
const logger = useLogger("wervt");
|
|
276
|
+
/** Whether `name` is in a `node_modules` folder Node would look in from `dir`. */
|
|
277
|
+
function hasPackage(dir, name) {
|
|
278
|
+
for (let current = dir;; current = dirname(current)) {
|
|
279
|
+
if (existsSync(join(current, "node_modules", name, "package.json"))) return true;
|
|
280
|
+
if (dirname(current) === current) return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
271
283
|
/** evlog's Nitro 2 plugin and error handler, as evlog/nuxt resolves them. */
|
|
272
284
|
const EVLOG_NITRO2_RE = /([\\/]evlog[\\/]dist[\\/]nitro)[\\/](plugin|errorHandler)(\.mjs)?$/;
|
|
273
285
|
const BUILTINS = new Set(builtinModules.filter((name) => !name.startsWith("_")));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTTPError } from "../../../../../../h3@2.0.
|
|
1
|
+
import { HTTPError } from "../../../../../../h3@2.0.2_crossws@0.4.15_srvx@1.0.5__ocache@0.3.0/node_modules/h3/dist/response.js";
|
|
2
2
|
import { tasks } from "#nitro/virtual/tasks";
|
|
3
3
|
//#region ../../node_modules/.pnpm/nitro@3.0.260903-beta/node_modules/nitro/dist/runtime/internal/task.mjs
|
|
4
4
|
const __runningTasks__ = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useUpdateAvailable, useWervtUpdate } from "../useWervtUpdate.js";
|
|
2
|
-
import { defineNuxtPlugin,
|
|
2
|
+
import { defineNuxtPlugin, onNuxtReady, useRuntimeConfig } from "#app";
|
|
3
3
|
//#region src/runtime/app/plugins/update.client.ts
|
|
4
4
|
const INTERVAL_MS = 6e4;
|
|
5
5
|
/** Focus and visibility changes come in bursts; one check covers them. */
|
|
@@ -16,14 +16,13 @@ var update_client_default = defineNuxtPlugin({
|
|
|
16
16
|
if (available.value || document.hidden || Date.now() - last < MIN_GAP_MS) return;
|
|
17
17
|
last = Date.now();
|
|
18
18
|
try {
|
|
19
|
-
const current = await getAppManifest();
|
|
20
19
|
const res = await fetch(`${url}?${last}`, {
|
|
21
20
|
cache: "no-store",
|
|
22
21
|
signal: AbortSignal.timeout(1e4)
|
|
23
22
|
});
|
|
24
23
|
if (!res.ok) return;
|
|
25
24
|
const latest = await res.json();
|
|
26
|
-
if (!latest.id || latest.id ===
|
|
25
|
+
if (!latest.id || latest.id === config.app.buildId) return;
|
|
27
26
|
available.value = true;
|
|
28
27
|
await nuxtApp.callHook("app:manifest:update", latest);
|
|
29
28
|
if (mode === "banner") showBanner(useWervtUpdate().reload);
|
|
@@ -15,8 +15,8 @@ export declare function taskRunHandler(runTask: RunTask): import("nuxt/server").
|
|
|
15
15
|
error: string;
|
|
16
16
|
result?: undefined;
|
|
17
17
|
} | {
|
|
18
|
-
result: {} | null;
|
|
19
18
|
error?: undefined;
|
|
19
|
+
result: {} | null;
|
|
20
20
|
}>>;
|
|
21
21
|
/** `GET /_wervt/tasks`: the tasks with the descriptions from `defineTask({ meta })`. */
|
|
22
22
|
export declare function taskListHandler(tasks: Registry): import("nuxt/server").EventHandler<Promise<{
|
|
@@ -17,16 +17,16 @@ export declare const runTool: import("nuxt/server").EventHandler<Promise<{
|
|
|
17
17
|
} | {
|
|
18
18
|
error: string;
|
|
19
19
|
issues: {
|
|
20
|
-
readonly root?: [string, ...string[]]
|
|
20
|
+
readonly root?: [string, ...string[]];
|
|
21
21
|
readonly nested?: {
|
|
22
22
|
readonly [x: string]: [string, ...string[]] | undefined;
|
|
23
23
|
} | undefined;
|
|
24
|
-
readonly other?: [string, ...string[]]
|
|
24
|
+
readonly other?: [string, ...string[]];
|
|
25
25
|
};
|
|
26
26
|
result?: undefined;
|
|
27
27
|
} | {
|
|
28
|
-
result: {} | null;
|
|
29
28
|
error?: undefined;
|
|
30
29
|
issues?: undefined;
|
|
30
|
+
result: {} | null;
|
|
31
31
|
}>>;
|
|
32
32
|
//#endregion
|
|
@@ -29,7 +29,7 @@ export declare const useSafeValidatedParams: <T extends Input>(event: RequestEve
|
|
|
29
29
|
/** Schemas for values that arrive as strings (query, route params, form fields). */
|
|
30
30
|
export declare const vh: {
|
|
31
31
|
/** `'true'` / `'false'` → boolean. */
|
|
32
|
-
boolAsString: v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false"], undefined>, v.TransformAction<"
|
|
32
|
+
boolAsString: v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false"], undefined>, v.TransformAction<"false" | "true", boolean>]>;
|
|
33
33
|
/** HTML checkbox: `'on'` or missing → boolean. */
|
|
34
34
|
checkboxAsString: v.SchemaWithPipe<readonly [v.OptionalSchema<v.LiteralSchema<"on", undefined>, undefined>, v.TransformAction<"on" | undefined, boolean>]>;
|
|
35
35
|
/** Integer string → number. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wervt/nuxt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Nuxt module for apps hosted on wervt: database, live data and runtime setup.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"drizzle",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@electric-sql/client": "^1.5.28",
|
|
42
42
|
"@valibot/to-json-schema": "^1.8.0",
|
|
43
43
|
"aws4fetch": "^1.0.20",
|
|
44
|
-
"evlog": "^2.30.
|
|
44
|
+
"evlog": "^2.30.1",
|
|
45
45
|
"postgres": "^3.4.9",
|
|
46
46
|
"valibot": "^1.5.0"
|
|
47
47
|
},
|