siteplane 0.3.5 → 0.3.6
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/astro/index.js +1 -1
- package/dist/astro/route.js +1 -1
- package/dist/bin/siteplane.js +36 -17
- package/dist/route.js +1 -1
- package/package.json +2 -2
package/dist/astro/index.js
CHANGED
|
@@ -1005,7 +1005,7 @@ function readSiteId(payload) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
1007
|
// src/version.ts
|
|
1008
|
-
var PACKAGE_VERSION = "0.3.
|
|
1008
|
+
var PACKAGE_VERSION = "0.3.6";
|
|
1009
1009
|
|
|
1010
1010
|
// src/astro/build-images.ts
|
|
1011
1011
|
import { mkdir, readdir, readFile, rename, rm, writeFile } from "fs/promises";
|
package/dist/astro/route.js
CHANGED
|
@@ -114,7 +114,7 @@ function readSiteId(payload) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// src/version.ts
|
|
117
|
-
var PACKAGE_VERSION = "0.3.
|
|
117
|
+
var PACKAGE_VERSION = "0.3.6";
|
|
118
118
|
|
|
119
119
|
// src/astro/route.ts
|
|
120
120
|
var embeddable = { httpOnly: true, secure: true, sameSite: "none", partitioned: true, path: "/" };
|
package/dist/bin/siteplane.js
CHANGED
|
@@ -4102,7 +4102,7 @@ function contentWriteResponseWith(extra) {
|
|
|
4102
4102
|
z11.object({
|
|
4103
4103
|
...extra,
|
|
4104
4104
|
status: z11.literal("restore_refused"),
|
|
4105
|
-
fields: z11.array(z11.object({ fieldId: fieldIdSchema, person: z11.string().nullable(), publishedAt: isoTime, version, previousVersion: version }))
|
|
4105
|
+
fields: z11.array(z11.object({ fieldId: fieldIdSchema, person: z11.string().nullable(), publishedAt: isoTime, version, previousVersion: version, restoredVersion: version.min(1).exactOptional() }))
|
|
4106
4106
|
}),
|
|
4107
4107
|
z11.object({
|
|
4108
4108
|
...extra,
|
|
@@ -4773,7 +4773,7 @@ function createBookingCliRequestHeaders(config) {
|
|
|
4773
4773
|
authorization: `Bearer ${config.accessToken}`,
|
|
4774
4774
|
"content-type": "application/json"
|
|
4775
4775
|
};
|
|
4776
|
-
const bypassSecret = config.
|
|
4776
|
+
const bypassSecret = config.siteplaneBypassSecret?.trim();
|
|
4777
4777
|
if (bypassSecret) {
|
|
4778
4778
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
4779
4779
|
}
|
|
@@ -18211,7 +18211,7 @@ function normalizePagePath(path2) {
|
|
|
18211
18211
|
const encoded = encodeURI(decoded);
|
|
18212
18212
|
return encoded.length > 1 ? encoded.replace(/\/+$/u, "") : encoded;
|
|
18213
18213
|
}
|
|
18214
|
-
async function projectPages(root,
|
|
18214
|
+
async function projectPages(root, project) {
|
|
18215
18215
|
const fixed = [];
|
|
18216
18216
|
const dynamic = [];
|
|
18217
18217
|
const add = (segments) => {
|
|
@@ -18221,7 +18221,7 @@ async function projectPages(root, stack) {
|
|
|
18221
18221
|
else
|
|
18222
18222
|
fixed.push(normalizePagePath(path2));
|
|
18223
18223
|
};
|
|
18224
|
-
if (stack === "astro") {
|
|
18224
|
+
if (project.stack === "astro") {
|
|
18225
18225
|
const walk2 = async (folder, segments) => {
|
|
18226
18226
|
for (const name of (await readdir6(folder).catch(() => [])).sort()) {
|
|
18227
18227
|
const full = join18(folder, name);
|
|
@@ -18237,7 +18237,7 @@ async function projectPages(root, stack) {
|
|
|
18237
18237
|
}
|
|
18238
18238
|
}
|
|
18239
18239
|
};
|
|
18240
|
-
await walk2(join18(root, "src", "pages"), []);
|
|
18240
|
+
await walk2(join18(root, project.astroSrcDir ?? "src", "pages"), []);
|
|
18241
18241
|
} else {
|
|
18242
18242
|
for (const app of ["app", "src/app"]) {
|
|
18243
18243
|
const walk2 = async (folder, segments) => {
|
|
@@ -18769,7 +18769,7 @@ async function checkUrlCommand(deps, input) {
|
|
|
18769
18769
|
const ignore = description.schema?.ignore ?? [];
|
|
18770
18770
|
const values = Object.fromEntries(Object.entries(content.data.fields).map(([id, field]) => [id, field.value]));
|
|
18771
18771
|
const confirmed = Boolean(task.data.contentConnectedAt) || hasConnectedSection(agents);
|
|
18772
|
-
const pages = await projectPages(deps.root, project
|
|
18772
|
+
const pages = await projectPages(deps.root, project);
|
|
18773
18773
|
const crawled = await crawl(fetch2, address, { start: pages.fixed, cookie: cookies.cookie || null, ...page2 ? { only: page2 } : {} });
|
|
18774
18774
|
const counts2 = crawled.pages.map(({ path: path2, page: read }) => countPage(read, { path: path2, values, fields, ignore }));
|
|
18775
18775
|
const search = await createSourceSearch(deps.root);
|
|
@@ -18802,6 +18802,7 @@ async function checkUrlCommand(deps, input) {
|
|
|
18802
18802
|
uncounted(`${page2 ?? "/"} (no page of text/html with status 200)`, page2 ?? "/", "no-page");
|
|
18803
18803
|
const comparisons = /* @__PURE__ */ new Map();
|
|
18804
18804
|
const baselineRefused = [];
|
|
18805
|
+
const lostPages = [];
|
|
18805
18806
|
const next = { ...countFile };
|
|
18806
18807
|
if (confirmed) {
|
|
18807
18808
|
delete next.baseline;
|
|
@@ -18825,6 +18826,12 @@ async function checkUrlCommand(deps, input) {
|
|
|
18825
18826
|
wanted: republished.flatMap((field) => countFile.firstContent?.[field]?.texts ?? [])
|
|
18826
18827
|
}));
|
|
18827
18828
|
}
|
|
18829
|
+
if (!page2) {
|
|
18830
|
+
const reached = /* @__PURE__ */ new Set([...crawled.pages.map(({ path: path2 }) => path2), ...crawled.failed.map(({ path: path2 }) => path2), ...crawled.overLimit]);
|
|
18831
|
+
for (const path2 of Object.keys(baseline.pages))
|
|
18832
|
+
if (!reached.has(path2) && !pageRuleFor(path2, ignore))
|
|
18833
|
+
lostPages.push(path2);
|
|
18834
|
+
}
|
|
18828
18835
|
next.baseline = baseline;
|
|
18829
18836
|
}
|
|
18830
18837
|
const units = unitsOf(counts2);
|
|
@@ -18896,6 +18903,12 @@ async function checkUrlCommand(deps, input) {
|
|
|
18896
18903
|
for (const line of excusedLines(path2, comparison))
|
|
18897
18904
|
deps.out(line);
|
|
18898
18905
|
}
|
|
18906
|
+
for (const path2 of lostPages) {
|
|
18907
|
+
red += 1;
|
|
18908
|
+
deps.out(`difference ${path2}: this page is in the baseline, but the count did not reach it today (no route, link or sitemap entry leads to it, or it answers as no page).`);
|
|
18909
|
+
deps.out(` If it is content, bring back its page and a link to it. If the user removed it on purpose, leave it out in siteplane.schema.ts: ignore: [{ path: ${JSON.stringify(path2)}, reason: "owner-wish" }].`);
|
|
18910
|
+
deps.out(` ${ON_PURPOSE}`);
|
|
18911
|
+
}
|
|
18899
18912
|
const documents = await projectDocuments(deps.root, {
|
|
18900
18913
|
contentFiles: [...new Set(counts2.flatMap((item) => item.pieces.filter((piece) => piece.status !== "bound").map((piece) => search(piece.text)?.file).filter((file) => Boolean(file))))],
|
|
18901
18914
|
texts: [...units.textsBound].map((path2) => valueText(values, path2)).filter((text) => Boolean(text))
|
|
@@ -18986,7 +18999,7 @@ async function keepBaseline(deps, input) {
|
|
|
18986
18999
|
return 0;
|
|
18987
19000
|
}
|
|
18988
19001
|
const project = await detectProject(deps.root);
|
|
18989
|
-
const pages = input.page ? { fixed: [], dynamic: [] } : await projectPages(deps.root, project
|
|
19002
|
+
const pages = input.page ? { fixed: [], dynamic: [] } : await projectPages(deps.root, project);
|
|
18990
19003
|
const crawled = await crawl(input.fetch, input.address, { start: pages.fixed, cookie: null, ...input.page ? { only: input.page } : {} });
|
|
18991
19004
|
if (crawled.pages.length === 0) {
|
|
18992
19005
|
deps.out(`Nothing to keep: ${input.address.origin}${input.address.base} answered with no page of text/html.`);
|
|
@@ -20640,7 +20653,7 @@ async function requestAgentConnection(input, deps) {
|
|
|
20640
20653
|
const headers = {
|
|
20641
20654
|
"content-type": "application/x-www-form-urlencoded",
|
|
20642
20655
|
accept: "application/json",
|
|
20643
|
-
...input.
|
|
20656
|
+
...input.siteplaneBypassSecret ? { "x-vercel-protection-bypass": input.siteplaneBypassSecret } : {}
|
|
20644
20657
|
};
|
|
20645
20658
|
const codeResponse = await deps.fetch(`${apiOrigin2}/api/cli/device/code`, {
|
|
20646
20659
|
method: "POST",
|
|
@@ -20730,7 +20743,7 @@ async function ensureAgentConnection(input, deps) {
|
|
|
20730
20743
|
agentName: detectAgentName(input.env),
|
|
20731
20744
|
machineName: machineName(deps.hostname ?? hostname),
|
|
20732
20745
|
openBrowser: shouldOpenBrowser(input.env, deps.platform ?? process.platform, input.args ?? []),
|
|
20733
|
-
...input.
|
|
20746
|
+
...input.siteplaneBypassSecret ? { siteplaneBypassSecret: input.siteplaneBypassSecret } : {}
|
|
20734
20747
|
}, deps);
|
|
20735
20748
|
const connection = { ...grant, purpose: input.purpose };
|
|
20736
20749
|
const path2 = await deps.connections.save(connection);
|
|
@@ -21405,11 +21418,16 @@ async function finishWrite(deps, ctx, result, sent, again, options) {
|
|
|
21405
21418
|
}
|
|
21406
21419
|
case "restore_refused": {
|
|
21407
21420
|
for (const field of answer.fields) {
|
|
21421
|
+
if (field.restoredVersion !== void 0) {
|
|
21422
|
+
deps.out(`${label(ctx, field.fieldId)} is restored already: version ${field.version} of ${shortDate3(field.publishedAt)} is version ${field.restoredVersion} again. ${field.previousVersion > 0 ? `To go back further, ask the user; then run it again with --version ${field.previousVersion}.` : "There is no earlier version to go back to."}`);
|
|
21423
|
+
continue;
|
|
21424
|
+
}
|
|
21408
21425
|
const who = field.person ?? "a person whose account no longer exists";
|
|
21409
21426
|
deps.out(`${label(ctx, field.fieldId)} was last published by ${who} on ${shortDate3(field.publishedAt)} (version ${field.version}). Ask the user before you undo it; then run it again with --version ${field.previousVersion}.`);
|
|
21410
21427
|
}
|
|
21411
21428
|
deps.out("Nothing was restored.");
|
|
21412
|
-
|
|
21429
|
+
const person = answer.fields.find((field) => field.restoredVersion === void 0);
|
|
21430
|
+
deps.out(person ? `Next: ask the user, then run npx siteplane content restore ${person.fieldId} --version ${person.previousVersion}.` : "Next: tell the user what is restored already; go back further only when they ask for it, with --version.");
|
|
21413
21431
|
return 1;
|
|
21414
21432
|
}
|
|
21415
21433
|
case "withdrawn": {
|
|
@@ -21559,7 +21577,7 @@ async function contentRestoreCommand(deps, input) {
|
|
|
21559
21577
|
|
|
21560
21578
|
// src/version.ts
|
|
21561
21579
|
init_esm_shims();
|
|
21562
|
-
var PACKAGE_VERSION = "0.3.
|
|
21580
|
+
var PACKAGE_VERSION = "0.3.6";
|
|
21563
21581
|
|
|
21564
21582
|
// src/bin/run-siteplane.ts
|
|
21565
21583
|
var usage = [
|
|
@@ -21855,15 +21873,16 @@ async function withAgentConnection(siteId, args, dependencies, send) {
|
|
|
21855
21873
|
apiBaseUrl,
|
|
21856
21874
|
accessToken: connection.accessToken,
|
|
21857
21875
|
siteId,
|
|
21858
|
-
...
|
|
21876
|
+
...readSiteplaneBypassSecret(dependencies.env)
|
|
21859
21877
|
});
|
|
21860
21878
|
};
|
|
21861
21879
|
const response = await attempt(false);
|
|
21862
21880
|
return response.status === 401 ? attempt(true) : response;
|
|
21863
21881
|
}
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21882
|
+
var SITEPLANE_BYPASS_VARIABLE = "SITEPLANE_VERCEL_BYPASS_SECRET";
|
|
21883
|
+
function readSiteplaneBypassSecret(env) {
|
|
21884
|
+
const secret = env[SITEPLANE_BYPASS_VARIABLE]?.trim();
|
|
21885
|
+
return secret ? { siteplaneBypassSecret: secret } : {};
|
|
21867
21886
|
}
|
|
21868
21887
|
function agentConnection(input, purpose) {
|
|
21869
21888
|
const connections = {
|
|
@@ -21880,7 +21899,7 @@ function agentConnection(input, purpose) {
|
|
|
21880
21899
|
env: input.env,
|
|
21881
21900
|
args: input.args,
|
|
21882
21901
|
forceNew,
|
|
21883
|
-
...
|
|
21902
|
+
...readSiteplaneBypassSecret(input.env)
|
|
21884
21903
|
},
|
|
21885
21904
|
{ ...input.device, connections }
|
|
21886
21905
|
),
|
|
@@ -21901,7 +21920,7 @@ function processRuntime() {
|
|
|
21901
21920
|
}
|
|
21902
21921
|
function createDefaultDependencies(runtime = processRuntime()) {
|
|
21903
21922
|
const store = { configDir: runtime.configDir };
|
|
21904
|
-
const bypass = runtime.env.
|
|
21923
|
+
const bypass = readSiteplaneBypassSecret(runtime.env).siteplaneBypassSecret;
|
|
21905
21924
|
const website = agentConnection({ store, env: runtime.env, args: runtime.args, device: runtime.device }, "website");
|
|
21906
21925
|
const booking = (args) => agentConnection({ store, env: runtime.env, args, device: runtime.device }, "booking");
|
|
21907
21926
|
const agentDependencies = {
|
package/dist/route.js
CHANGED
|
@@ -118,7 +118,7 @@ function readSiteId(payload) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// src/version.ts
|
|
121
|
-
var PACKAGE_VERSION = "0.3.
|
|
121
|
+
var PACKAGE_VERSION = "0.3.6";
|
|
122
122
|
|
|
123
123
|
// src/route.ts
|
|
124
124
|
var embeddable = { httpOnly: true, secure: true, sameSite: "none", partitioned: true, path: "/" };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siteplane",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.6",
|
|
5
5
|
"description": "Siteplane for Next.js and Astro websites: content from Siteplane, Draft Mode preview, Booking and the siteplane CLI.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@vercel/stega": "1.1.0",
|
|
79
79
|
"jiti": "2.7.0",
|
|
80
80
|
"typescript": "6.0.3",
|
|
81
|
-
"zod": "4.
|
|
81
|
+
"zod": "4.6.7"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"astro": ">=5 <8",
|