@parity-app/cli 0.6.1 → 0.6.2

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/bin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { a as errorCodes, i as closest, o as errorDetails, r as CodedError, s as readErrorDetails } from "./schema-BpGSCLEu.mjs";
3
- import { a as describeExec, c as describeProps, f as setCaller, i as describeConsole, l as describeStatus, n as describeAccessibility, o as describeModes, p as mcpCallerName, r as describeComponents, s as describeProblems, t as call, u as describeTokens } from "./client-CoW-KcnT.mjs";
2
+ import { a as CodedError, c as errorDetails, l as readErrorDetails, o as closest, s as errorCodes } from "./schema-zRNxotYl.mjs";
3
+ import { a as describeExec, c as describeProps, f as setCaller, i as describeConsole, l as describeStatus, n as describeAccessibility, o as describeModes, p as mcpCallerName, r as describeComponents, s as describeProblems, t as call, u as describeTokens } from "./client-BUaE9b77.mjs";
4
4
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
5
5
  import { dirname, join, normalize, relative, resolve, sep } from "node:path";
6
6
  import { parseArgs } from "node:util";
@@ -387,8 +387,8 @@ const executeOperation = {
387
387
  */
388
388
  async function runCheck(library, options) {
389
389
  if (!library) throw new Error("parity lib check <library> [--tab t] [--mode m]");
390
- const { applyLibraryEdits, componentNode, generateId, librarySource, parseLibraryEdits, withLibraryContext } = await import("./src-p0vFxRBz.mjs");
391
- const { registryDir, registryEntries } = await import("./src-Cr8pfFJE.mjs");
390
+ const { applyLibraryEdits, componentNode, generateId, librarySource, parseLibraryEdits, withLibraryContext } = await import("./src-BgQ7gnXE.mjs");
391
+ const { registryDir, registryEntries } = await import("./src-CiqdFzei.mjs");
392
392
  const entry = (await registryEntries()).find((item) => item.manifest.id === library);
393
393
  if (!entry) throw new Error(`The registry has no library "${library}"`);
394
394
  let manifest = entry.manifest;
@@ -516,8 +516,8 @@ function describeCheck(report) {
516
516
  * because it reads the project's files and its own copy of TypeScript.
517
517
  */
518
518
  async function runLib(packageName, options) {
519
- const { appManifestPath, generateLibrary, manifestText, mergeManifest, reviseLibrary } = await import("./src-Zm_PYFFH.mjs");
520
- const { covers, registryDir, registryEntries } = await import("./src-Cr8pfFJE.mjs");
519
+ const { appManifestPath, generateLibrary, manifestText, mergeManifest, reviseLibrary } = await import("./src-BvKhu6dX.mjs");
520
+ const { covers, registryDir, registryEntries } = await import("./src-CiqdFzei.mjs");
521
521
  const spec = packageName === void 0 ? void 0 : packageSpec(packageName);
522
522
  let root = resolve(options.root ?? ".");
523
523
  if (spec && (spec.version !== void 0 || options.registry && !options.root)) {
@@ -528,7 +528,7 @@ async function runLib(packageName, options) {
528
528
  console.error(`Installing ${spec.name} ${version} on its own…`);
529
529
  root = await installedVersion(spec.name, version);
530
530
  }
531
- const { parseLibraryEdits } = await import("./src-Zm_PYFFH.mjs");
531
+ const { parseLibraryEdits } = await import("./src-BvKhu6dX.mjs");
532
532
  const trialEdits = options.edits ? parseLibraryEdits(JSON.parse(await readFile(resolve(options.edits), "utf8"))) : void 0;
533
533
  const recordedId = options.registry && spec ? options.id ?? (await registryEntries()).find((entry) => entry.manifest.package?.name === spec.name)?.manifest.id : void 0;
534
534
  const appErrors = recordedId ? await readAppErrors(registryDir(), recordedId) : void 0;
@@ -1,4 +1,4 @@
1
- import { c as unknownReference, n as nonBlankString, r as CodedError, s as readErrorDetails, t as jsonText } from "./schema-BpGSCLEu.mjs";
1
+ import { a as CodedError, l as readErrorDetails, n as jsonText, r as nonBlankString, u as unknownReference } from "./schema-zRNxotYl.mjs";
2
2
  import { join } from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { readFileSync, readdirSync, realpathSync, rmSync } from "node:fs";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { t as call, n as describeAccessibility, r as describeComponents, i as describeConsole, a as describeExec, o as describeModes, s as describeProblems, c as describeProps, l as describeStatus, u as describeTokens, d as registry, f as setCaller } from "./client-CoW-KcnT.mjs";
1
+ export { t as call, n as describeAccessibility, r as describeComponents, i as describeConsole, a as describeExec, o as describeModes, s as describeProblems, c as describeProps, l as describeStatus, u as describeTokens, d as registry, f as setCaller } from "./client-BUaE9b77.mjs";
@@ -92,10 +92,18 @@ function errorDetails(error) {
92
92
  function readErrorDetails(value) {
93
93
  return errorDetailsSchema.safeParse(value).data;
94
94
  }
95
- z.record(z.string(), z.unknown());
95
+ // ../core/src/schema.ts
96
+ /**
97
+ * Checks for data Parity didn't make (PAR-578): files, agent input, environment variables, other programs' JSON. A zod
98
+ * schema is both the check and the type. A failed check reads as core's hand-written ones in `validate.ts` do: a JSON
99
+ * pointer to the value at fault, then what was expected there, as in `/containers/0/name: expected a string`.
100
+ */
101
+ /** An object with string keys, and not an array or null. */
102
+ const plainObject = z.record(z.string(), z.unknown());
96
103
  /** Text with something besides whitespace, trimmed. */
97
104
  const nonBlankString = z.string().trim().min(1, "can't be blank");
98
- z.number();
105
+ /** A number other than NaN or ±Infinity, which zod 4 refuses on its own. */
106
+ const finiteNumber = z.number();
99
107
  /** JSON text holding what `schema` checks. Text that isn't JSON fails as `expected JSON`. */
100
108
  function jsonText(schema) {
101
109
  return z.string().transform((text, context) => {
@@ -110,4 +118,4 @@ function jsonText(schema) {
110
118
  }
111
119
  }).pipe(schema);
112
120
  }
113
- export { errorCodes as a, unknownReference as c, closest as i, nonBlankString as n, errorDetails as o, CodedError as r, readErrorDetails as s, jsonText as t };
121
+ export { CodedError as a, errorDetails as c, plainObject as i, readErrorDetails as l, jsonText as n, closest as o, nonBlankString as r, errorCodes as s, finiteNumber as t, unknownReference as u };
@@ -1,4 +1,4 @@
1
- import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-C4faIpux.mjs";
1
+ import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-V9wTMkxO.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { readFile, readdir } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
@@ -1,3 +1,3 @@
1
- import "./schema-BpGSCLEu.mjs";
2
- export { a as applyLibraryEdits, t as componentNode, T as generateId, n as librarySource, f as parseLibraryEdits, i as withLibraryContext } from "./src-C4faIpux.mjs";
3
- import "./src-Zm_PYFFH.mjs";
1
+ import "./schema-zRNxotYl.mjs";
2
+ export { a as applyLibraryEdits, t as componentNode, T as generateId, n as librarySource, f as parseLibraryEdits, i as withLibraryContext } from "./src-V9wTMkxO.mjs";
3
+ import "./src-BvKhu6dX.mjs";
@@ -1,5 +1,6 @@
1
- import { D as collectCustomProperties, a as applyLibraryEdits, c as isSampleElement, f as parseLibraryEdits, j as lengthToPixels, l as isSampleRender, m as renderSlotOf, p as parseLibraryManifest, s as isMadeValue, u as libraryManifestExtension } from "./src-C4faIpux.mjs";
2
- import "./src-5CrSA_RX.mjs";
1
+ import { i as plainObject, t as finiteNumber } from "./schema-zRNxotYl.mjs";
2
+ import { D as collectCustomProperties, a as applyLibraryEdits, c as isSampleElement, f as parseLibraryEdits, j as lengthToPixels, l as isSampleRender, m as renderSlotOf, p as parseLibraryManifest, s as isMadeValue, u as libraryManifestExtension } from "./src-V9wTMkxO.mjs";
3
+ import "./src-BIVDlIGc.mjs";
3
4
  import { a as publishedVersions, n as packageFile, o as repositoryFiles, r as publishedSource } from "./published-CdXoUgfD.mjs";
4
5
  import { createRequire } from "node:module";
5
6
  import { mkdir, readFile, readdir, realpath, rm, stat, writeFile } from "node:fs/promises";
@@ -8,6 +9,7 @@ import { promisify } from "node:util";
8
9
  import { createHash } from "node:crypto";
9
10
  import { existsSync, realpathSync } from "node:fs";
10
11
  import { homedir } from "node:os";
12
+ import { z } from "zod";
11
13
  import { pathToFileURL } from "node:url";
12
14
  import ts from "typescript";
13
15
  import "semver";
@@ -548,6 +550,182 @@ function parseJsonc(text) {
548
550
  }
549
551
  return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
550
552
  }
553
+ // ../tokens/src/dtcg-values.ts
554
+ /** A value written as CSS. */
555
+ const css = z.string();
556
+ const colorSpace = z.enum([
557
+ "srgb",
558
+ "srgb-linear",
559
+ "hsl",
560
+ "hwb",
561
+ "lab",
562
+ "lch",
563
+ "oklab",
564
+ "oklch",
565
+ "display-p3",
566
+ "a98-rgb",
567
+ "prophoto-rgb",
568
+ "rec2020",
569
+ "xyz-d65",
570
+ "xyz-d50"
571
+ ]);
572
+ const colorObject = z.object({
573
+ colorSpace,
574
+ components: z.array(z.union([finiteNumber, z.literal("none")])).length(3, "expected 3 components"),
575
+ alpha: finiteNumber.min(0).max(1).optional(),
576
+ hex: z.string().regex(/^#[\da-f]{6}$/i, "expected a 6-digit hex color such as #0a0a0a").optional()
577
+ });
578
+ const color = z.union([css, colorObject]);
579
+ const dimensionObject = z.object({
580
+ value: finiteNumber,
581
+ unit: z.string().regex(/^([a-z]+|%)$/i, "expected a unit such as px or rem")
582
+ });
583
+ const dimension = z.union([css, dimensionObject]);
584
+ const duration = z.union([css, z.object({
585
+ value: finiteNumber,
586
+ unit: z.enum(["ms", "s"])
587
+ })]);
588
+ /** A cubic Bézier's x coordinates, which CSS keeps between 0 and 1. */
589
+ const unitInterval = finiteNumber.min(0).max(1);
590
+ const cubicBezier = z.union([css, z.tuple([
591
+ unitInterval,
592
+ finiteNumber,
593
+ unitInterval,
594
+ finiteNumber
595
+ ])]);
596
+ const fontFamily = z.union([css, z.array(z.string()).min(1)]);
597
+ const fontWeight = z.union([css, finiteNumber.min(1).max(1e3)]);
598
+ const number = z.union([css, finiteNumber]);
599
+ const strokeStyle = z.union([css, z.object({
600
+ dashArray: z.array(dimension).min(1),
601
+ lineCap: z.enum([
602
+ "round",
603
+ "butt",
604
+ "square"
605
+ ])
606
+ })]);
607
+ const border = z.union([css, z.object({
608
+ color,
609
+ width: dimension,
610
+ style: strokeStyle
611
+ })]);
612
+ const transition = z.union([css, z.object({
613
+ duration,
614
+ delay: duration,
615
+ timingFunction: cubicBezier
616
+ })]);
617
+ const shadowLayer = z.object({
618
+ color,
619
+ offsetX: dimension.default("0"),
620
+ offsetY: dimension.default("0"),
621
+ blur: dimension.default("0"),
622
+ spread: dimension.default("0"),
623
+ inset: z.boolean().default(false)
624
+ });
625
+ const shadow = z.union([
626
+ css,
627
+ shadowLayer,
628
+ z.array(z.union([css, shadowLayer])).min(1)
629
+ ]);
630
+ const gradient = z.union([css, z.array(z.object({
631
+ color,
632
+ position: finiteNumber
633
+ })).min(1)]);
634
+ const typography = z.union([css, z.object({
635
+ fontFamily,
636
+ fontSize: dimension,
637
+ fontWeight: fontWeight.default("normal"),
638
+ letterSpacing: dimension.optional(),
639
+ lineHeight: z.union([number, dimensionObject]).optional()
640
+ })]);
641
+ border.transform(borderCss), color.transform(colorCss), cubicBezier.transform(cubicBezierCss), dimension.transform(dimensionCss), duration.transform(dimensionCss), fontFamily.transform(fontFamilyCss), fontWeight.transform(String), gradient.transform(gradientCss), number.transform(String), shadow.transform(shadowCss), strokeStyle.transform(strokeStyleCss), transition.transform(transitionCss), typography.transform(typographyCss);
642
+ const colorFunctions = /* @__PURE__ */ new Set([
643
+ "hsl",
644
+ "hwb",
645
+ "lab",
646
+ "lch",
647
+ "oklab",
648
+ "oklch"
649
+ ]);
650
+ function colorCss(value) {
651
+ if (typeof value === "string") return value;
652
+ const alpha = value.alpha !== void 0 && value.alpha < 1 ? value.alpha : void 0;
653
+ if (value.hex && alpha === void 0) return value.hex;
654
+ const slash = alpha === void 0 ? "" : ` / ${alpha}`;
655
+ if (value.colorSpace === "srgb") {
656
+ const [r, g, b] = value.components.map((part) => part === "none" ? part : Math.round(part * 255));
657
+ return `rgb(${r} ${g} ${b}${slash})`;
658
+ }
659
+ const components = value.components.join(" ");
660
+ if (colorFunctions.has(value.colorSpace)) return `${value.colorSpace}(${components}${slash})`;
661
+ return `color(${value.colorSpace} ${components}${slash})`;
662
+ }
663
+ function dimensionCss(value) {
664
+ return typeof value === "string" ? value : `${value.value}${value.unit}`;
665
+ }
666
+ function cubicBezierCss(value) {
667
+ return typeof value === "string" ? value : `cubic-bezier(${value.join(", ")})`;
668
+ }
669
+ function fontFamilyCss(value) {
670
+ return typeof value === "string" ? value : value.map(fontName).join(", ");
671
+ }
672
+ function fontName(name) {
673
+ return /^[\w-]+$/.test(name) ? name : `"${name}"`;
674
+ }
675
+ /** A stroke style as CSS: a border can't draw a dash pattern, so one is written as dashed. */
676
+ function strokeStyleCss(value) {
677
+ return typeof value === "string" ? value : "dashed";
678
+ }
679
+ function borderCss(value) {
680
+ if (typeof value === "string") return value;
681
+ return `${dimensionCss(value.width)} ${strokeStyleCss(value.style)} ${colorCss(value.color)}`;
682
+ }
683
+ function transitionCss(value) {
684
+ if (typeof value === "string") return value;
685
+ return `${dimensionCss(value.duration)} ${cubicBezierCss(value.timingFunction)} ${dimensionCss(value.delay)}`;
686
+ }
687
+ function shadowCss(value) {
688
+ if (typeof value === "string") return value;
689
+ return (Array.isArray(value) ? value : [value]).map((layer) => typeof layer === "string" ? layer : shadowLayerCss(layer)).join(", ");
690
+ }
691
+ function shadowLayerCss(layer) {
692
+ const lengths = [
693
+ layer.offsetX,
694
+ layer.offsetY,
695
+ layer.blur,
696
+ layer.spread
697
+ ].map(dimensionCss).join(" ");
698
+ return `${layer.inset ? "inset " : ""}${lengths} ${colorCss(layer.color)}`;
699
+ }
700
+ function gradientCss(value) {
701
+ if (typeof value === "string") return value;
702
+ return `linear-gradient(${value.map((stop) => `${colorCss(stop.color)} ${Math.round(stop.position * 1e3) / 10}%`).join(", ")})`;
703
+ }
704
+ function typographyCss(value) {
705
+ if (typeof value === "string") return value;
706
+ const { lineHeight } = value;
707
+ const line = lineHeight === void 0 ? "" : `/${typeof lineHeight === "object" ? dimensionCss(lineHeight) : lineHeight}`;
708
+ return `${value.fontWeight} ${dimensionCss(value.fontSize)}${line} ${fontFamilyCss(value.fontFamily)}`;
709
+ }
710
+ // ../tokens/src/dtcg.ts
711
+ /** Token groups, or `$ref`s to them in this file or another. */
712
+ const tokenSources = z.array(plainObject);
713
+ z.object({ sources: tokenSources });
714
+ const resolverModifier = z.object({
715
+ contexts: z.record(z.string(), tokenSources).transform((contexts) => new Map(Object.entries(contexts))),
716
+ default: z.string().optional()
717
+ });
718
+ z.object({ $ref: z.string() });
719
+ resolverModifier.extend({ name: z.string().optional() });
720
+ z.object({
721
+ $type: z.string().optional(),
722
+ $description: z.string().optional(),
723
+ $extensions: z.object({ parity: z.object({
724
+ var: z.string().optional(),
725
+ category: z.string().optional(),
726
+ lineHeight: z.string().optional()
727
+ }).optional() }).optional()
728
+ });
551
729
  // ../tokens/src/policy.ts
552
730
  /**
553
731
  * At-rules that don't pick a theme: a cascade layer only orders rules, and a feature check holds whatever the theme.
@@ -1 +1 @@
1
- export { t as covers, n as registryDir, r as registryEntries } from "./src-5CrSA_RX.mjs";
1
+ export { t as covers, n as registryDir, r as registryEntries } from "./src-BIVDlIGc.mjs";
@@ -1,4 +1,4 @@
1
- import "./schema-BpGSCLEu.mjs";
1
+ import "./schema-zRNxotYl.mjs";
2
2
  import { z } from "zod";
3
3
  // ../core/src/adapters.ts
4
4
  const packageVersions = z.record(z.string(), z.string());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity-app/cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Drive the Parity app from a terminal or an agent: read state, run edits, take screenshots, serve MCP.",