@hollware/nuxt 1.10.0 → 1.11.0
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/README.md +20 -3
- package/dist/index.mjs +8 -0
- package/dist/runtime/composables.d.mts +2 -1
- package/dist/runtime/embed-client.d.mts +2 -0
- package/dist/runtime/embed-client.d.ts +1 -0
- package/dist/runtime/embed-client.mjs +47 -0
- package/dist/runtime/embed.d.mts +2 -0
- package/dist/runtime/embed.d.ts +1 -0
- package/dist/runtime/embed.mjs +14 -0
- package/dist/runtime/live.d.mts +4 -0
- package/dist/runtime/live.d.ts +1 -0
- package/dist/runtime/live.mjs +24 -0
- package/dist/runtime/page-fields.d.mts +1 -0
- package/dist/runtime/page-fields.d.ts +1 -0
- package/dist/runtime/page-fields.mjs +22 -0
- package/dist/runtime/server/answer.d.mts +2 -1
- package/dist/runtime/server/answer.mjs +1 -19
- package/dist/runtime/server/preview.mjs +35 -3
- package/dist/runtime/server/routes/entries.mjs +2 -1
- package/dist/runtime/server/routes/entry.mjs +3 -2
- package/dist/runtime/server/routes/page.mjs +3 -2
- package/dist/runtime/server/routes/site.d.mts +1 -0
- package/dist/runtime/server/routes/translations.mjs +2 -1
- package/dist/runtime/tags.d.mts +5 -0
- package/dist/runtime/tags.mjs +39 -3
- package/dist/runtime/types.d.mts +2 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ to leave it out.
|
|
|
63
63
|
|
|
64
64
|
## Previews
|
|
65
65
|
|
|
66
|
-
"
|
|
66
|
+
"Open the draft in a new tab" in the admin opens the entry's page with `?hollware-preview=<token>`, a
|
|
67
67
|
signed link for one entry that works for one hour. The module answers that request with a `303` to
|
|
68
68
|
the same URL without the parameter (other parameters kept) and keeps the token in the
|
|
69
69
|
`hollware_preview` cookie: `HttpOnly`, `SameSite=Lax`, `Path=/`, an hour, and `Secure` on every
|
|
@@ -75,13 +75,30 @@ A request with the cookie reads the latest revision of that entry through `useHo
|
|
|
75
75
|
draft included, and nothing keeps what it answers: no cache tag, `Cache-Control: no-store`, and the
|
|
76
76
|
cache of `hollware.cache` neither serves nor stores it. A token that is expired or not valid is
|
|
77
77
|
refused by Hollware: the page is what it is without a token (a 404 for a draft) and the response
|
|
78
|
-
clears the cookie.
|
|
79
|
-
the
|
|
78
|
+
clears the cookie. Any other entry the page reads is answered published, as without a token, so a
|
|
79
|
+
page made of several entries previews the one; the cookie stays. It needs the Worker secret
|
|
80
|
+
`HOLLWARE_SECRET` in Hollware.
|
|
80
81
|
|
|
81
82
|
The redirect adds `hollware-view=<random>` to the URL: a value of no secret, new for each link, so
|
|
82
83
|
the previewed page is at a URL no cache holds, and Workers Cache in front of the site (`cache:
|
|
83
84
|
'purge'`) cannot answer it with the published page before the Worker reads the cookie.
|
|
84
85
|
|
|
86
|
+
### The admin's live preview
|
|
87
|
+
|
|
88
|
+
The admin shows the page next to the editor, in a frame, and reloads it after each saved draft. Its
|
|
89
|
+
link adds `hollware-embed=1`: `?hollware-preview=<token>&hollware-embed=1`. The module renders that
|
|
90
|
+
request in place instead of the `303`: the server-side reads of that request alone carry the token,
|
|
91
|
+
no cookie is set, the token never goes into the page's payload, and the answer is
|
|
92
|
+
`Cache-Control: no-store` and `Referrer-Policy: no-referrer`, with no cache tag, and the cache of
|
|
93
|
+
`hollware.cache` neither serves nor stores it. Reads in the browser after hydration are published.
|
|
94
|
+
|
|
95
|
+
The site must let the admin frame it. With `hollware.url` set, the module adds
|
|
96
|
+
`Content-Security-Policy: frame-ancestors <origin of hollware.url>` to that answer and drops any
|
|
97
|
+
`X-Frame-Options`. A site that reads over the service binding alone has no Hollware URL in its
|
|
98
|
+
config: it adds `frame-ancestors https://cms.example.com` (the origin of its Hollware) itself, for
|
|
99
|
+
requests with `hollware-embed=1`. A policy of the site's own that sets `frame-ancestors` must allow
|
|
100
|
+
that origin too: browsers apply every policy a page carries.
|
|
101
|
+
|
|
85
102
|
## Links
|
|
86
103
|
|
|
87
104
|
- Docs: <https://hollware.com>
|
package/dist/index.mjs
CHANGED
|
@@ -63,6 +63,14 @@ var src_default = defineNuxtModule({
|
|
|
63
63
|
filePath: resolve("./runtime/components/HollwareImage")
|
|
64
64
|
});
|
|
65
65
|
if (options.generator) addPlugin(resolve("./runtime/generator"));
|
|
66
|
+
addPlugin({
|
|
67
|
+
src: resolve("./runtime/embed"),
|
|
68
|
+
mode: "server"
|
|
69
|
+
});
|
|
70
|
+
addPlugin({
|
|
71
|
+
src: resolve("./runtime/embed-client"),
|
|
72
|
+
mode: "client"
|
|
73
|
+
});
|
|
66
74
|
addServerPlugin(resolve("./runtime/server/preview"));
|
|
67
75
|
addServerHandler({
|
|
68
76
|
middleware: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PageEntry } from "./types.mjs";
|
|
2
1
|
import { entryTags, groupTags, listTags, navigationTags, siteTags } from "./tags.mjs";
|
|
2
|
+
import { PageEntry } from "./types.mjs";
|
|
3
3
|
import { MaybeRefOrGetter } from "vue";
|
|
4
4
|
export interface HollwareFetching {
|
|
5
5
|
readonly lazy?: boolean;
|
|
@@ -59,6 +59,7 @@ export declare function useHollwareSite(fetching?: HollwareFetching): import("nu
|
|
|
59
59
|
name: string;
|
|
60
60
|
schema: Record<string, unknown>;
|
|
61
61
|
routes: Record<string, string>;
|
|
62
|
+
singleton?: boolean | undefined;
|
|
62
63
|
translationGroupField: string | null;
|
|
63
64
|
tagsField: string | null;
|
|
64
65
|
sortByField: string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './embed-client.mjs'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { liveEntryOf, withLiveEntry } from "./live.mjs";
|
|
2
|
+
import { embedScrollKey } from "./tags.mjs";
|
|
3
|
+
import { PREVIEW_READY_MESSAGE } from "@hollware/core";
|
|
4
|
+
import { defineNuxtPlugin, useNuxtData } from "nuxt/app";
|
|
5
|
+
// src/runtime/embed-client.ts
|
|
6
|
+
function stored(page, key) {
|
|
7
|
+
try {
|
|
8
|
+
return Number(page.sessionStorage.getItem(key)) || 0;
|
|
9
|
+
} catch {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function store(page, key) {
|
|
14
|
+
try {
|
|
15
|
+
page.sessionStorage.setItem(key, String(page.scrollY));
|
|
16
|
+
} catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
var embed_client_default = defineNuxtPlugin({
|
|
21
|
+
name: "hollware:embedded-preview-client",
|
|
22
|
+
setup(nuxtApp) {
|
|
23
|
+
const page = Reflect.get(globalThis, "window");
|
|
24
|
+
const key = embedScrollKey(page.location.href);
|
|
25
|
+
if (key === null) return;
|
|
26
|
+
page.addEventListener("scroll", () => store(page, key), { passive: true });
|
|
27
|
+
page.addEventListener("message", (event) => {
|
|
28
|
+
if (event.source !== page.parent) return;
|
|
29
|
+
const entry = liveEntryOf(event.data);
|
|
30
|
+
if (entry === null) return;
|
|
31
|
+
nuxtApp.runWithContext(() => {
|
|
32
|
+
for (const name of Object.keys(nuxtApp.payload.data)) {
|
|
33
|
+
const { data } = useNuxtData(name);
|
|
34
|
+
const next = withLiveEntry(data.value, entry);
|
|
35
|
+
if (next !== null) data.value = next;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
nuxtApp.hook("app:suspense:resolve", () => {
|
|
40
|
+
page.scrollTo(0, stored(page, key));
|
|
41
|
+
});
|
|
42
|
+
nuxtApp.hook("app:mounted", () => {
|
|
43
|
+
page.parent.postMessage({ type: PREVIEW_READY_MESSAGE }, "*");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export { embed_client_default as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './embed.mjs'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { withoutPreviewToken } from "./tags.mjs";
|
|
2
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
+
// src/runtime/embed.ts
|
|
4
|
+
var embed_default = defineNuxtPlugin({
|
|
5
|
+
name: "hollware:embedded-preview",
|
|
6
|
+
enforce: "post",
|
|
7
|
+
setup(nuxtApp) {
|
|
8
|
+
nuxtApp.hooks.hook("app:rendered", () => {
|
|
9
|
+
const { path } = nuxtApp.payload;
|
|
10
|
+
if (typeof path === "string") nuxtApp.payload.path = withoutPreviewToken(path);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export { embed_default as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './live.mjs'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { forPage } from "./page-fields.mjs";
|
|
2
|
+
import { PREVIEW_ENTRY_MESSAGE } from "@hollware/core";
|
|
3
|
+
// src/runtime/live.ts
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function liveEntryOf(message) {
|
|
8
|
+
if (!isRecord(message) || message["type"] !== PREVIEW_ENTRY_MESSAGE) return null;
|
|
9
|
+
const entry = forPage(message["entry"]);
|
|
10
|
+
return entry !== void 0 && typeof entry["id"] === "string" ? entry : null;
|
|
11
|
+
}
|
|
12
|
+
function withLiveEntry(answer, entry) {
|
|
13
|
+
if (!isRecord(answer)) return null;
|
|
14
|
+
const read = answer["entry"];
|
|
15
|
+
if (!isRecord(read) || read["id"] !== entry["id"]) return null;
|
|
16
|
+
return {
|
|
17
|
+
...answer,
|
|
18
|
+
entry: {
|
|
19
|
+
...read,
|
|
20
|
+
...entry
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export { liveEntryOf, withLiveEntry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function forPage(entry: unknown): Record<string, unknown> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './page-fields.mjs'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/runtime/page-fields.ts
|
|
2
|
+
const PUBLIC_FIELDS = [
|
|
3
|
+
"id",
|
|
4
|
+
"collection",
|
|
5
|
+
"locale",
|
|
6
|
+
"slug",
|
|
7
|
+
"parent",
|
|
8
|
+
"slugPath",
|
|
9
|
+
"path",
|
|
10
|
+
"translationGroup",
|
|
11
|
+
"frontmatter",
|
|
12
|
+
"tags",
|
|
13
|
+
"publishedAt",
|
|
14
|
+
"updatedAt",
|
|
15
|
+
"document",
|
|
16
|
+
"images"
|
|
17
|
+
];
|
|
18
|
+
function forPage(entry) {
|
|
19
|
+
if (typeof entry !== "object" || entry === null) return void 0;
|
|
20
|
+
return Object.fromEntries(PUBLIC_FIELDS.filter((field) => field in entry).map((field) => [field, Reflect.get(entry, field)]));
|
|
21
|
+
}
|
|
22
|
+
export { forPage };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { forPage } from "../page-fields.mjs";
|
|
1
2
|
import { H3Event } from "h3";
|
|
2
3
|
export declare function answer<Value extends {
|
|
3
4
|
outcome: string;
|
|
4
5
|
}>(event: H3Event, read: () => Promise<Value>): Promise<Value>;
|
|
5
|
-
export
|
|
6
|
+
export { forPage };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { forPage } from "../page-fields.mjs";
|
|
1
2
|
import { HollwareClientError } from "@hollware/client";
|
|
2
3
|
import { createError, setResponseHeader } from "h3";
|
|
3
4
|
// src/runtime/server/answer.ts
|
|
@@ -19,23 +20,4 @@ async function answer(event, read) {
|
|
|
19
20
|
setResponseHeader(event, "cache-control", "no-cache");
|
|
20
21
|
return value;
|
|
21
22
|
}
|
|
22
|
-
const PUBLIC_FIELDS = [
|
|
23
|
-
"id",
|
|
24
|
-
"collection",
|
|
25
|
-
"locale",
|
|
26
|
-
"slug",
|
|
27
|
-
"parent",
|
|
28
|
-
"slugPath",
|
|
29
|
-
"translationGroup",
|
|
30
|
-
"frontmatter",
|
|
31
|
-
"tags",
|
|
32
|
-
"publishedAt",
|
|
33
|
-
"updatedAt",
|
|
34
|
-
"document",
|
|
35
|
-
"images"
|
|
36
|
-
];
|
|
37
|
-
function forPage(entry) {
|
|
38
|
-
if (typeof entry !== "object" || entry === null) return void 0;
|
|
39
|
-
return Object.fromEntries(PUBLIC_FIELDS.filter((field) => field in entry).map((field) => [field, Reflect.get(entry, field)]));
|
|
40
|
-
}
|
|
41
23
|
export { answer, forPage };
|
|
@@ -1,16 +1,48 @@
|
|
|
1
|
-
import { markPreviewRequest } from "../tags.mjs";
|
|
1
|
+
import { embedFrameAncestors, embedPreviewRequest, markPreviewRequest } from "../tags.mjs";
|
|
2
|
+
import { requestUrl } from "./url.mjs";
|
|
2
3
|
import { previewTokenFromCookie } from "@hollware/client";
|
|
3
4
|
import { removeResponseHeader, setResponseHeader } from "h3";
|
|
4
|
-
import { defineNitroPlugin } from "nitropack/runtime";
|
|
5
|
+
import { defineNitroPlugin, useRuntimeConfig } from "nitropack/runtime";
|
|
5
6
|
// src/runtime/server/preview.ts
|
|
7
|
+
const UNCACHED = ["cache-tag", "cloudflare-cdn-cache-control"];
|
|
8
|
+
function hollwareUrl(event) {
|
|
9
|
+
const config = useRuntimeConfig(event)["hollware"];
|
|
10
|
+
const url = typeof config === "object" && config !== null ? Reflect.get(config, "url") : "";
|
|
11
|
+
return typeof url === "string" ? url : "";
|
|
12
|
+
}
|
|
13
|
+
function withAncestors(policy, ancestors) {
|
|
14
|
+
const policies = (Array.isArray(policy) ? policy : [policy]).filter((value) => value !== void 0).map(String);
|
|
15
|
+
return policies.includes(ancestors) ? policies : [...policies, ancestors];
|
|
16
|
+
}
|
|
17
|
+
function holdEmbeddedHeaders(response, ancestors) {
|
|
18
|
+
function settle() {
|
|
19
|
+
if (response.headersSent) return;
|
|
20
|
+
response.removeHeader("x-frame-options");
|
|
21
|
+
for (const name of UNCACHED) response.removeHeader(name);
|
|
22
|
+
response.setHeader("cache-control", "no-store");
|
|
23
|
+
response.setHeader("referrer-policy", "no-referrer");
|
|
24
|
+
if (ancestors !== null) response.setHeader("content-security-policy", withAncestors(response.getHeader("content-security-policy"), ancestors));
|
|
25
|
+
}
|
|
26
|
+
const writeHead = response.writeHead.bind(response);
|
|
27
|
+
const end = response.end.bind(response);
|
|
28
|
+
response.writeHead = ((...args) => {
|
|
29
|
+
settle();
|
|
30
|
+
return writeHead(...args);
|
|
31
|
+
});
|
|
32
|
+
response.end = ((...args) => {
|
|
33
|
+
settle();
|
|
34
|
+
return end(...args);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
6
37
|
var preview_default = defineNitroPlugin((nitroApp) => {
|
|
7
38
|
nitroApp.hooks.hook("request", (event) => {
|
|
39
|
+
if (embedPreviewRequest(event.node.req.headers, requestUrl(event))) holdEmbeddedHeaders(event.node.res, embedFrameAncestors(hollwareUrl(event)));
|
|
8
40
|
markPreviewRequest(event.node.req.headers);
|
|
9
41
|
});
|
|
10
42
|
nitroApp.hooks.hook("beforeResponse", (event) => {
|
|
11
43
|
if (previewTokenFromCookie(event.node.req.headers.cookie) === void 0) return;
|
|
12
44
|
setResponseHeader(event, "cache-control", "no-store");
|
|
13
|
-
for (const name of
|
|
45
|
+
for (const name of UNCACHED) removeResponseHeader(event, name);
|
|
14
46
|
});
|
|
15
47
|
});
|
|
16
48
|
export { preview_default as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forPage } from "../../page-fields.mjs";
|
|
2
|
+
import { answer } from "../answer.mjs";
|
|
2
3
|
import { useHollware } from "../reader.mjs";
|
|
3
4
|
import { defineEventHandler, getQuery, getRouterParam } from "h3";
|
|
4
5
|
// src/runtime/server/routes/entries.ts
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { forPage } from "../../page-fields.mjs";
|
|
2
|
+
import { answer } from "../answer.mjs";
|
|
3
3
|
import { useHollware } from "../reader.mjs";
|
|
4
|
+
import { requestUrl } from "../url.mjs";
|
|
4
5
|
import { clearedPreviewCookie, isPreviewRefusal, isSecureRequest, previewTokenFromCookie } from "@hollware/client";
|
|
5
6
|
import { appendResponseHeader, createError, defineEventHandler, getHeader, getRouterParam } from "h3";
|
|
6
7
|
// src/runtime/server/routes/entry.ts
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { forPage } from "../../page-fields.mjs";
|
|
2
|
+
import { answer } from "../answer.mjs";
|
|
3
3
|
import { useHollware } from "../reader.mjs";
|
|
4
|
+
import { requestUrl } from "../url.mjs";
|
|
4
5
|
import { clearedPreviewCookie, isPreviewRefusal, isSecureRequest, previewTokenFromCookie } from "@hollware/client";
|
|
5
6
|
import { appendResponseHeader, createError, defineEventHandler, getHeader, getQuery } from "h3";
|
|
6
7
|
// src/runtime/server/routes/page.ts
|
|
@@ -10,6 +10,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
|
|
|
10
10
|
name: string;
|
|
11
11
|
schema: Record<string, unknown>;
|
|
12
12
|
routes: Record<string, string>;
|
|
13
|
+
singleton?: boolean | undefined;
|
|
13
14
|
translationGroupField: string | null;
|
|
14
15
|
tagsField: string | null;
|
|
15
16
|
sortByField: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forPage } from "../../page-fields.mjs";
|
|
2
|
+
import { answer } from "../answer.mjs";
|
|
2
3
|
import { useHollware } from "../reader.mjs";
|
|
3
4
|
import { defineEventHandler, getRouterParam } from "h3";
|
|
4
5
|
// src/runtime/server/routes/translations.ts
|
package/dist/runtime/tags.d.mts
CHANGED
|
@@ -15,4 +15,9 @@ export declare const EDGE_SECONDS = 31536000;
|
|
|
15
15
|
export declare function edgeHeaders(tags: readonly string[], status: number, method: string): Readonly<Record<string, string>> | null;
|
|
16
16
|
export declare const PREVIEW_HEADER = "x-hollware-preview";
|
|
17
17
|
export declare function markPreviewRequest(headers: Record<string, string | string[] | undefined>): void;
|
|
18
|
+
export declare function embedPreviewRequest(headers: Record<string, string | string[] | undefined>, url: URL): boolean;
|
|
19
|
+
export declare function embedFrameAncestors(hollwareUrl: string): string | null;
|
|
20
|
+
export declare function withoutPreviewToken(path: string): string;
|
|
21
|
+
export declare function isEmbeddedPage(url: string): boolean;
|
|
22
|
+
export declare function embedScrollKey(url: string): string | null;
|
|
18
23
|
export {};
|
package/dist/runtime/tags.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { previewTokenFromCookie } from "@hollware/client";
|
|
2
|
-
import { EVERY_LOCALE, SITE_TAG, entryTag, groupTag, listTag } from "@hollware/core";
|
|
1
|
+
import { PREVIEW_COOKIE, embeddedPreviewToken, previewTokenFromCookie } from "@hollware/client";
|
|
2
|
+
import { EVERY_LOCALE, PREVIEW_EMBED_PARAM, PREVIEW_QUERY_PARAM, SITE_TAG, entryTag, groupTag, listTag } from "@hollware/core";
|
|
3
3
|
// src/runtime/tags.ts
|
|
4
4
|
const KEY = "hollwareTags";
|
|
5
5
|
function recordTags(event, tags) {
|
|
@@ -46,4 +46,40 @@ function markPreviewRequest(headers) {
|
|
|
46
46
|
if (previewTokenFromCookie(typeof cookie === "string" ? cookie : void 0) === void 0) delete headers[PREVIEW_HEADER];
|
|
47
47
|
else headers[PREVIEW_HEADER] = crypto.randomUUID();
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
function embedPreviewRequest(headers, url) {
|
|
50
|
+
const token = embeddedPreviewToken(url);
|
|
51
|
+
if (token === void 0) return false;
|
|
52
|
+
const cookie = headers["cookie"];
|
|
53
|
+
headers["cookie"] = typeof cookie === "string" && cookie !== "" ? `${PREVIEW_COOKIE}=${token}; ${cookie}` : `${PREVIEW_COOKIE}=${token}`;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
function embedFrameAncestors(hollwareUrl) {
|
|
57
|
+
if (hollwareUrl === "") return null;
|
|
58
|
+
try {
|
|
59
|
+
return `frame-ancestors ${new URL(hollwareUrl).origin}`;
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function withoutPreviewToken(path) {
|
|
65
|
+
const at = path.indexOf("?");
|
|
66
|
+
if (at === -1) return path;
|
|
67
|
+
const kept = path.slice(at + 1).split("&").filter((pair) => {
|
|
68
|
+
const name = pair.split("=")[0] ?? "";
|
|
69
|
+
let decoded = name;
|
|
70
|
+
try {
|
|
71
|
+
decoded = decodeURIComponent(name);
|
|
72
|
+
} catch {
|
|
73
|
+
decoded = name;
|
|
74
|
+
}
|
|
75
|
+
return pair !== "" && decoded !== PREVIEW_QUERY_PARAM;
|
|
76
|
+
});
|
|
77
|
+
return kept.length === 0 ? path.slice(0, at) : `${path.slice(0, at)}?${kept.join("&")}`;
|
|
78
|
+
}
|
|
79
|
+
function isEmbeddedPage(url) {
|
|
80
|
+
return new URL(url).searchParams.get(PREVIEW_EMBED_PARAM) === "1";
|
|
81
|
+
}
|
|
82
|
+
function embedScrollKey(url) {
|
|
83
|
+
return isEmbeddedPage(url) ? `hollware-embed-scroll:${new URL(url).pathname}` : null;
|
|
84
|
+
}
|
|
85
|
+
export { EDGE_SECONDS, PREVIEW_HEADER, edgeHeaders, embedFrameAncestors, embedPreviewRequest, embedScrollKey, entryTags, groupTags, isEmbeddedPage, listTags, markPreviewRequest, navigationTags, recordTags, siteTags, tagsOf, withoutPreviewToken };
|
package/dist/runtime/types.d.mts
CHANGED
|
@@ -8,6 +8,8 @@ export interface PageEntry {
|
|
|
8
8
|
readonly parent?: string | null;
|
|
9
9
|
/** The slugs of its ancestors and its own, joined by `/`. */
|
|
10
10
|
readonly slugPath?: string;
|
|
11
|
+
/** Its public path by the collection's route in its locale; `null` without a route there. */
|
|
12
|
+
readonly path?: string | null;
|
|
11
13
|
readonly translationGroup: string | null;
|
|
12
14
|
readonly frontmatter: Record<string, unknown>;
|
|
13
15
|
readonly tags: readonly string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hollware/nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Read Hollware from a Nuxt site, over a service binding or HTTP.",
|
|
5
5
|
"homepage": "https://hollware.com",
|
|
6
6
|
"bugs": {
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"provenance": true
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@comark/vue": "0.
|
|
32
|
-
"@hollware/client": "1.
|
|
33
|
-
"@hollware/core": "1.
|
|
31
|
+
"@comark/vue": "0.9.2",
|
|
32
|
+
"@hollware/client": "1.11.0",
|
|
33
|
+
"@hollware/core": "1.11.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nuxt/kit": "4.
|
|
36
|
+
"@nuxt/kit": "4.7.0",
|
|
37
37
|
"@types/node": "24.19.2",
|
|
38
38
|
"h3": "1.15.11",
|
|
39
|
-
"nitropack": "2.
|
|
40
|
-
"nuxt": "4.
|
|
39
|
+
"nitropack": "2.14.0",
|
|
40
|
+
"nuxt": "4.7.0",
|
|
41
41
|
"publint": "0.3.25",
|
|
42
42
|
"typescript": "7.0.2",
|
|
43
|
-
"vite-plus": "1.
|
|
44
|
-
"vue": "3.5.
|
|
43
|
+
"vite-plus": "1.8.0",
|
|
44
|
+
"vue": "3.5.46"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@nuxt/kit": "^4.6.0",
|