siteplane 0.1.67 → 0.2.0-next.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 +43 -130
- package/dist/bin/siteplane.js +1892 -6606
- package/dist/chunk-KZ3AQ6OA.js +27 -0
- package/dist/chunk-YDCNEIOB.js +339 -0
- package/dist/components.d.ts +19 -0
- package/dist/components.js +33 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +6 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +112 -3716
- package/dist/internal/bridge-loader.js +28 -0
- package/dist/internal/bridge.js +1 -0
- package/dist/next.cjs +204 -0
- package/dist/next.d.ts +29 -120
- package/dist/next.js +123 -4509
- package/dist/route.d.ts +13 -0
- package/dist/route.js +144 -0
- package/package.json +45 -11
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/bridge-loader.tsx
|
|
4
|
+
import { usePathname, useRouter } from "next/navigation";
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
6
|
+
function BridgeLoader({ editorOrigin }) {
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
const pathname = usePathname() ?? "/";
|
|
9
|
+
const path = useRef(pathname);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
path.current = pathname;
|
|
12
|
+
}, [pathname]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
let active = true;
|
|
15
|
+
let stop;
|
|
16
|
+
void import("siteplane/internal/bridge").then(({ startBridge }) => {
|
|
17
|
+
if (active) stop = startBridge({ editorOrigin, refresh: () => router.refresh(), path: () => path.current });
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
active = false;
|
|
21
|
+
stop?.();
|
|
22
|
+
};
|
|
23
|
+
}, [editorOrigin, router]);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
BridgeLoader
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function L(t){return _(t)?t.type==="siteplane:refresh"?{type:"siteplane:refresh"}:t.type==="siteplane:highlight"&&(t.fieldId===null||O(t.fieldId))?{type:"siteplane:highlight",fieldId:t.fieldId}:null:null}function _(t){return typeof t=="object"&&t!==null}function O(t){return typeof t=="string"&&t.length>0&&t.length<=256}var r="data-siteplane-field",f="data-siteplane-selected",A="2px solid #2563eb",H="2px dashed #2563eb";function b(t){let c=t.parent??(window.parent===window?null:window.parent);if(!c)return()=>{};let s=new Map,o=null,E="",d,g=e=>c.postMessage(e,t.editorOrigin);function a(e){let n=e===void 0?`[${r}]`:`[${r}=${CSS.escape(e)}]`;return[...document.querySelectorAll(n)]}function l(e,n){if(n===null){let i=s.get(e);if(!i)return;e.style.outline=i.outline,e.style.outlineOffset=i.outlineOffset,s.delete(e);return}s.has(e)||s.set(e,{outline:e.style.outline,outlineOffset:e.style.outlineOffset}),e.style.outline=n,e.style.outlineOffset="2px"}function p(){for(let e of document.querySelectorAll(`[${f}]`))e.removeAttribute(f),l(e,null);if(o!==null)for(let e of a(o))e.setAttribute(f,""),l(e,A)}function m(){let e=[...new Set(a().map(M=>M.getAttribute(r)??""))],n=t.path(),i=JSON.stringify([n,e]);i!==E&&(E=i,g({type:"siteplane:page",version:1,path:n,fields:e.filter(Boolean)}))}let y=e=>e instanceof Element?e.closest(`[${r}]`):null;function T(e){let i=y(e.target)?.getAttribute(r);i&&(e.preventDefault(),e.stopPropagation(),g({type:"siteplane:select",version:1,fieldId:i}))}function u(e){let n=y(e.target);!n||n.hasAttribute(f)||l(n,e.type==="mouseover"?H:null)}function h(e){if(e.origin!==t.editorOrigin||e.source!==c)return;let n=L(e.data);n?.type==="siteplane:refresh"&&t.refresh(),n?.type==="siteplane:highlight"&&(o=n.fieldId,p())}let I=new MutationObserver(()=>{clearTimeout(d),d=setTimeout(()=>{m(),o!==null&&p()},150)});return document.addEventListener("click",T,!0),document.addEventListener("mouseover",u),document.addEventListener("mouseout",u),window.addEventListener("message",h),I.observe(document.documentElement,{childList:!0,subtree:!0,attributeFilter:[r]}),m(),()=>{clearTimeout(d),I.disconnect(),document.removeEventListener("click",T,!0),document.removeEventListener("mouseover",u),document.removeEventListener("mouseout",u),window.removeEventListener("message",h),o=null,p();for(let e of[...s.keys()])l(e,null)}}export{b as startBridge};
|
package/dist/next.cjs
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/next.ts
|
|
21
|
+
var next_exports = {};
|
|
22
|
+
__export(next_exports, {
|
|
23
|
+
withSiteplane: () => withSiteplane
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(next_exports);
|
|
26
|
+
var import_node_fs = require("fs");
|
|
27
|
+
var import_promises = require("fs/promises");
|
|
28
|
+
var import_node_module = require("module");
|
|
29
|
+
var import_node_path = require("path");
|
|
30
|
+
|
|
31
|
+
// ../shared/dist/siteplane-config.js
|
|
32
|
+
var SITEPLANE_CONFIG_FILE = "siteplane.config.json";
|
|
33
|
+
var siteIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
34
|
+
function readSiteplaneConfig(value) {
|
|
35
|
+
if (typeof value !== "object" || value === null)
|
|
36
|
+
return null;
|
|
37
|
+
const { siteId, apiOrigin, editorOrigins } = value;
|
|
38
|
+
if (typeof siteId !== "string" || !siteIdPattern.test(siteId) || !isWebOrigin(apiOrigin) || !Array.isArray(editorOrigins) || !editorOrigins.every(isWebOrigin)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return { siteId, apiOrigin, editorOrigins: [...editorOrigins] };
|
|
42
|
+
}
|
|
43
|
+
function isWebOrigin(value) {
|
|
44
|
+
if (typeof value !== "string")
|
|
45
|
+
return false;
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(value);
|
|
48
|
+
return (url.protocol === "https:" || url.protocol === "http:") && url.origin === value;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/next.ts
|
|
55
|
+
var DRAFT_MODE_COOKIE = { type: "cookie", key: "__prerender_bypass" };
|
|
56
|
+
var siteIdPattern2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
57
|
+
function withSiteplane(nextConfig, options = {}) {
|
|
58
|
+
return async (phase, context) => {
|
|
59
|
+
const base = await (typeof nextConfig === "function" ? nextConfig(phase, context) : nextConfig);
|
|
60
|
+
const projectDir = options.projectDir ?? process.cwd();
|
|
61
|
+
let config = base;
|
|
62
|
+
try {
|
|
63
|
+
const project = readProjectConfig(projectDir);
|
|
64
|
+
if (project) config = withEditor(config, project, { projectDir, admin: options.admin === true });
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.warn(
|
|
67
|
+
`[Siteplane] ${SITEPLANE_CONFIG_FILE} could not be read, so the website builds without Siteplane content: ${error instanceof Error ? error.message : String(error)}`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return options.booking ? await withBooking(config, options.booking.site, projectDir) : config;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function readProjectConfig(projectDir) {
|
|
74
|
+
const path = (0, import_node_path.join)(projectDir, SITEPLANE_CONFIG_FILE);
|
|
75
|
+
if (!(0, import_node_fs.existsSync)(path)) return null;
|
|
76
|
+
const config = readSiteplaneConfig(JSON.parse((0, import_node_fs.readFileSync)(path, "utf8")));
|
|
77
|
+
if (!config) throw new Error("run npx siteplane init to repair it");
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
function withEditor(config, project, options) {
|
|
81
|
+
const configPath = (0, import_node_path.join)(options.projectDir, SITEPLANE_CONFIG_FILE);
|
|
82
|
+
const next = { ...config, ...moduleAlias(config, options.projectDir) };
|
|
83
|
+
next.webpack = (webpackConfig, context) => {
|
|
84
|
+
webpackConfig.resolve ??= {};
|
|
85
|
+
const alias = webpackConfig.resolve.alias;
|
|
86
|
+
if (Array.isArray(alias)) alias.push({ name: "siteplane/config", alias: configPath, onlyModule: true });
|
|
87
|
+
else webpackConfig.resolve.alias = Object.assign(alias ?? {}, { "siteplane/config$": configPath });
|
|
88
|
+
return config.webpack ? config.webpack(webpackConfig, context) : webpackConfig;
|
|
89
|
+
};
|
|
90
|
+
const api = new URL(project.apiOrigin);
|
|
91
|
+
if (api.protocol === "https:") {
|
|
92
|
+
const pattern = { protocol: "https", hostname: api.hostname, pathname: "/**" };
|
|
93
|
+
const patterns = config.images?.remotePatterns ?? [];
|
|
94
|
+
const known = patterns.some((entry) => JSON.stringify(entry) === JSON.stringify(pattern));
|
|
95
|
+
next.images = { ...config.images, remotePatterns: known ? patterns : [...patterns, pattern] };
|
|
96
|
+
}
|
|
97
|
+
const websiteHeaders = config.headers;
|
|
98
|
+
if (websiteHeaders) {
|
|
99
|
+
next.headers = async () => {
|
|
100
|
+
const rules = await websiteHeaders();
|
|
101
|
+
return [...rules, ...draftFrameRules(rules, project.editorOrigins)];
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (options.admin) {
|
|
105
|
+
const portal = `${project.apiOrigin}/portal?site=${project.siteId}`;
|
|
106
|
+
const websiteRedirects = config.redirects;
|
|
107
|
+
next.redirects = async () => [
|
|
108
|
+
...await websiteRedirects?.() ?? [],
|
|
109
|
+
{ source: "/admin", destination: portal, permanent: false },
|
|
110
|
+
{ source: "/admin/:path*", destination: portal, permanent: false }
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
return next;
|
|
114
|
+
}
|
|
115
|
+
function moduleAlias(config, projectDir) {
|
|
116
|
+
const alias = { "siteplane/config": `./${SITEPLANE_CONFIG_FILE}` };
|
|
117
|
+
if (usesExperimentalTurbo(projectDir)) {
|
|
118
|
+
const turbo = config.experimental?.turbo;
|
|
119
|
+
return {
|
|
120
|
+
experimental: { ...config.experimental, turbo: { ...turbo, resolveAlias: { ...turbo?.resolveAlias, ...alias } } }
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return { turbopack: { ...config.turbopack, resolveAlias: { ...config.turbopack?.resolveAlias, ...alias } } };
|
|
124
|
+
}
|
|
125
|
+
function usesExperimentalTurbo(projectDir) {
|
|
126
|
+
try {
|
|
127
|
+
const manifest = (0, import_node_module.createRequire)((0, import_node_path.join)(projectDir, "package.json")).resolve("next/package.json");
|
|
128
|
+
const [major = 0, minor = 0] = JSON.parse((0, import_node_fs.readFileSync)(manifest, "utf8")).version.split(".").map(Number);
|
|
129
|
+
return major < 15 || major === 15 && minor < 3;
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function draftFrameRules(rules, editorOrigins) {
|
|
135
|
+
const isCsp = (key) => key.toLowerCase() === "content-security-policy";
|
|
136
|
+
const isXfo = (key) => key.toLowerCase() === "x-frame-options";
|
|
137
|
+
const hasFrameOptions = rules.some((rule) => rule.headers.some((header) => isXfo(header.key)));
|
|
138
|
+
const draftRule = (rule, headers) => ({
|
|
139
|
+
...rule,
|
|
140
|
+
has: [...rule.has ?? [], DRAFT_MODE_COOKIE],
|
|
141
|
+
headers
|
|
142
|
+
});
|
|
143
|
+
const optionsOnly = rules.filter((rule) => rule.headers.some((header) => isXfo(header.key)) && !rule.headers.some((header) => isCsp(header.key))).map(
|
|
144
|
+
(rule) => draftRule(rule, [
|
|
145
|
+
...rule.headers,
|
|
146
|
+
{ key: "Content-Security-Policy", value: `frame-ancestors 'self' ${editorOrigins.join(" ")}` }
|
|
147
|
+
])
|
|
148
|
+
);
|
|
149
|
+
const policies = rules.filter(
|
|
150
|
+
(rule) => rule.headers.some((header) => isCsp(header.key) && (hasFrameOptions || /frame-ancestors/iu.test(header.value)))
|
|
151
|
+
).map(
|
|
152
|
+
(rule) => draftRule(
|
|
153
|
+
rule,
|
|
154
|
+
rule.headers.map(
|
|
155
|
+
(header) => isCsp(header.key) ? { ...header, value: allowEditorFrames(header.value, editorOrigins) } : header
|
|
156
|
+
)
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
return [...optionsOnly, ...policies];
|
|
160
|
+
}
|
|
161
|
+
function allowEditorFrames(policy, editorOrigins) {
|
|
162
|
+
const directives = policy.split(";").map((directive) => directive.trim()).filter(Boolean);
|
|
163
|
+
const index = directives.findIndex((directive) => /^frame-ancestors(\s|$)/iu.test(directive));
|
|
164
|
+
if (index === -1) return [...directives, `frame-ancestors 'self' ${editorOrigins.join(" ")}`].join("; ");
|
|
165
|
+
const sources = (directives[index] ?? "").split(/\s+/u).slice(1);
|
|
166
|
+
const allowed = sources.includes("'none'") ? editorOrigins : [...sources, ...editorOrigins.filter((origin) => !sources.includes(origin))];
|
|
167
|
+
directives[index] = `frame-ancestors ${allowed.join(" ")}`;
|
|
168
|
+
return directives.join("; ");
|
|
169
|
+
}
|
|
170
|
+
function prependRewrites(rewrites, rules) {
|
|
171
|
+
return async () => {
|
|
172
|
+
const existing = await rewrites?.() ?? [];
|
|
173
|
+
const sections = Array.isArray(existing) ? { afterFiles: existing } : existing;
|
|
174
|
+
return {
|
|
175
|
+
beforeFiles: [...rules, ...sections.beforeFiles ?? []],
|
|
176
|
+
afterFiles: sections.afterFiles ?? [],
|
|
177
|
+
fallback: sections.fallback ?? []
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async function withBooking(config, site, projectDir) {
|
|
182
|
+
if (!siteIdPattern2.test(site)) throw new Error("Siteplane booking.site must be the Site ID from Booking settings.");
|
|
183
|
+
for (const folder of ["app/booking", "src/app/booking"]) {
|
|
184
|
+
if (await (0, import_promises.access)((0, import_node_path.join)(projectDir, folder)).then(
|
|
185
|
+
() => true,
|
|
186
|
+
() => false
|
|
187
|
+
)) {
|
|
188
|
+
console.warn(
|
|
189
|
+
"[Siteplane] An app/booking route exists. The Booking beforeFiles rewrite takes precedence; move that route or remove the Booking integration."
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
...config,
|
|
195
|
+
rewrites: prependRewrites(config.rewrites, [
|
|
196
|
+
{ source: "/booking", destination: `https://siteplane.io/booking?site=${site}` },
|
|
197
|
+
{ source: "/booking/:path*", destination: `https://siteplane.io/booking/:path*?site=${site}` }
|
|
198
|
+
])
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
+
0 && (module.exports = {
|
|
203
|
+
withSiteplane
|
|
204
|
+
});
|
package/dist/next.d.ts
CHANGED
|
@@ -1,121 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
type NextImageConfig = {
|
|
13
|
-
remotePatterns?: Array<NextRemoteImagePattern | URL>;
|
|
14
|
-
localPatterns?: Array<{ pathname?: string; search?: string }> | undefined;
|
|
15
|
-
maximumRedirects?: number;
|
|
16
|
-
loader?: string;
|
|
17
|
-
loaderFile?: string;
|
|
18
|
-
};
|
|
19
|
-
type RewriteRule = { source: string; destination: string };
|
|
20
|
-
type Rewrites =
|
|
21
|
-
| RewriteRule[]
|
|
22
|
-
| {
|
|
23
|
-
beforeFiles?: RewriteRule[];
|
|
24
|
-
afterFiles?: RewriteRule[];
|
|
25
|
-
fallback?: RewriteRule[];
|
|
1
|
+
import { NextConfig } from 'next';
|
|
2
|
+
|
|
3
|
+
/** How Next calls a config function: with the phase and the default config. */
|
|
4
|
+
type NextConfigFunction = (phase: string, context: {
|
|
5
|
+
defaultConfig: NextConfig;
|
|
6
|
+
}) => NextConfig | Promise<NextConfig>;
|
|
7
|
+
type SiteplaneNextOptions = {
|
|
8
|
+
/** Booking on `/booking`, unchanged since Plan 49. */
|
|
9
|
+
booking?: {
|
|
10
|
+
site: string;
|
|
26
11
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
type SiteplaneSourceMapping = {
|
|
48
|
-
kind: "function";
|
|
49
|
-
filePath: string;
|
|
50
|
-
exportName?: string;
|
|
51
|
-
sourcePath?: string;
|
|
52
|
-
editTarget?: string;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
type SiteplaneDomMapping = {
|
|
56
|
-
attribute: "data-siteplane-field-id";
|
|
57
|
-
previewStrategy: "dom" | "event";
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type SiteplaneContractFieldBase = {
|
|
61
|
-
fieldId: string;
|
|
62
|
-
routeKey: string;
|
|
63
|
-
source: SiteplaneSourceMapping;
|
|
64
|
-
dom?: SiteplaneDomMapping;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export type SiteplaneSiteFieldContractV1 = {
|
|
68
|
-
version: 1;
|
|
69
|
-
fieldContractVersion: string;
|
|
70
|
-
scannerContractVersion: string;
|
|
71
|
-
fields: Array<
|
|
72
|
-
| (SiteplaneContractFieldBase & {
|
|
73
|
-
fieldType: "text" | "longText";
|
|
74
|
-
fallback: string;
|
|
75
|
-
})
|
|
76
|
-
| (SiteplaneContractFieldBase & {
|
|
77
|
-
fieldType: "link";
|
|
78
|
-
fallback: {
|
|
79
|
-
href: string;
|
|
80
|
-
label?: string;
|
|
81
|
-
target?: "_self" | "_blank";
|
|
82
|
-
};
|
|
83
|
-
})
|
|
84
|
-
| (SiteplaneContractFieldBase & {
|
|
85
|
-
fieldType: "image";
|
|
86
|
-
fallback: {
|
|
87
|
-
src: string;
|
|
88
|
-
alt: string;
|
|
89
|
-
width?: number;
|
|
90
|
-
height?: number;
|
|
91
|
-
crop?: {
|
|
92
|
-
x: number;
|
|
93
|
-
y: number;
|
|
94
|
-
zoom: number;
|
|
95
|
-
aspectRatio: number;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
})
|
|
99
|
-
>;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export declare class SiteplaneNextContractError extends Error {
|
|
103
|
-
readonly code:
|
|
104
|
-
| "image_policy_conflict"
|
|
105
|
-
| "image_origin_missing"
|
|
106
|
-
| "field_contract_scan_failed"
|
|
107
|
-
| "build_identity_missing";
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export declare function scanNextProjectFieldContract(projectDir: string): Promise<{
|
|
111
|
-
fieldContractHash: string;
|
|
112
|
-
contract: SiteplaneSiteFieldContractV1;
|
|
113
|
-
hardErrors: SiteplaneFieldScanIssue[];
|
|
114
|
-
warnings: SiteplaneFieldScanIssue[];
|
|
115
|
-
suggestions: SiteplaneFieldScanIssue[];
|
|
116
|
-
}>;
|
|
117
|
-
|
|
118
|
-
export declare function withSiteplane<TConfig extends NextConfigLike>(
|
|
119
|
-
nextConfig: TConfig,
|
|
120
|
-
options?: SiteplaneNextOptions
|
|
121
|
-
): Promise<TConfig & { env: Record<string, string | undefined> }>;
|
|
12
|
+
/** Sends `/admin` to the portal of the site on Siteplane. */
|
|
13
|
+
admin?: boolean;
|
|
14
|
+
/** The project root; Next runs the config there, so it defaults to the working directory. */
|
|
15
|
+
projectDir?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* `next.config` wrapper (Vertrag 54 §6.5). With `siteplane.config.json` it adds
|
|
19
|
+
* only Siteplane's image host for `next/image`, Draft Mode variants of the
|
|
20
|
+
* website's own frame headers for the editor origins, the `siteplane/config`
|
|
21
|
+
* module for the runtime and, on request, `/admin`. A `basePath` needs nothing
|
|
22
|
+
* here: the website URL in Siteplane carries it, and the routes of this package
|
|
23
|
+
* live below it. The editor connection never scans code, sets no build
|
|
24
|
+
* variables and never stops a build; only an invalid `booking.site` is an error.
|
|
25
|
+
*/
|
|
26
|
+
declare function withSiteplane(nextConfig: NextConfig | Promise<NextConfig> | NextConfigFunction, options?: SiteplaneNextOptions): (phase: string, context: {
|
|
27
|
+
defaultConfig: NextConfig;
|
|
28
|
+
}) => Promise<NextConfig>;
|
|
29
|
+
|
|
30
|
+
export { type NextConfigFunction, type SiteplaneNextOptions, withSiteplane };
|