@karibsen/eponyme 0.8.11 → 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 +4 -1
- package/dist/module.mjs +40 -24
- package/dist/runtime/server/plugins/eponyme-sync.js +1 -2
- package/dist/runtime/server/services/eponyme-auth-service.js +1 -3
- package/dist/runtime/server/services/eponyme-service.js +1 -1
- package/dist/runtime/server/utils/eponyme-cache.js +2 -2
- package/dist/runtime/types/nuxt.d.ts +12 -0
- package/package.json +2 -1
package/dist/module.json
CHANGED
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 '
|
|
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",
|
|
@@ -122,28 +142,20 @@ Note that '~/' points at ${nuxt.options.srcDir}, so a server module needs '~~/'.
|
|
|
122
142
|
);
|
|
123
143
|
}
|
|
124
144
|
addImports([
|
|
125
|
-
{ name: "defineEponymeConfig", from: resolver.resolve("./
|
|
126
|
-
{ name: "collection", from: resolver.resolve("./
|
|
127
|
-
{ name: "form", from: resolver.resolve("./
|
|
128
|
-
{ name: "defineEponymeVariables", from: resolver.resolve("./
|
|
145
|
+
{ name: "defineEponymeConfig", from: resolver.resolve("./eponyme") },
|
|
146
|
+
{ name: "collection", from: resolver.resolve("./eponyme") },
|
|
147
|
+
{ name: "form", from: resolver.resolve("./eponyme") },
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
plugins
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
14
|
-
const cdn = Math.max(0, Math.trunc(config
|
|
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.
|
|
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",
|