@wervt/nuxt 0.2.6 → 0.2.8

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.
Files changed (2) hide show
  1. package/dist/module.js +22 -1
  2. package/package.json +1 -1
package/dist/module.js CHANGED
@@ -18,6 +18,7 @@ var module_default = defineNuxtModule({
18
18
  const resolver = createResolver(import.meta.url);
19
19
  const nitro = nuxt.options.nitro;
20
20
  if (!nuxt.options.dev) nitro.preset ||= "deno-server";
21
+ const nitroMajor = Number.parseInt(getNuxtVersion(nuxt), 10) >= 5 ? 3 : 2;
21
22
  if (!hasNuxtModule("evlog/nuxt", nuxt)) {
22
23
  const app = await resolveAppName(nuxt.options.rootDir, options.app);
23
24
  const config = nuxt.options;
@@ -33,6 +34,17 @@ var module_default = defineNuxtModule({
33
34
  ...config.evlog
34
35
  };
35
36
  await installModule(evlog, void 0, nuxt);
37
+ if (nitroMajor >= 3) {
38
+ const v3 = (path) => path.replace(EVLOG_NITRO2_RE, "$1/v3/$2");
39
+ const serverPlugins = nuxt.options._serverPlugins;
40
+ for (const entry of serverPlugins ?? []) if (typeof entry.plugin === "string") entry.plugin = v3(entry.plugin);
41
+ nuxt.hook("nitro:config", (config) => {
42
+ const options = config;
43
+ options.plugins = options.plugins?.map(v3);
44
+ const handler = options.errorHandler;
45
+ if (handler) options.errorHandler = Array.isArray(handler) ? handler.map(v3) : v3(handler);
46
+ });
47
+ }
36
48
  }
37
49
  const useContentDatabase = !nuxt.options.dev && hasNuxtModule("@nuxt/content", nuxt);
38
50
  if (useContentDatabase) {
@@ -81,6 +93,13 @@ var module_default = defineNuxtModule({
81
93
  clearImmediate: ["node:timers", "clearImmediate"]
82
94
  } }];
83
95
  });
96
+ if (nitroMajor >= 3 && !nuxt.options.dev) nuxt.hook("vite:extendConfig", (config, { isServer }) => {
97
+ const ssr = config.environments?.ssr;
98
+ if (isServer && ssr) ssr.resolve = {
99
+ ...ssr.resolve,
100
+ noExternal: true
101
+ };
102
+ });
84
103
  const useAblage = hasNuxtModule("ablage", nuxt);
85
104
  if (useAblage) {
86
105
  const options = nuxt.options;
@@ -108,7 +127,7 @@ var module_default = defineNuxtModule({
108
127
  ...nitro.experimental,
109
128
  tasks: true
110
129
  };
111
- const nitroVersion = Number.parseInt(getNuxtVersion(nuxt), 10) >= 5 ? "nitro3" : "nitro2";
130
+ const nitroVersion = nitroMajor >= 3 ? "nitro3" : "nitro2";
112
131
  addServerHandler({
113
132
  route: "/_wervt/tasks/**",
114
133
  method: "post",
@@ -180,6 +199,8 @@ var module_default = defineNuxtModule({
180
199
  ]);
181
200
  }
182
201
  });
202
+ /** evlog's Nitro 2 plugin and error handler, as evlog/nuxt resolves them. */
203
+ const EVLOG_NITRO2_RE = /([\\/]evlog[\\/]dist[\\/]nitro)[\\/](plugin|errorHandler)(\.mjs)?$/;
183
204
  const BUILTINS = new Set(builtinModules.filter((name) => !name.startsWith("_")));
184
205
  /** Rewrites `from 'os'` / `import('os')` to `node:os` in the output chunks. */
185
206
  function prefixNodeBuiltins() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/nuxt",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Nuxt module for apps hosted on wervt: database, live data and runtime setup.",
5
5
  "keywords": [
6
6
  "drizzle",