youiyoux 0.1.4 → 0.1.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.
@@ -4,10 +4,10 @@ import {
4
4
  loadPackage,
5
5
  readTryIndex,
6
6
  send
7
- } from "./chunk-XAEMVEYX.js";
7
+ } from "./chunk-5YVH6NHT.js";
8
8
  import {
9
9
  writeFileAtomic
10
- } from "./chunk-NYDJYMID.js";
10
+ } from "./chunk-DP54SKL4.js";
11
11
 
12
12
  // ../../apps/web/scripts/discover-thumbs.ts
13
13
  import { existsSync, readFileSync } from "node:fs";
@@ -2,10 +2,10 @@ import { createRequire as __youiRequire } from "node:module"; import { dirname a
2
2
 
3
3
  // src/hub-packages.js
4
4
  var PACKAGES = {
5
- core: () => import("./src-RHNZELGE.js"),
6
- scanner: () => import("./src-LLV7IY6W.js"),
7
- discover: () => import("./src-SFKFERZ2.js"),
8
- tokens: () => import("./src-5IP4NGKT.js")
5
+ core: () => import("./src-URZDH3QH.js"),
6
+ scanner: () => import("./src-6HTTOVZ5.js"),
7
+ discover: () => import("./src-7RRKYIAS.js"),
8
+ tokens: () => import("./src-4VYLEZ3Z.js")
9
9
  };
10
10
  var loadPackage = (name) => PACKAGES[name]();
11
11
 
@@ -9,7 +9,7 @@ import {
9
9
  scanProject,
10
10
  screenSlug,
11
11
  tokenImpact
12
- } from "./chunk-52KOKYY6.js";
12
+ } from "./chunk-RHXBYN4W.js";
13
13
  import {
14
14
  buildTokens,
15
15
  contrastText,
@@ -18,7 +18,7 @@ import {
18
18
  resolverLayout,
19
19
  ringOffset,
20
20
  systemPairs
21
- } from "./chunk-YJ7WMBTT.js";
21
+ } from "./chunk-VOSWAWKC.js";
22
22
  import {
23
23
  BUILT_IN_CHECKS,
24
24
  COMPONENT_STATES,
@@ -45,7 +45,7 @@ import {
45
45
  toPosix,
46
46
  tokenValueProblems,
47
47
  writeFileAtomic
48
- } from "./chunk-NYDJYMID.js";
48
+ } from "./chunk-DP54SKL4.js";
49
49
  import {
50
50
  __toESM
51
51
  } from "./chunk-WNTS7ZO4.js";
@@ -12365,7 +12365,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
12365
12365
  var NONE = 0;
12366
12366
  var ASSUMED = 1;
12367
12367
  var PROVEN = 2;
12368
- function isRecursive(inst, stack, resolve) {
12368
+ function isRecursive(inst, stack, resolve2) {
12369
12369
  const cached2 = recursive.get(inst);
12370
12370
  if (cached2 !== void 0)
12371
12371
  return cached2 ? PROVEN : NONE;
@@ -12375,7 +12375,7 @@ function isRecursive(inst, stack, resolve) {
12375
12375
  let result = NONE;
12376
12376
  const check2 = (child) => {
12377
12377
  if (result !== PROVEN && child?._zod) {
12378
- const answer = isRecursive(child, stack, resolve);
12378
+ const answer = isRecursive(child, stack, resolve2);
12379
12379
  if (answer > result)
12380
12380
  result = answer;
12381
12381
  }
@@ -12386,7 +12386,7 @@ function isRecursive(inst, stack, resolve) {
12386
12386
  const desc = Object.getOwnPropertyDescriptor(sh, key);
12387
12387
  if (spread && !desc.enumerable)
12388
12388
  continue;
12389
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
12389
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve2) : NONE;
12390
12390
  if (child > answer)
12391
12391
  answer = child;
12392
12392
  }
@@ -12450,7 +12450,7 @@ function isRecursive(inst, stack, resolve) {
12450
12450
  break;
12451
12451
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
12452
12452
  case "lazy": {
12453
- const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
12453
+ const inner = def._cachedInner ?? (resolve2 ? inst._zod.innerType : void 0);
12454
12454
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
12455
12455
  break;
12456
12456
  }
@@ -27178,6 +27178,7 @@ ${hunks.join("\n")}
27178
27178
 
27179
27179
  // ../core/src/files.ts
27180
27180
  var import_yaml = __toESM(require_dist(), 1);
27181
+ import { existsSync, statSync } from "node:fs";
27181
27182
  import * as fsp from "node:fs/promises";
27182
27183
  import { mkdir, readdir, readFile, rename, writeFile } from "node:fs/promises";
27183
27184
  import { randomBytes } from "node:crypto";
@@ -27293,6 +27294,17 @@ async function readDefinition(file2, schema, displayRoot) {
27293
27294
  }
27294
27295
  return parseDefinition(label, text, schema);
27295
27296
  }
27297
+ function findUp(start, file2, owner = process.getuid?.()) {
27298
+ let found = null;
27299
+ for (let dir = nodePath.resolve(start); ; dir = dirname(dir)) {
27300
+ if (found === null && existsSync(join(dir, file2))) {
27301
+ if (owner !== void 0 && statSync(join(dir, file2)).uid !== owner) return null;
27302
+ found = dir;
27303
+ }
27304
+ if (existsSync(join(dir, ".git"))) return found;
27305
+ if (dirname(dir) === dir) return null;
27306
+ }
27307
+ }
27296
27308
  async function writeFileAtomic(file2, content) {
27297
27309
  await mkdir(dirname(file2), { recursive: true });
27298
27310
  const temp = join(dirname(file2), `.${process.pid}.${randomBytes(6).toString("hex")}.tmp`);
@@ -27768,6 +27780,12 @@ function normalizeRelPath(path) {
27768
27780
  }
27769
27781
  var RelPath = external_exports.string().min(1).refine((p) => !p.startsWith("/") && !normalizeRelPath(p).split("/").includes(".."), "expected a path relative to its root, without ..");
27770
27782
  var IsoTime4 = external_exports.string().datetime({ offset: true });
27783
+ var PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
27784
+ var PackageName = external_exports.string().regex(PACKAGE_NAME, "expected an npm package name such as @acme/design");
27785
+ var GIT_URL = /^(?:(?:https|file):\/\/(?![^\s/]*@)[^\s]+|ssh:\/\/[^\s]+|git@[A-Za-z0-9.-]+:[^\s:]+|github:[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)$/;
27786
+ var GitUrl = external_exports.string().regex(GIT_URL, "expected a git URL: https://, ssh://, git@host:path, github:owner/repo or file://").refine((url2) => !url2.includes("::"), "expected a git URL without a transport prefix");
27787
+ var GitRef = external_exports.string().regex(/^(?!-)(?!.*\.\.)[A-Za-z0-9._/-]+$/, "expected a branch, tag or commit such as v3 or main");
27788
+ var expandGitSource = (url2) => url2.startsWith("github:") ? `https://github.com/${url2.slice("github:".length)}.git` : url2;
27771
27789
  var SystemConfig = external_exports.object({
27772
27790
  id: external_exports.string().regex(/^[a-z][a-z0-9-]*$/, { error: ({ input: input2 }) => safeId(input2) === null ? `Invalid system id ${JSON.stringify(input2)}: use a plain name without ".." or path separators` : `Invalid system id ${JSON.stringify(input2)}: use lowercase letters, digits and hyphens, starting with a letter` }),
27773
27791
  name: external_exports.string().min(1),
@@ -27839,8 +27857,15 @@ var ProjectConfig = external_exports.object({
27839
27857
  schema: external_exports.literal("youi.project/v1"),
27840
27858
  id: external_exports.string().regex(/^[a-z][a-z0-9-]*$/),
27841
27859
  system: external_exports.string(),
27842
- /** Path to the design repo checkout (the directory holding youi.config.json), relative to this config file or absolute. */
27843
- source: external_exports.object({ path: external_exports.string().min(1) }),
27860
+ /**
27861
+ * Where the design system is: `path`, its checkout (the directory holding youi.config.json),
27862
+ * relative to this config file or absolute; or `package`, an npm package that holds
27863
+ * youi.config.json, found in the product's node_modules (a published design package, or a
27864
+ * monorepo's workspace package), so the config names no machine's folders; or `git`, a
27865
+ * repository at `ref` (a tag, branch or commit), fetched into a cache and pinned by the
27866
+ * lockfile's commit.
27867
+ */
27868
+ source: external_exports.union([external_exports.object({ path: external_exports.string().min(1) }).strict(), external_exports.object({ package: PackageName }).strict(), external_exports.object({ git: GitUrl, ref: GitRef }).strict()]),
27844
27869
  /** The product root, relative to this config file or absolute; for a config kept outside the product. Default: the --project directory. */
27845
27870
  root: external_exports.string().min(1).optional(),
27846
27871
  tsconfig: RelPath.default("tsconfig.json"),
@@ -28368,7 +28393,7 @@ function validateGraph(system) {
28368
28393
  }
28369
28394
  var DESIGN_CONFIG_FILE = "youi.config.json";
28370
28395
  async function loadDesignRepo(root) {
28371
- if (await readTextOrNull(join3(root, DESIGN_CONFIG_FILE)) === null) throw new DefinitionError(root, [`no ${DESIGN_CONFIG_FILE}: not a design repo (pass --design <dir>, or set source.path in youi.project.json)`]);
28396
+ if (await readTextOrNull(join3(root, DESIGN_CONFIG_FILE)) === null) throw new DefinitionError(root, [`no ${DESIGN_CONFIG_FILE}: not a design repo (pass --design <dir>, or set source in youi.project.json to its path or package)`]);
28372
28397
  const config2 = await readDefinition(join3(root, DESIGN_CONFIG_FILE), DesignConfig, root);
28373
28398
  const systems = await Promise.all(
28374
28399
  config2.systems.map((system) => loadSystem(root, { ...system, tokens: normalizeRelPath(system.tokens), components: normalizeRelPath(system.components), rules: normalizeRelPath(system.rules), support: system.support.map(normalizeRelPath) }))
@@ -28473,6 +28498,7 @@ export {
28473
28498
  findFiles,
28474
28499
  parseDefinition,
28475
28500
  readDefinition,
28501
+ findUp,
28476
28502
  writeFileAtomic,
28477
28503
  readTextOrNull,
28478
28504
  GAP_STATUSES,
@@ -28542,6 +28568,8 @@ export {
28542
28568
  tokenValueProblems,
28543
28569
  validateTokenSets,
28544
28570
  normalizeRelPath,
28571
+ PACKAGE_NAME,
28572
+ expandGitSource,
28545
28573
  SystemConfig,
28546
28574
  DesignConfig,
28547
28575
  RouteMapEntry,