siteplane 0.1.55 → 0.1.57

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.
@@ -1409,9 +1409,17 @@ var editorSectionSchema = z16.object({
1409
1409
  });
1410
1410
  var editorRouteSchema = z16.object({
1411
1411
  routeKey: siteFieldRouteKeySchema,
1412
+ previewPath: z16.string().trim().refine((path) => path.startsWith("/") && !path.startsWith("//") && !/[\\\[\]?#\s]/u.test(path) && (path === "/" || !path.endsWith("/")), "previewPath must be a concrete same-site path, for example /services/consultation.").optional(),
1412
1413
  label: z16.string().trim().min(1),
1413
1414
  sections: z16.array(editorSectionSchema).min(1)
1414
1415
  }).strict().superRefine((route, context) => {
1416
+ if (route.routeKey.includes("[") && !route.previewPath) {
1417
+ context.addIssue({
1418
+ code: "custom",
1419
+ path: ["previewPath"],
1420
+ message: "Dynamic editor routes need a previewPath for an existing page; keep the canonical routeKey unchanged."
1421
+ });
1422
+ }
1415
1423
  const sections = /* @__PURE__ */ new Set();
1416
1424
  for (const [index, section] of route.sections.entries()) {
1417
1425
  if (sections.has(section.label)) {
@@ -5471,8 +5479,8 @@ async function setupPrepareCommand(input) {
5471
5479
  if (context.status !== "ok")
5472
5480
  return context;
5473
5481
  const task = context.task;
5474
- if (task.site?.siteId !== config.siteId || task.run?.runId !== config.runId || task.packages.siteplane !== config.packages.siteplane || task.packages.analytics !== config.packages.analytics || task.packages.runtimeNext !== config.packages.runtimeNext) {
5475
- throw new SetupFailure("setup_contract_conflict", "The local configuration does not match this server task and its exact package versions.");
5482
+ if (task.site?.siteId !== config.siteId || task.run?.runId !== config.runId) {
5483
+ throw new SetupFailure("setup_contract_conflict", "The local configuration does not match this server task's site and setup run.");
5476
5484
  }
5477
5485
  if (task.run.status === "completed" || task.run.status === "ready_for_review")
5478
5486
  return {
@@ -5589,7 +5597,8 @@ ${layoutSource.slice(0, point)}<SiteplaneBridge />${layoutSource.slice(point)}`)
5589
5597
  files.set(nextPath, `import { withSiteplane } from "siteplane/next";
5590
5598
  ${nextSource.slice(0, expression.getStart(ast))}withSiteplane(${expression.getText(ast)})${nextSource.slice(expression.end)}`);
5591
5599
  }
5592
- files.set(join10(directory, ".siteplane/setup-guide-v2.md"), `# Siteplane setup task v2
5600
+ const guidePath = join10(directory, ".siteplane/setup-guide-v2.md");
5601
+ files.set(guidePath, `# Siteplane setup task v2
5593
5602
 
5594
5603
  ${task.goal}
5595
5604
 
@@ -5600,11 +5609,13 @@ ${task.discovery.rules.map((rule) => `- ${rule}`).join("\n")}
5600
5609
  Run setup context for the current user instructions and authorized modules. Keep the user instructions distinct from your selection summary. Use setup deploy --wait for environment transfer and deployment; never read or print credential values. For image fields, withSiteplane prepares the exact Siteplane asset route and the website /siteplane-assets/ path in Next Image and existing img-src policies at build time. This grants no hosting permission. Preserve existing image sources; explicitly resolve custom loaders, redirect dependencies, or CSP written by middleware/proxy/meta tags before deployment. Use the provider-selected public SITEPLANE_SITE_ORIGIN for local builds.
5601
5610
  `);
5602
5611
  for (const [path, content] of files) {
5603
- if (path === layoutPath || path === nextPath)
5612
+ if (path === layoutPath || path === nextPath || path === guidePath)
5604
5613
  continue;
5605
5614
  if (await exists3(path) && await readFile10(path, "utf8") !== content)
5606
5615
  throw new SetupFailure("owned_file_conflict", `Preserve the existing ${relative6(directory, path)} and reconcile its integration with the current Siteplane guide before retrying.`);
5607
5616
  }
5617
+ files.set(configPath, `${JSON.stringify({ ...config, packages: task.packages }, null, 2)}
5618
+ `);
5608
5619
  for (const path of files.keys())
5609
5620
  await assertSourcePath(directory, path);
5610
5621
  const before = /* @__PURE__ */ new Map();
package/dist/index.js CHANGED
@@ -1137,9 +1137,17 @@ var editorSectionSchema = z16.object({
1137
1137
  });
1138
1138
  var editorRouteSchema = z16.object({
1139
1139
  routeKey: siteFieldRouteKeySchema,
1140
+ previewPath: z16.string().trim().refine((path) => path.startsWith("/") && !path.startsWith("//") && !/[\\\[\]?#\s]/u.test(path) && (path === "/" || !path.endsWith("/")), "previewPath must be a concrete same-site path, for example /services/consultation.").optional(),
1140
1141
  label: z16.string().trim().min(1),
1141
1142
  sections: z16.array(editorSectionSchema).min(1)
1142
1143
  }).strict().superRefine((route, context) => {
1144
+ if (route.routeKey.includes("[") && !route.previewPath) {
1145
+ context.addIssue({
1146
+ code: "custom",
1147
+ path: ["previewPath"],
1148
+ message: "Dynamic editor routes need a previewPath for an existing page; keep the canonical routeKey unchanged."
1149
+ });
1150
+ }
1143
1151
  const sections = /* @__PURE__ */ new Set();
1144
1152
  for (const [index, section] of route.sections.entries()) {
1145
1153
  if (sections.has(section.label)) {
package/dist/next.js CHANGED
@@ -1340,9 +1340,17 @@ var editorSectionSchema = z16.object({
1340
1340
  });
1341
1341
  var editorRouteSchema = z16.object({
1342
1342
  routeKey: siteFieldRouteKeySchema,
1343
+ previewPath: z16.string().trim().refine((path) => path.startsWith("/") && !path.startsWith("//") && !/[\\\[\]?#\s]/u.test(path) && (path === "/" || !path.endsWith("/")), "previewPath must be a concrete same-site path, for example /services/consultation.").optional(),
1343
1344
  label: z16.string().trim().min(1),
1344
1345
  sections: z16.array(editorSectionSchema).min(1)
1345
1346
  }).strict().superRefine((route, context) => {
1347
+ if (route.routeKey.includes("[") && !route.previewPath) {
1348
+ context.addIssue({
1349
+ code: "custom",
1350
+ path: ["previewPath"],
1351
+ message: "Dynamic editor routes need a previewPath for an existing page; keep the canonical routeKey unchanged."
1352
+ });
1353
+ }
1346
1354
  const sections = /* @__PURE__ */ new Set();
1347
1355
  for (const [index, section] of route.sections.entries()) {
1348
1356
  if (sections.has(section.label)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "siteplane",
3
3
  "private": false,
4
- "version": "0.1.55",
4
+ "version": "0.1.57",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "publishConfig": {