@karibsen/eponyme 0.8.12 → 0.8.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.
package/dist/module.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@karibsen/eponyme",
3
3
  "configKey": "eponyme",
4
- "version": "0.8.12",
4
+ "compatibility": {
5
+ "nuxt": ">=4.0.0"
6
+ },
7
+ "version": "0.8.13",
5
8
  "builder": {
6
9
  "@nuxt/module-builder": "1.0.2",
7
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,10 +1,27 @@
1
- import { defineNuxtModule, useLogger, createResolver, findPath, addImports, addImportsDir, addServerImports, addRouteMiddleware, addTypeTemplate, addServerHandler, addServerPlugin, hasNuxtModule, hasNuxtModuleCompatibility, getNuxtModuleVersion } from '@nuxt/kit';
1
+ import { defineNuxtModule, useLogger, createResolver, findPath, addImports, addImportsDir, addServerImports, addRouteMiddleware, extendViteConfig, addTypeTemplate, addServerHandler, addServerPlugin, hasNuxtModule, hasNuxtModuleCompatibility, getNuxtModuleVersion } from '@nuxt/kit';
2
2
  import pc from 'picocolors';
3
3
  import tailwindcss from '@tailwindcss/vite';
4
- import { resolve } from 'node:path';
4
+ import { resolve } from 'pathe';
5
5
  import { tagPreviewPathRoutes } from '../dist/runtime/utils/cache-tags.js';
6
6
 
7
7
  const MINIMUM_NUXT_UI = "4.10.0";
8
+ const CLIENT_DEPENDENCIES = [
9
+ "slugify",
10
+ "sortablejs",
11
+ "@vueuse/core",
12
+ "@vueuse/integrations/useSortable",
13
+ "@tanstack/vue-table",
14
+ "fuse.js",
15
+ "zod",
16
+ "libphonenumber-js/min",
17
+ "@tiptap/vue-3",
18
+ "@tiptap/starter-kit",
19
+ "@tiptap/extension-image",
20
+ "@tiptap/extension-placeholder",
21
+ "@tiptap/pm/model",
22
+ "@tiptap/pm/state",
23
+ "@tiptap/pm/view"
24
+ ];
8
25
  async function warnOnIncompatibleNuxtUi(nuxt, logger) {
9
26
  if (!hasNuxtModule("@nuxt/ui", nuxt)) return;
10
27
  if (await hasNuxtModuleCompatibility("@nuxt/ui", `>=${MINIMUM_NUXT_UI}`, nuxt)) return;
@@ -19,7 +36,10 @@ async function warnOnIncompatibleNuxtUi(nuxt, logger) {
19
36
  const module$1 = defineNuxtModule({
20
37
  meta: {
21
38
  name: "@karibsen/eponyme",
22
- configKey: "eponyme"
39
+ configKey: "eponyme",
40
+ compatibility: {
41
+ nuxt: ">=4.0.0"
42
+ }
23
43
  },
24
44
  defaults: {
25
45
  dashboardPath: "/__eponyme",
@@ -128,22 +148,14 @@ Note that '~/' points at ${nuxt.options.srcDir}, so a server module needs '~~/'.
128
148
  { name: "defineEponymeVariables", from: resolver.resolve("./eponyme") },
129
149
  { name: "field", from: resolver.resolve("./runtime/fields") },
130
150
  { name: "today", from: resolver.resolve("./runtime/fields") },
131
- // What a page needs to render a `field.mediaPlayer()` value: the embed address is
132
- // derived from the stored URL rather than stored next to it.
133
151
  { name: "eponymeMediaEmbedUrl", from: resolver.resolve("./runtime/utils/media-player") },
134
152
  { name: "eponymeMediaThumbnailUrl", from: resolver.resolve("./runtime/utils/media-player") }
135
153
  ]);
136
154
  addImportsDir(resolver.resolve("./runtime/composables"));
137
155
  addServerImports([
138
156
  { name: "getEponymeSitemapEntries", from: resolver.resolve("./runtime/server/utils/eponyme-sitemap") },
139
- // The backfill for the filterable index, which a migration cannot do on its own:
140
- // reading a value out of the JSONB envelope needs the configured schema.
141
157
  { name: "reindexEponymeEntries", from: resolver.resolve("./runtime/server/utils/eponyme-reindex") },
142
- // A `custom` form posts to the host application's own route, so this is what
143
- // keeps server-side validation as the security boundary.
144
158
  { name: "validateEponymeForm", from: resolver.resolve("./runtime/server/utils/eponyme-form") },
145
- // The tags a CDN purge has to invalidate when an entry changes, matching exactly what
146
- // the cached responses were tagged with.
147
159
  { name: "getEponymeCacheTags", from: resolver.resolve("./runtime/server/utils/eponyme-cache") }
148
160
  ]);
149
161
  addRouteMiddleware({
@@ -155,16 +167,20 @@ Note that '~/' points at ${nuxt.options.srcDir}, so a server module needs '~~/'.
155
167
  path: resolver.resolve("./runtime/middleware/eponyme-owner")
156
168
  });
157
169
  nuxt.options.build.transpile.push("reka-ui");
158
- nuxt.options.vite.optimizeDeps ??= {};
159
- nuxt.options.vite.optimizeDeps.include = [
160
- ...nuxt.options.vite.optimizeDeps.include ?? [],
161
- "slugify",
162
- "sortablejs"
163
- ];
170
+ extendViteConfig((config) => {
171
+ config.optimizeDeps ??= {};
172
+ config.optimizeDeps.include ??= [];
173
+ for (const id of CLIENT_DEPENDENCIES) {
174
+ const specifier = `@karibsen/eponyme > ${id}`;
175
+ if (!config.optimizeDeps.include.includes(specifier)) {
176
+ config.optimizeDeps.include.push(specifier);
177
+ }
178
+ }
179
+ });
164
180
  nuxt.options.css.push(resolver.resolve("./runtime/assets/dashboard.css"));
165
- nuxt.hook("vite:extendConfig", (viteConfig) => {
166
- const plugins = viteConfig.plugins;
167
- plugins?.push(tailwindcss());
181
+ extendViteConfig((config) => {
182
+ config.plugins ??= [];
183
+ config.plugins.push(tailwindcss());
168
184
  });
169
185
  const configPath = await findPath(resolve(nuxt.options.rootDir, "eponyme.config.ts"));
170
186
  if (!configPath) {
@@ -11,8 +11,7 @@ export default defineNitroPlugin(async () => {
11
11
  );
12
12
  }
13
13
  await useEponymeService().syncAll();
14
- const content = useRuntimeConfig().eponymeContent;
15
- if (content?.autoReindex === false) return;
14
+ if (useRuntimeConfig().eponymeContent.autoReindex === false) return;
16
15
  try {
17
16
  await useEponymeService().syncIndexState();
18
17
  } catch (error) {
@@ -4,11 +4,9 @@ import { EponymeAuthService } from "./eponyme-auth-store.js";
4
4
  let authService;
5
5
  export function useEponymeAuthService() {
6
6
  if (!authService) {
7
- const config = useRuntimeConfig();
8
- const authConfig = config.eponymeAuth;
9
7
  authService = new EponymeAuthService(
10
8
  prisma,
11
- authConfig?.sessionDurationDays ?? 7
9
+ useRuntimeConfig().eponymeAuth.sessionDurationDays
12
10
  );
13
11
  }
14
12
  return authService;
@@ -8,7 +8,7 @@ export function useEponymeService() {
8
8
  if (!eponymeService) {
9
9
  const contentConfig = useRuntimeConfig().eponymeContent;
10
10
  eponymeService = new EponymeService(eponymeConfig, prisma, {
11
- cacheSeconds: contentConfig?.cacheSeconds ?? 5
11
+ cacheSeconds: contentConfig.cacheSeconds
12
12
  });
13
13
  }
14
14
  return eponymeService;
@@ -10,8 +10,8 @@ function setCacheTags(event, tags) {
10
10
  }
11
11
  export function setEponymePublicCache(event, tags = []) {
12
12
  const config = useRuntimeConfig().eponymeContent;
13
- const browser = Math.max(0, Math.trunc(config?.browserCacheSeconds ?? 30));
14
- const cdn = Math.max(0, Math.trunc(config?.cdnCacheSeconds ?? 300));
13
+ const browser = Math.max(0, Math.trunc(config.browserCacheSeconds));
14
+ const cdn = Math.max(0, Math.trunc(config.cdnCacheSeconds));
15
15
  if (!browser && !cdn) {
16
16
  setResponseHeader(event, "Cache-Control", "no-cache");
17
17
  return;
@@ -8,6 +8,18 @@ declare module '@nuxt/schema' {
8
8
  interface NuxtOptions {
9
9
  eponyme: ModuleOptions
10
10
  }
11
+
12
+ interface RuntimeConfig {
13
+ eponymeAuth: {
14
+ sessionDurationDays: number
15
+ }
16
+ eponymeContent: {
17
+ cacheSeconds: number
18
+ autoReindex: boolean
19
+ browserCacheSeconds: number
20
+ cdnCacheSeconds: number
21
+ }
22
+ }
11
23
  }
12
24
 
13
25
  declare module 'nitropack/types' {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karibsen/eponyme",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "description": "A lightweight, type-safe content manager for Nuxt.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -74,6 +74,7 @@
74
74
  "@vueuse/integrations": "^14.3.0",
75
75
  "fuse.js": "^7.5.0",
76
76
  "libphonenumber-js": "^1.13.9",
77
+ "pathe": "^2.0.3",
77
78
  "picocolors": "^1.1.1",
78
79
  "reka-ui": "^2.10.1",
79
80
  "slugify": "^1.6.9",