@wervt/nuxt 0.3.11 → 0.3.13

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.
@@ -0,0 +1,34 @@
1
+ // src/content.ts
2
+ /**
3
+ * Nuxt Content on wervt: SQLite is a native module (or `node:sqlite`, newer than the isolate's
4
+ * Deno), so production builds keep content in the app's Postgres. `{{DATABASE_URL}}` is expanded
5
+ * at runtime (Nitro's envExpansion).
6
+ */
7
+ const CONTENT_DATABASE = {
8
+ type: "postgres",
9
+ url: "{{DATABASE_URL}}"
10
+ };
11
+ /**
12
+ * Our options for @nuxt/content, as a module dependency: applied before Content's setup, which
13
+ * picks its database adapter then, whatever the order of the modules. Setting them in our own
14
+ * setup came too late when Content came first, e.g. from a layer like Docus. An override, not a
15
+ * default: SQLite can't work in the isolate, whatever the app sets.
16
+ */
17
+ function contentDependency() {
18
+ return {
19
+ optional: true,
20
+ overrides: { database: CONTENT_DATABASE }
21
+ };
22
+ }
23
+ /**
24
+ * The bundle's manifest (wervt-bundle.json). An app with Nuxt Content needs a database even
25
+ * without Drizzle migrations, which are how the control plane otherwise knows it wants one.
26
+ */
27
+ function nuxtBundleManifest({ content }) {
28
+ return {
29
+ version: 2,
30
+ framework: "nuxt",
31
+ ...content ? { database: true } : {}
32
+ };
33
+ }
34
+ export { CONTENT_DATABASE, contentDependency, nuxtBundleManifest };
package/dist/module.js CHANGED
@@ -2,6 +2,7 @@ import { setupStudioPreview } from "./studio-preview.js";
2
2
  import { PROCESS_ENV_TYPES } from "./env-types.js";
3
3
  import { dependencyNames, ogImageDefaults, ogImageWarning } from "./og-image.js";
4
4
  import { iconDefaults, iconSources, iconWarning } from "./icons.js";
5
+ import { CONTENT_DATABASE, contentDependency, nuxtBundleManifest } from "./content.js";
5
6
  import { findRouteTools } from "./route-tools.js";
6
7
  import { localFiles, previewManifest } from "./preview.js";
7
8
  import { LOCALES } from "./runtime/shared/i18n.js";
@@ -17,10 +18,6 @@ import { dirname, extname, join, relative, resolve, sep } from "node:path";
17
18
  import evlog from "evlog/nuxt";
18
19
  import { DENO_INJECT, denoPlugins } from "@wervt/nitro/build";
19
20
  // src/module.ts
20
- const CONTENT_DATABASE = {
21
- type: "postgres",
22
- url: "{{DATABASE_URL}}"
23
- };
24
21
  var module_default = defineNuxtModule({
25
22
  meta: {
26
23
  name: "@wervt/nuxt",
@@ -36,7 +33,8 @@ var module_default = defineNuxtModule({
36
33
  "nuxt-og-image": {
37
34
  optional: true,
38
35
  defaults: ogImageDefaults()
39
- }
36
+ },
37
+ "@nuxt/content": contentDependency()
40
38
  };
41
39
  },
42
40
  async setup(options, nuxt) {
@@ -72,16 +70,10 @@ var module_default = defineNuxtModule({
72
70
  }
73
71
  }
74
72
  addServerPlugin(resolver.resolve("./runtime/server/agent-token-plugin"));
75
- const useContentDatabase = !nuxt.options.dev && hasNuxtModule("@nuxt/content", nuxt);
76
- if (useContentDatabase) {
77
- const options = nuxt.options;
78
- options.content = {
79
- ...options.content,
80
- database: CONTENT_DATABASE
81
- };
82
- }
73
+ const usesContent = () => !nuxt.options.dev && hasNuxtModule("@nuxt/content", nuxt);
83
74
  nuxt.hook("nitro:config", (config) => {
84
75
  const options = config;
76
+ if (!nuxt.options.dev) options.serveStatic = false;
85
77
  options.externals = {
86
78
  ...options.externals,
87
79
  inline: [
@@ -98,7 +90,7 @@ var module_default = defineNuxtModule({
98
90
  exclude: [exclude].flat().map((pattern) => typeof pattern === "string" ? pattern : exceptRuntime(pattern))
99
91
  }
100
92
  };
101
- if (useContentDatabase) {
93
+ if (usesContent()) {
102
94
  options.experimental = {
103
95
  ...options.experimental,
104
96
  envExpansion: true
@@ -194,10 +186,8 @@ var module_default = defineNuxtModule({
194
186
  };
195
187
  await mkdir(nitroOptions.output.serverDir, { recursive: true });
196
188
  await writeFile(join(nitroOptions.output.serverDir, "wervt-tasks.json"), `${JSON.stringify(manifest, null, 2)}\n`);
197
- await writeFile(join(dirname(nitroOptions.output.serverDir), BUNDLE_MANIFEST), `${JSON.stringify({
198
- version: 2,
199
- framework: "nuxt"
200
- }, null, 2)}\n`);
189
+ const bundle = nuxtBundleManifest({ content: usesContent() });
190
+ await writeFile(join(dirname(nitroOptions.output.serverDir), BUNDLE_MANIFEST), `${JSON.stringify(bundle, null, 2)}\n`);
201
191
  });
202
192
  });
203
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/nuxt",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Nuxt module for apps hosted on wervt: database, live data, MCP and runtime setup.",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -53,10 +53,10 @@
53
53
  "dependencies": {
54
54
  "@electric-sql/client": "^1.5.28",
55
55
  "@valibot/to-json-schema": "^1.8.0",
56
- "@wervt/client": "^0.0.2",
57
- "@wervt/core": "^0.0.2",
58
- "@wervt/nitro": "^0.0.2",
59
- "@wervt/platform": "^0.0.2",
56
+ "@wervt/client": "^0.0.3",
57
+ "@wervt/core": "^0.0.3",
58
+ "@wervt/nitro": "^0.0.4",
59
+ "@wervt/platform": "^0.0.3",
60
60
  "aws4fetch": "^1.0.20",
61
61
  "evlog": "^2.34.0",
62
62
  "h3-mcp": "0.2.0",