@zappie/check 0.6.20 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @zappie/check
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b5b272b: `zappie check` has an `unused` step. It follows imports from what React Router and the Worker load and reports each file under `app/` that nothing imports (`unused/file`), each export no other file imports (`unused/export`) and each export only tests import (`unused/test-only`). They warn. Set `unused: { fail: true }` in `zappie.config.ts` to fail the step on them. `validateConfig` checks the new key.
8
+
9
+ The starter drops the copied `category-nav`, `menu-page` and `item-sheet.tsx` kit parts nothing used, and the exports only its own files read.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [b5b272b]
14
+ - @zappie/sdk@0.19.0
15
+
16
+ ## 0.7.0
17
+
18
+ ### Minor Changes
19
+
20
+ - b2d1af9: A page's first load carries only the CSS it draws.
21
+
22
+ `zappie check` warns with `css/root-route-css` when a stylesheet `app/root` loads holds classes that only one route or an overlay writes, and names the modules that write them. Its budgets step reports each route's first-load CSS as `budgets/css-route`.
23
+
24
+ `zappie verify` records the CSS the home page and the menu load first, `homeCssFirstLoadKbGz` and `menuCssFirstLoadKbGz`, and the share of it left unused, `homeCssUnusedPercent` and `menuCssUnusedPercent`. V14 warns with `css_unused` above 50% unused. `findRegressions` flags first-load CSS that grows past 5% or 0.5 KiB.
25
+
26
+ Two new budgets in `zappie.config.ts`, with no default, turn those warnings into failures for a site that opts in. `budgets.routeCssKbGz` sets a CSS limit per page, keyed by React Router route id, such as `{ "routes/menu": 4, "routes/order": 3 }`, or one number for every route. `zappie check` fails a route over its limit, a route the record leaves out and a key that names no route, and prints a record to paste in, each value the route's measured figure plus 10 percent, rounded up to the next half KiB. V14 fails the home page or the menu over the limit of the route it renders, and warns with `route_css_unbudgeted` when it can't find one. Set in either form, `routeCssKbGz` replaces `budgets.cssKbGz`, which `zappie check` then only reports. `budgets.unusedCssPercent` fails V14 above that unused share.
27
+
28
+ The kit's order status stylesheet keeps only the layout the order parts need, about 0.36 KiB gzipped instead of 0.82 KiB, and draws the Removed label in the body text colour, which every theme keeps at 4.5:1 or more (order-status 2.0.1). Every kit component imports its own stylesheet.
29
+
30
+ The starter splits its stylesheet into a shared base, each route's styles and each overlay's styles, and loads an overlay's styles with its deferred chunk, so the menu's first load no longer carries the branch picker, the bag, the order list or the account pages. It sets each route's CSS limit from its measured size.
31
+
32
+ - 59968bd: Every storefront shows "Powered by Zappie" in its footer, linking to https://zappie.ai, and nothing turns it off.
33
+
34
+ `PoweredByZappie` from `@zappie/foundations` renders the link with a `data-zappie-attribution` marker. It takes the colour of the text around it and never renders under the site's small text or 11px.
35
+
36
+ Verify's new V21 opens the home, start, content, item, cart and closed pages at 390 and 1440 px and fails a page whose footer doesn't show the link readably: missing, outside the footer, linked elsewhere, hidden, faded, clipped, covered, off screen, under 11px or under 4.5:1 contrast. Every run includes it, whatever `only`, a check set or `zappie.config.ts` says. The failure names the page and the reason.
37
+
38
+ The check's lint step adds `lint/powered-by-zappie`, outside ESLint so no config or comment turns it off: a site with no attribution fails, and one outside any footer the source writes is a warning.
39
+
40
+ The starter's pages and its closed page show `PoweredByZappie` in their footer.
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [b2d1af9]
45
+ - @zappie/sdk@0.18.0
46
+
3
47
  ## 0.6.20
4
48
 
5
49
  ### Patch Changes
package/README.md CHANGED
@@ -11,19 +11,24 @@ npx zappie check
11
11
 
12
12
  `zappie check` runs these steps in order and stops at the first that fails. Pass `--all` to run every step anyway.
13
13
 
14
- | Step | What it looks at |
15
- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
- | `config` | `zappie.config.ts` and `theme.json`, against the SDK and token rules |
17
- | `allowlist` | Dependencies, devDependencies and lockfile install scripts, against Zappie's allowlists |
18
- | `audit` | High and critical dependency advisories, with critical findings enforced on request |
19
- | `lint` | The `eslint-plugin-zappie` rules and the `jsx-a11y` accessibility baseline. The security rules run on every source file, whatever your ESLint config says |
20
- | `types` | A TypeScript check of the project |
21
- | `test` | Your project's tests |
22
- | `build` | A production build, and one pass over its output for the problems below |
23
- | `secrets` | No secret keys or tokens in your source or build |
24
- | `readiness` | Initial route discovery is enabled, or the config records why the site opts out |
25
- | `budgets` | Built JavaScript and CSS sizes, against Zappie's default budgets or the ones in your config |
26
- | `css` | Your source CSS and class names, and the built client CSS, for the problems below |
14
+ | Step | What it looks at |
15
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | `config` | `zappie.config.ts` and `theme.json`, against the SDK and token rules |
17
+ | `allowlist` | Dependencies, devDependencies and lockfile install scripts, against Zappie's allowlists |
18
+ | `audit` | High and critical dependency advisories, with critical findings enforced on request |
19
+ | `lint` | The `eslint-plugin-zappie` rules and the `jsx-a11y` accessibility baseline. The security rules run on every source file, whatever your ESLint config says. So does `lint/powered-by-zappie`, below |
20
+ | `types` | A TypeScript check of the project |
21
+ | `test` | Your project's tests |
22
+ | `build` | A production build, and one pass over its output for the problems below |
23
+ | `secrets` | No secret keys or tokens in your source or build |
24
+ | `readiness` | Initial route discovery is enabled, or the config records why the site opts out |
25
+ | `budgets` | Built JavaScript and CSS sizes, against Zappie's default budgets or the ones in your config |
26
+ | `css` | Your source CSS and class names, and the built client CSS, for the problems below |
27
+ | `unused` | Files under `app/` that nothing imports, and exports no other file imports. It warns, and fails only when you set `unused.fail` |
28
+
29
+ ### Powered by Zappie
30
+
31
+ Every storefront shows "Powered by Zappie" in its footer. The lint step looks for `PoweredByZappie` from `@zappie/foundations`, a `data-zappie-attribution` marker or a link to https://zappie.ai with the words "Powered by" inside a `<footer>` or `role="contentinfo"` element your source writes. With none anywhere, `lint/powered-by-zappie` fails the step. With one outside any footer your source writes, it is a warning, because a footer can be put together across components. No ESLint config, comment or Zappie setting turns it off. `zappie verify` checks the rendered page.
27
32
 
28
33
  ### Build output problems
29
34
 
@@ -40,20 +45,70 @@ A store's own domains and the sites it links to go in `security.links` in `zappi
40
45
 
41
46
  ### CSS problems
42
47
 
43
- | Code | Level | What it catches |
44
- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------- |
45
- | `css/important` | Error | `!important` in source CSS or `@apply`, or an important utility such as `p-4!` or `!p-4` |
46
- | `css/class-patch` | Error | A selector that matches a class attribute, such as `[class*="bg-white"]`. Dark mode goes through tokens |
47
- | `css/duplicate-keyframes` | Warning | Two `@keyframes` with the same frames under different names, or one name defined twice |
48
- | `css/duplicate-selector` | Warning | A selector, or a selector list, styled by more than one source rule in the same context |
49
- | `css/arbitrary-token` | Warning | An arbitrary utility that restates a token from your `@theme`, such as `text-[hsl(var(--foreground))]` |
50
- | `css/literal-token` | Warning | A plain CSS colour, radius or shadow that equals a token your CSS defines |
51
- | `css/unused-custom-property` | Warning | A custom property your CSS defines that no CSS, source or built script reads |
52
- | `css/reduced-motion` | Warning | An animation or transition with no `prefers-reduced-motion` path |
53
- | `css/unreadable` | Warning | A CSS file that can't be parsed |
48
+ | Code | Level | What it catches |
49
+ | ---------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
+ | `css/important` | Error | `!important` in source CSS or `@apply`, or an important utility such as `p-4!` or `!p-4` |
51
+ | `css/class-patch` | Error | A selector that matches a class attribute, such as `[class*="bg-white"]`. Dark mode goes through tokens |
52
+ | `css/duplicate-keyframes` | Warning | Two `@keyframes` with the same frames under different names, or one name defined twice |
53
+ | `css/duplicate-selector` | Warning | A selector, or a selector list, styled by more than one source rule in the same context |
54
+ | `css/arbitrary-token` | Warning | An arbitrary utility that restates a token from your `@theme`, such as `text-[hsl(var(--foreground))]` |
55
+ | `css/literal-token` | Warning | A plain CSS colour, radius or shadow that equals a token your CSS defines |
56
+ | `css/unused-custom-property` | Warning | A custom property your CSS defines that no CSS, source or built script reads |
57
+ | `css/reduced-motion` | Warning | An animation or transition with no `prefers-reduced-motion` path |
58
+ | `css/root-route-css` | Warning | A class in a stylesheet `app/root` loads, or that stylesheet's `@import`s, that only modules outside root's static imports write: one route's page or an overlay loaded on demand |
59
+ | `css/unreadable` | Warning | A CSS file that can't be parsed |
54
60
 
55
61
  Warnings don't fail the step. A reviewed `!important` passes with `/* zappie-allow-important: <reason> */` on the same line. Declarations inside `@media (prefers-reduced-motion: reduce)` may use `!important`.
56
62
 
63
+ ### CSS by route
64
+
65
+ A page's first load should carry only the shared base and the CSS that page draws. `css/root-route-css` follows `app/root`'s static imports from your source and names each class in the stylesheets they load that only a route or an overlay writes, with the modules that write it. Move those classes into a stylesheet that route or overlay module imports. It reads class names as written in your source, so a class built at run time or written only by a package isn't seen.
66
+
67
+ The `budgets` step reports each route's first-load CSS as `budgets/css-route`, named by its React Router route id: the stylesheets of the client entry, the root and the route, and of the chunks they import statically, gzipped. Stylesheets loaded on demand, such as an overlay's, don't count. A nested route's parent isn't added.
68
+
69
+ Set `budgets.routeCssKbGz` to fail a route over its limit with `budgets/css-route-over`. Give each route its own limit, set from its measured size, keyed by route id: the route file's path under `app/` without its extension.
70
+
71
+ ```ts
72
+ export default {
73
+ store: "my-store",
74
+ theme: "./app/theme.json",
75
+ budgets: {
76
+ routeCssKbGz: {
77
+ "routes/menu": 4,
78
+ "routes/item": 5.5,
79
+ "routes/order": 3,
80
+ },
81
+ },
82
+ };
83
+ ```
84
+
85
+ With a record, every route the build makes needs an entry. A route with none fails with `budgets/css-route-missing`, which names its figure and the entry to add. A key that names no route fails with `budgets/css-route-unknown`. A single number, such as `routeCssKbGz: 12`, is one limit for every route.
86
+
87
+ While `routeCssKbGz` is a record or unset, the step also prints `budgets/css-route-record`: a record to paste into `zappie.config.ts`, each value the route's measured figure plus 10 percent, rounded up to the next half KiB.
88
+
89
+ `routeCssKbGz` has no default and needs no `override`. Set in either form, it replaces `cssKbGz`: every client stylesheet together is then reported as `budgets/css` and never fails. Unset, `cssKbGz` applies as before. `zappie verify` holds the home page and the menu to the limit of the route each renders.
90
+
91
+ ### Unused code
92
+
93
+ The `unused` step reads every script and stylesheet in your project once and follows what imports what. It starts from what React Router and the Worker load: the routes in `app/routes.ts` (each `route()`, `index()` and `layout()`, inside `prefix()` too, or every file under `app/routes` with `flatRoutes()`), `app/root`, `app/entry.client` and `app/entry.server`, any file `vite.config` or `react-router.config` names, and every file outside `app/`, such as `workers/`. It follows relative imports, `@/`, `~/`, your tsconfig `paths` and package.json `imports`, `import()` inside `lazy()` or `deferred()`, `import("./x").Type` types, and CSS `@import`.
94
+
95
+ | Code | Level | What it catches |
96
+ | ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------- |
97
+ | `unused/file` | Warning | A script or stylesheet under `app/` that nothing imports, or that only another unused file imports |
98
+ | `unused/export` | Warning | An export no other file imports. The fix says whether the file still uses it, so only the `export` keyword can go |
99
+ | `unused/test-only` | Warning | An export, or a file, that only tests import. The code ships but nothing that ships uses it |
100
+
101
+ Tests (`*.test.*`, `*.spec.*` and files under `test/`, `tests/` or `e2e/`), `*.d.ts` files and `public/` are never reported. The exports React Router reads from a route module or the root, such as `default`, `loader`, `meta`, `links` and `ErrorBoundary`, aren't reported, and neither are the exports of the entry files, the files a config names, or the files `zappie add` copied, which `zappie.json` lists. A copied file nothing imports is still reported.
102
+
103
+ Unused code doesn't break a site, so the step passes with warnings. Set `unused.fail` to fail it on any problem:
104
+
105
+ ```ts
106
+ export default defineConfig({
107
+ // ...
108
+ unused: { fail: true },
109
+ });
110
+ ```
111
+
57
112
  Add `--json` for a machine-readable result. Its shape is the JSON Schema at `@zappie/check/schema/check-result.v1.json`.
58
113
 
59
114
  ## Progress and time limits
@@ -0,0 +1,2 @@
1
+ var P="hours contact offers delivery about gallery".split(" ");var SHAPE={"":{version:1,source:["intake","surprise","settings"],updatedAt:"date",business:0,vibe:["warm","bold","calm","fresh"],colours:0,text:0,corners:["square","soft","round"],pages:"pages",tone:["friendly","playful","polished","direct"],photos:["bright","moody","plain","people"],"home?":["menu","welcome","both"],"notes?":500},business:{name:80,"sells?":200,"audience?":200},colours:{main:"hex",background:"hex",highlight:"hex","mainFromLogo?":"bool"},text:{display:60,body:60}};function wrong(rule,value){if(rule===0)return;if(rule===1)return value===1?void 0:"must be 1";if(Array.isArray(rule))return rule.includes(value)?void 0:`must be one of ${rule.join(", ")}`;if(typeof rule==="number")return typeof value!=="string"||!value.trim()?"must be text":value.length>rule?`must be at most ${rule} characters`:void 0;if(rule==="hex")return/^#[\da-f]{6}$/i.test(String(value))?void 0:"must be a colour like #175c3a";if(rule==="bool")return typeof value==="boolean"?void 0:"must be true or false";if(rule==="date")return typeof value==="string"&&!Number.isNaN(Date.parse(value))?void 0:"must be a date and time";return Array.isArray(value)&&new Set(value).size===value.length&&value.every(page=>P.includes(page))?void 0:`must list each of ${P.join(", ")} at most once`}function validateBrand(value){const issues=[];for(const[at,rules]of Object.entries(SHAPE)){const object=at?value[at]:value;if(!object||typeof object!=="object"||Array.isArray(object)){if(!at||object!==void 0)issues.push({path:at||"$",message:"must be an object"});if(!at)return issues;continue}const keys=Object.keys(rules).map(key=>key.replace("?",""));for(const key of Object.keys(object))if(!keys.includes(key))issues.push({path:at?`${at}.${key}`:key,message:"is not a brand setting"});for(const[name,rule]of Object.entries(rules)){const key=name.replace("?","");const field=object[key];const message3=field===void 0?name.endsWith("?")?void 0:"is missing":wrong(rule,field);if(message3)issues.push({path:at?`${at}.${key}`:key,message:message3})}}return issues}var DEFAULT_BUDGETS={jsKbGz:200,cssKbGz:50,lcpMs:2500,tappableMs:3e3};var GLOBAL_PACKAGE_ALLOWLIST=["react","react-dom","react-router","@react-router/*","@zappie/*","tailwindcss","@tailwindcss/*","clsx","tailwind-merge","class-variance-authority","lucide-react","date-fns","embla-carousel-react","framer-motion/motion","zod","@radix-ui/*","sonner","vaul"];var record=value=>!!value&&typeof value==="object"&&!Array.isArray(value);function distance(left,right){let row=[...Array(right.length+1).keys()];for(let leftIndex=1;leftIndex<=left.length;leftIndex+=1){const next=[leftIndex];for(let rightIndex=1;rightIndex<=right.length;rightIndex+=1){next[rightIndex]=Math.min(next[rightIndex-1]+1,row[rightIndex]+1,row[rightIndex-1]+(left[leftIndex-1]===right[rightIndex-1]?0:1))}row=next}return row[right.length]}function unknownKeys(value,allowed,path7,issue){for(const key of Object.keys(value)){if(allowed.includes(key)){continue}let hint;let best=3;for(const candidate of allowed){const score=distance(key,candidate);if(score<best){best=score;hint=candidate}}issue({path:path7?`${path7}.${key}`:key,code:"unknown_key",message:hint?`Unknown field "${key}". Rename it to "${hint}".`:`Unknown field "${key}". Remove it from the configuration.`,severity:"error"})}}var nonblank=value=>typeof value==="string"&&value.trim().length>0;var packageName=value=>value.length<=214&&/^(?:@[a-z0-9][a-z0-9._~-]*\/[a-z0-9][a-z0-9._~-]*|[a-z0-9][a-z0-9._~-]*)$/.test(value);var globallyAllowed=value=>GLOBAL_PACKAGE_ALLOWLIST.some(allowed=>allowed.endsWith("/*")?value.startsWith(allowed.slice(0,-1)):value===allowed);function hostname(value){const wildcard=value.startsWith("*.");const host=wildcard?value.slice(2):value;if(!host.includes(".")||/^\d+(?:\.\d+){3}$/.test(host)||host.length>253||wildcard&&/^(?:ac|co|com|edu|gov|net|org)\.[^.]+$/i.test(host)){return false}return host.split(".").every(label=>/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label))}var budgetKeys=[...Object.keys(DEFAULT_BUDGETS),"routeCssKbGz","unusedCssPercent"];function nested(value,path7,keys,issue,validate){if(value===void 0){return}if(!record(value)){issue({path:path7,code:"invalid_type",message:`Expected an object. Set ${path7} to an object or remove it.`,severity:"error"});return}unknownKeys(value,keys,path7,issue);validate(value)}function budgets(value,issue,error){nested(value,"budgets",[...budgetKeys,"override"],issue,budget=>{nested(budget.override,"budgets.override",["reason"],issue,override=>{if(!nonblank(override.reason)){error("budgets.override.reason","invalid_format","Expected a non-blank reason. Explain why the default budget must be raised.")}});for(const key of budgetKeys){const value2=budget[key];for(const[route,amount]of Object.entries(key==="routeCssKbGz"&&record(value2)?value2:{"":value2})){const path7=`budgets.${key}${route&&`.${route}`}`;if(amount===void 0){continue}if(!Number.isFinite(amount)||amount<=0){error(path7,"invalid_type",`Expected a positive finite number. Set ${path7} to a number greater than zero.`)}else if(key==="tappableMs"&&amount>5e3){error(path7,"invalid_format",`The ${key} budget cannot exceed 5000. Set ${path7} to 5000 or less.`)}else if(amount>DEFAULT_BUDGETS[key]){const message3=`The ${key} budget exceeds the ${DEFAULT_BUDGETS[key]} default.`;if(!budget.override){error(path7,"budget_override",`${message3} Add budgets.override.reason to explain the increase.`)}else{issue({path:path7,code:"budget_override",message:`${message3} Lower it to the default when the exception is no longer needed.`,severity:"warning"})}}}}})}function analytics(value,issue,error){nested(value,"analytics",["forward"],issue,analyticsValue=>{nested(analyticsValue.forward,"analytics.forward",["ga4","metaPixel"],issue,forward=>{if(forward.ga4!==void 0&&(typeof forward.ga4!=="string"||!/^G-[A-Z0-9]+$/.test(forward.ga4))){error("analytics.forward.ga4","invalid_format","Expected a GA4 measurement id beginning with G-. Use a value such as G-XXXXXXXXXX.")}if(forward.metaPixel!==void 0&&(typeof forward.metaPixel!=="string"||!/^\d+$/.test(forward.metaPixel))){error("analytics.forward.metaPixel","invalid_format","Expected a numeric Meta Pixel id. Use digits only.")}})})}var rootKeys=["store","branches","theme","prerender","menu","packages","audit","outbound","security","budgets","readiness","analytics","verify","unused"];function validateConfig(input){const issues=[];const issue=value=>issues.push(value);const error=(path7,code,message3)=>issue({path:path7,code,message:message3,severity:"error"});if(!record(input)){return{valid:false,issues:[{path:"$",code:"invalid_type",message:"Expected a configuration object. Export an object from zappie.config.ts.",severity:"error"}]}}unknownKeys(input,rootKeys,"",issue);if(!nonblank(input.store)){error("store",input.store===void 0?"missing_required":"invalid_type","Expected a non-empty storefront slug. Set store to the slug used by createZappie().")}theme(input.theme,error);stringList(input.branches,"branches",error,{nonempty:true,unique:true,slug:true});if(input.prerender!==void 0){issue({path:"prerender",code:"unused_setting",message:"Zappie hosting prerenders no page, so prerender does nothing. Remove it.",severity:"warning"})}nested(input.menu,"menu",["hiddenCategories"],issue,value=>{stringList(value.hiddenCategories,"menu.hiddenCategories",error)});nested(input.packages,"packages",["allow"],issue,value=>{const allow=stringList(value.allow,"packages.allow",error);allow?.forEach((name,index)=>{if(globallyAllowed(name)){issue({path:`packages.allow[${index}]`,code:"redundant_allowlist",message:`${name} is already globally allowed. Remove it from packages.allow.`,severity:"warning"})}else if(!packageName(name)){error(`packages.allow[${index}]`,"invalid_format","Expected a lowercase npm package name. Use a package name such as lucide-react or @scope/name.")}})});nested(input.outbound,"outbound",["allow"],issue,value=>{hostList(value.allow,"outbound.allow",error)});nested(input.security,"security",["csp","links"],issue,security=>{hostList(security.links,"security.links",error);nested(security.csp,"security.csp",["imgSrc","connectSrc","fontSrc","styleSrc","frameSrc"],issue,csp=>{for(const[name,value]of Object.entries(csp)){hostList(value,`security.csp.${name}`,error)}})});budgets(input.budgets,issue,error);nested(input.readiness,"readiness",["routeDiscovery"],issue,readiness=>{nested(readiness.routeDiscovery,"readiness.routeDiscovery",["optOut"],issue,routeDiscovery=>{nested(routeDiscovery.optOut,"readiness.routeDiscovery.optOut",["reason"],issue,optOut=>{if(!nonblank(optOut.reason)){error("readiness.routeDiscovery.optOut.reason","invalid_format","Expected a non-blank reason. Explain why the site disables initial route discovery.")}})})});analytics(input.analytics,issue,error);nested(input.verify,"verify",["startPath","cataloguePath"],issue,()=>{});nested(input.unused,"unused",["fail"],issue,unused=>{if(unused.fail!==void 0&&typeof unused.fail!=="boolean"){error("unused.fail","invalid_type","Expected a boolean. Set unused.fail to true or remove it.")}});return{valid:!issues.some(entry=>entry.severity==="error"),issues}}function theme(value,error){if(typeof value!=="string"){error("theme",value===void 0?"missing_required":"invalid_type","Expected a relative .json path. Set theme to a value such as ./theme.json.")}else if(!/\.json$/.test(value)||/^(?:[a-z][a-z\d+.-]*:|\/|\\)/i.test(value)||value.includes("\\")){error("theme","invalid_format","Expected a relative .json path. Use a value such as ./theme.json.")}}function stringList(value,path7,error,options={}){if(value===void 0){return void 0}if(!Array.isArray(value)||value.some(entry=>typeof entry!=="string")){error(path7,"invalid_type",`Expected an array of strings. Set ${path7} to string values.`);return void 0}if(options.nonempty&&value.length===0){error(path7,"invalid_format",`Expected at least one value. Add a value to ${path7} or remove the field.`)}value.forEach((entry,index)=>{if(options.slug&&!nonblank(entry)){error(`${path7}[${index}]`,"invalid_format","Expected a non-empty branch slug. Remove the empty value or use a branch slug.")}});if(options.unique&&new Set(value).size!==value.length){error(path7,"duplicate",`Expected unique values. Remove duplicates from ${path7}.`)}return value}function hostList(value,path7,error){stringList(value,path7,error)?.forEach((host,index)=>{if(!hostname(host)){error(`${path7}[${index}]`,"invalid_format","Expected a hostname or leading *. subdomain pattern without a scheme, path, port or IP. Use a value such as api.example.com.")}})}var COLOR_TOKENS=["--z-bg","--z-surface","--z-surface-raised","--z-overlay","--z-text","--z-text-muted","--z-text-inverse","--z-accent","--z-accent-contrast","--z-brand-1","--z-brand-2","--z-brand-3","--z-success","--z-warning","--z-danger","--z-border","--z-focus-ring"];var LENGTH_TOKENS=["--z-radius-sm","--z-radius-md","--z-radius-lg","--z-radius-pill","--z-space-1","--z-space-2","--z-space-3","--z-space-4","--z-space-5","--z-space-6","--z-space-7","--z-space-8","--z-text-xs","--z-text-sm","--z-text-md","--z-text-lg","--z-text-xl","--z-text-2xl","--z-text-3xl","--z-drawer-width","--z-dialog-width","--z-dialog-height","--z-media-sm"];var FONT_TOKENS=["--z-font-display","--z-font-body","--z-font-mono"];var DURATION_TOKENS=["--z-duration-fast","--z-duration-base","--z-duration-slow"];var EASING_TOKENS=["--z-ease-out","--z-ease-in-out"];var MOTION_TOKENS=[...DURATION_TOKENS,...EASING_TOKENS];var TOKEN_NAMES=[...COLOR_TOKENS,...LENGTH_TOKENS,...FONT_TOKENS,...MOTION_TOKENS];var REQUIRED_TOKENS=["--z-bg","--z-text","--z-accent","--z-accent-contrast"];var DEFAULT_TOKENS=Object.freeze({"--z-bg":"#F9FAFB","--z-surface":"#FFFFFF","--z-surface-raised":"#FFFFFF","--z-overlay":"#00000080","--z-text":"#101828","--z-text-muted":"#344054","--z-text-inverse":"#FFFFFF","--z-accent":"#9FE870","--z-accent-contrast":"#163300","--z-brand-1":"#9FE870","--z-brand-2":"#163300","--z-brand-3":"#EDC843","--z-success":"#027A48","--z-warning":"#ED7A37","--z-danger":"#F04438","--z-border":"#EAECF0","--z-focus-ring":"#163300","--z-radius-sm":"6px","--z-radius-md":"12px","--z-radius-lg":"20px","--z-radius-pill":"9999px","--z-space-1":"4px","--z-space-2":"8px","--z-space-3":"12px","--z-space-4":"16px","--z-space-5":"24px","--z-space-6":"32px","--z-space-7":"48px","--z-space-8":"64px","--z-font-display":"system-ui, sans-serif","--z-font-body":"system-ui, sans-serif","--z-font-mono":"ui-monospace, monospace","--z-text-xs":"12px","--z-text-sm":"14px","--z-text-md":"16px","--z-text-lg":"18px","--z-text-xl":"20px","--z-text-2xl":"24px","--z-text-3xl":"32px","--z-duration-fast":"120ms","--z-duration-base":"200ms","--z-duration-slow":"320ms","--z-ease-out":"cubic-bezier(0, 0, 0.2, 1)","--z-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)","--z-drawer-width":"420px","--z-dialog-width":"min(1000px, calc(100vw - 32px))","--z-dialog-height":"min(780px, 90dvh)","--z-media-sm":"64px"});var DEFAULT_THEME=Object.freeze({version:1,name:"Zappie",tokens:DEFAULT_TOKENS,darkMode:"light",dark:Object.freeze({"--z-bg":"#000000","--z-surface":"#242424","--z-surface-raised":"#333333","--z-text":"#FFFFFF","--z-text-muted":"#BFBFBF","--z-text-inverse":"#101828","--z-border":"#474747","--z-focus-ring":"#9FE870"})});var NAMED_COLORS={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};var numberPattern=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;var safeValue=value=>value.length<=512&&!/[;{}<>\\\x00-\x1f]|\/\*|url\s*\(|expression\s*\(/i.test(value);var clamp=n=>Math.max(0,Math.min(1,n));function numeric(value,scale=1){const percent=value.endsWith("%");const raw=percent?value.slice(0,-1):value;const parsed=numberPattern.test(raw)?Number(raw)/(percent?100:scale):NaN;return Number.isFinite(parsed)?parsed:NaN}function hue(value){const match=/^(.*?)(deg|rad|grad|turn)?$/.exec(value);if(!match||!numberPattern.test(match[1])){return NaN}const factors={deg:1,rad:180/Math.PI,grad:.9,turn:360};return Number(match[1])*(factors[match[2]??"deg"]??1)}function parseColor(input){if(!safeValue(input)){return null}let value=input.trim().toLowerCase();if(value==="transparent"){return[0,0,0,0]}if(Object.prototype.hasOwnProperty.call(NAMED_COLORS,value)){value="#"+NAMED_COLORS[value]}if(/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.test(value)){let hex=value.slice(1);if(hex.length<5){hex=[...hex].map(c=>c+c).join("")}if(hex.length===6){hex+="ff"}return[0,2,4,6].map(i=>parseInt(hex.slice(i,i+2),16)/255)}const match=/^(rgba?|hsla?|oklch)\(([^()]*)\)$/.exec(value);if(!match){return null}const kind=match[1];const body=match[2].trim();const comma=body.includes(",");if(comma&&(body.includes("/")||kind==="oklch")){return null}const parts=comma?body.split(",").map(s=>s.trim()):body.split(/\s*\/\s*/);let channels,alpha;if(comma){if(parts.length!==3&&parts.length!==4){return null}channels=parts.slice(0,3);alpha=parts[3]}else{if(parts.length>2){return null}channels=parts[0].split(/\s+/);alpha=parts[1]}if(channels.length!==3){return null}const opacity=alpha===void 0?1:numeric(alpha);let rgb;if(kind.startsWith("rgb")){if(comma&&channels.some(c=>c.endsWith("%"))&&!channels.every(c=>c.endsWith("%"))){return null}rgb=channels.map(c=>numeric(c,255))}else if(kind.startsWith("hsl")){if(!channels[1].endsWith("%")||!channels[2].endsWith("%")){return null}const h=(hue(channels[0])%360+360)%360;const s=clamp(numeric(channels[1])),l=clamp(numeric(channels[2]));const a=s*Math.min(l,1-l);rgb=[0,8,4].map(n=>{const k=(n+h/30)%12;return l-a*Math.max(-1,Math.min(k-3,9-k,1))})}else{const l=clamp(numeric(channels[0]));const c=Math.max(0,numeric(channels[1])*(channels[1].endsWith("%")?.4:1));const h=hue(channels[2])*Math.PI/180;const a=c*Math.cos(h),b=c*Math.sin(h);const x=(l+.3963377774*a+.2158037573*b)**3;const y=(l-.1055613458*a-.0638541728*b)**3;const z=(l-.0894841775*a-1.291485548*b)**3;rgb=[4.0767416621*x-3.3077115913*y+.2309699292*z,-1.2684380046*x+2.6097574011*y-.3413193965*z,-.0041960863*x-.7034186147*y+1.707614701*z].map(v=>v<=.0031308?12.92*v:1.055*v**(1/2.4)-.055)}return[...rgb,opacity].every(Number.isFinite)?[...rgb.map(clamp),clamp(opacity)]:null}function isLength(value,depth=0){if(!safeValue(value)||depth>8){return false}const text=value.trim();if(/^(?:0|(?:\d+(?:\.\d*)?|\.\d+)(?:px|rem|em|%|dvh|vh|vw))$/.test(text)){return true}const fn=/^(min|max|clamp|calc)\((.*)\)$/.exec(text);if(!fn){return false}let level2=0,start=0;const args=[];for(let i=0;i<fn[2].length;i++){const c=fn[2][i];if(c==="("){level2++}if(c===")"&&--level2<0){return false}const separator=fn[1]==="calc"?(c==="+"||c==="-")&&/\s/.test(fn[2][i-1]??"")&&/\s/.test(fn[2][i+1]??""):c===",";if(level2===0&&separator){args.push(fn[2].slice(start,i));start=i+1}}args.push(fn[2].slice(start));return level2===0&&(fn[1]!=="clamp"||args.length===3)&&args.every(arg=>isLength(arg,depth+1))}var cssWideKeyword=/^(?:inherit|initial|unset|revert|revert-layer|default)$/i;function isFontFamily(value){return safeValue(value)&&value.split(",").every(part=>{const family=part.trim();return/^[a-zA-Z][a-zA-Z0-9 -]*$/.test(family)&&!cssWideKeyword.test(family)})}function isDuration(value){return/^(?:\d+(?:\.\d+)?|\.\d+)(?:ms|s)$/.test(value)}function isEasing(value){if(/^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end)$/.test(value)){return true}const m=/^cubic-bezier\((.*)\)$/.exec(value);if(!m){return false}const ns=m[1].split(",").map(s=>numberPattern.test(s.trim())?numeric(s.trim()):NaN);return ns.length===4&&ns.every(Number.isFinite)&&ns[0]>=0&&ns[0]<=1&&ns[2]>=0&&ns[2]<=1}function isAssetUrl(value,relative2=true){if(!value||!safeValue(value)||/[\s"'()]/.test(value)){return false}if(relative2&&!/^[a-z][\w+.-]*:/i.test(value)&&!value.startsWith("//")){return true}try{const url=new URL(value);return url.protocol==="https:"&&!url.username&&!url.password}catch{return false}}function contrastRatio(fg,bg){const foreground=parseColor(fg),background=parseColor(bg);if(!foreground||!background||background[3]!==1){return NaN}const luminance=channels=>channels.map(c=>c<=.04045?c/12.92:((c+.055)/1.055)**2.4).reduce((sum,c,i)=>sum+c*[.2126,.7152,.0722][i],0);const a=luminance(foreground.slice(0,3).map((c,i)=>c*foreground[3]+background[i]*(1-foreground[3])));const b=luminance(background.slice(0,3));return(Math.max(a,b)+.05)/(Math.min(a,b)+.05)}var record2=v=>typeof v==="object"&&v!==null&&!Array.isArray(v);var includes=(values,key)=>values.includes(key);function validateTheme(input){const issues=[];const issue=(path7,code,message3,severity="error")=>issues.push({path:path7,code,message:message3,severity});const keys=(obj,allowed,path7)=>{for(const key of Object.keys(obj)){if(!allowed.includes(key)){issue(path7?`${path7}.${key}`:key,"invalid_theme","Unknown field")}}};if(!record2(input)){return{ok:false,issues:[{path:"",code:"invalid_theme",message:"Expected a theme object",severity:"error"}]}}keys(input,["$schema","version","name","tokens","dark","darkMode","fonts","logo","motion"],"");if(input.version!==1){issue("version","invalid_theme","Expected version 1")}if(typeof input.name!=="string"||!input.name.trim()||input.name.length>100){issue("name","missing_required","Expected a name of 1\u2013100 characters")}if(input.$schema!==void 0&&(typeof input.$schema!=="string"||!isAssetUrl(input.$schema,false))){issue("$schema","invalid_theme","Expected an HTTPS schema URL")}if(input.darkMode!==void 0&&(typeof input.darkMode!=="string"||!["auto","light","dark"].includes(input.darkMode))){issue("darkMode","invalid_theme","Expected auto, light or dark")}for(const group of["tokens","dark"]){const values=input[group];if(group==="dark"&&values===void 0){continue}if(!record2(values)){issue(group,"missing_required","Expected a token object");continue}if(group==="tokens"){for(const key of REQUIRED_TOKENS){if(!Object.prototype.hasOwnProperty.call(values,key)){issue(`${group}.${key}`,"missing_required","Required token")}}}for(const[key,value]of Object.entries(values)){const path7=`${group}.${key}`;if(!includes(TOKEN_NAMES,key)){issue(path7,"unknown_token","Unknown semantic token");continue}let code,valid=false;if(includes(COLOR_TOKENS,key)){code="invalid_color";valid=typeof value==="string"&&parseColor(value)!==null}else if(includes(LENGTH_TOKENS,key)){code="invalid_length";valid=typeof value==="string"&&isLength(value)}else if(includes(FONT_TOKENS,key)){code="invalid_font";valid=typeof value==="string"&&isFontFamily(value)}else{code="invalid_motion";valid=typeof value==="string"&&safeValue(value)&&(includes(DURATION_TOKENS,key)?isDuration(value):isEasing(value))}if(!valid){issue(path7,code,"Invalid or unsafe token value")}}}if(input.fonts!==void 0){if(!Array.isArray(input.fonts)||input.fonts.length>3){issue("fonts","invalid_font","Expected at most three fonts")}else{const roles=new Set;input.fonts.forEach((font,i)=>{const path7=`fonts[${i}]`;if(!record2(font)){issue(path7,"invalid_font","Expected a font object");return}keys(font,["family","source","url","weights","role"],path7);if(typeof font.family!=="string"||!isFontFamily(font.family)||font.family.includes(",")){issue(`${path7}.family`,"invalid_font","Expected one unquoted font family")}if(typeof font.source!=="string"||!["google","self","system"].includes(font.source)){issue(`${path7}.source`,"invalid_font","Unknown font source")}if(typeof font.role!=="string"||!["display","body","mono"].includes(font.role)||roles.has(font.role)){issue(`${path7}.role`,"invalid_font","Expected a unique font role")}roles.add(String(font.role));if(font.source==="self"||font.url!==void 0){if(typeof font.url!=="string"||!isAssetUrl(font.url,false)||!new URL(font.url).pathname.endsWith(".woff2")){issue(`${path7}.url`,"invalid_font","Expected an HTTPS .woff2 URL")}}if(font.weights!==void 0&&(!Array.isArray(font.weights)||!font.weights.length||font.weights.length>9||font.weights.some(w=>typeof w!=="number"||!Number.isInteger(w)||w<1||w>1e3))){issue(`${path7}.weights`,"invalid_font","Expected 1\u20139 integer weights between 1 and 1000")}})}}if(input.logo!==void 0){if(!record2(input.logo)){issue("logo","invalid_logo","Expected a logo object")}else{keys(input.logo,["light","dark","mark","alt"],"logo");if(typeof input.logo.alt!=="string"||!input.logo.alt.trim()){issue("logo.alt","invalid_logo","Logo alternative text is required")}for(const key of["light","dark","mark"]){const value=input.logo[key];if(key==="light"||value!==void 0){if(typeof value!=="string"||!isAssetUrl(value)){issue(`logo.${key}`,"invalid_logo","Expected HTTPS or a relative asset path")}}}}}if(input.motion!==void 0){if(!record2(input.motion)){issue("motion","invalid_motion","Expected a motion object")}else{keys(input.motion,["reduce"],"motion");if(input.motion.reduce!==void 0&&typeof input.motion.reduce!=="boolean"){issue("motion.reduce","invalid_motion","Expected a boolean")}}}const tokenGroup=value=>record2(value)?value:{};for(const group of record2(input.dark)?["tokens","dark"]:["tokens"]){const values={...DEFAULT_TOKENS,...tokenGroup(input.tokens),...group==="dark"?tokenGroup(input.dark):{}};const pairs=[["--z-text","--z-bg",4.5,"error"],["--z-text","--z-surface",4.5,"error"],["--z-accent-contrast","--z-accent",4.5,"error"],["--z-text-muted","--z-bg",3,"warning"]];for(const[fg,bg,minimum,severity]of pairs){const foreground=values[fg],background=values[bg];if(typeof foreground!=="string"||typeof background!=="string"||!parseColor(foreground)||!parseColor(background)){continue}const ratio=contrastRatio(foreground,background);if(!Number.isFinite(ratio)){issue(`${group}.${bg}`,"unverified_contrast","A contrast background must be opaque","error")}else if(ratio<minimum){issue(`${group}.${fg}`,"low_contrast",`Contrast against ${bg} must be at least ${minimum}:1`,severity)}}}return issues.some(i=>i.severity==="error")?{ok:false,issues}:{ok:true,theme:input,warnings:issues}}import{createHash}from"crypto";import{readFile as readFile2}from"fs/promises";import path2 from"path";import{pathToFileURL}from"url";import{readFile}from"fs/promises";import path from"path";async function json(file){return JSON.parse(await readFile(file,"utf8"))}function relative(cwd,file){return path.relative(cwd,file).split(path.sep).join("/")}function lineFor(source,issuePath){const key=issuePath.split(".").at(-1)?.replace(/\[\d+\]$/,"");if(!key||key==="$"){return void 0}const quoted=JSON.stringify(key);const lines=source.split(/\r?\n/);const index=lines.findIndex(line=>line.includes(quoted)||new RegExp(`\\b${escape(key)}\\b`).test(line));return index<0?void 0:index+1}function escape(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function problem(message3,fix,details={}){return{...details,message:message3,fix}}function step(name,result,problems=[]){return{name,result,problems}}var skipped=(name,message3)=>step(name,"skipped",[problem(message3,null)]);function supportsTypeScriptImport(version=process.versions.node){const[major=0,minor=0]=version.split(".").map(Number);return major>22||major===22&&minor>=18}async function loadConfig(cwd){const file=path2.join(cwd,"zappie.config.ts");if(!supportsTypeScriptImport()){throw new Error("zappie check needs Node 22.18 or later to read zappie.config.ts")}const source=await readFile2(file,"utf8");const version=createHash("sha256").update(source).digest("hex");const loaded=await import(`${pathToFileURL(file).href}?check=${version}`);return{value:loaded.default,source,file}}async function checkConfig({cwd,signal}){signal?.throwIfAborted();let loaded;try{loaded=await loadConfig(cwd)}catch(error){return step("config","failed",[problem(message(error),"Create a readable zappie.config.ts in the project root.",{file:"zappie.config.ts"})])}const validation=validateConfig(loaded.value);const problems=validation.issues.map(issue=>configProblem(issue,loaded.source));let themeFailed=false;const theme2=configTheme(loaded.value);if(theme2){const checkedTheme=await themeProblems(cwd,theme2);problems.push(...checkedTheme.problems);themeFailed=checkedTheme.failed}const brand=await brandProblems(cwd);problems.push(...brand);signal?.throwIfAborted();return step("config",validation.issues.some(issue=>issue.severity==="error")||themeFailed||brand.length>0?"failed":"passed",problems)}function configProblem(issue,source){const line=lineFor(source,issue.path);return problem(`${issue.path}: ${issue.message}`,issue.message,{rule:`config/${issue.code}`,file:"zappie.config.ts",...line?{line}:{}})}async function themeProblems(cwd,theme2){const file=path2.resolve(cwd,theme2);try{const source=await readFile2(file,"utf8");const result=validateTheme(JSON.parse(source));const issues=result.ok?result.warnings:result.issues;return{failed:issues.some(issue=>issue.severity==="error"),problems:issues.map(issue=>themeProblem(issue,source,theme2))}}catch(error){return{failed:true,problems:[problem(message(error),`Make ${theme2} a readable JSON theme file.`,{rule:"theme/unreadable",file:theme2})]}}}var BRAND_FILE="app/brand.json";async function brandProblems(cwd){let source;try{source=await readFile2(path2.join(cwd,BRAND_FILE),"utf8")}catch{return[]}const fix=`Fix ${BRAND_FILE} from the Brand setting in Studio, or remove it.`;const details=(rule,line)=>({rule:`brand/${rule}`,file:BRAND_FILE,...line?{line}:{}});if(Buffer.byteLength(source)>4096){return[problem(`${BRAND_FILE} is larger than 4096 bytes.`,fix,details("too-large"))]}let value;try{value=JSON.parse(source)}catch(error){return[problem(message(error),fix,details("unreadable"))]}return validateBrand(value).map(issue=>problem(`${issue.path}: ${issue.message}`,fix,details("invalid",lineFor(source,issue.path))))}function themeProblem(issue,source,file){const line=lineFor(source,issue.path);return problem(`${issue.path}: ${issue.message}`,issue.message,{rule:`theme/${issue.code}`,file,...line?{line}:{}})}function configTheme(value){return value&&typeof value==="object"&&"theme"in value&&typeof value.theme==="string"?value.theme:void 0}function message(error){return error instanceof Error?error.message:String(error)}import{readFile as readFile4}from"fs/promises";import{createRequire}from"module";import path4 from"path";import{pathToFileURL as pathToFileURL2}from"url";import{lstat,readFile as readFile3,readdir}from"fs/promises";import path3 from"path";var FILE_SIZE_CAP=1024*1024;var BUILD_FILE_SIZE_CAP=8*1024*1024;var ignoredDirectories=new Set(["node_modules","build","dist","coverage","public","vendor","test","tests","e2e","test-results","playwright-report"]);var codeExtension=/\.(?:[cm]?[jt]sx?|html|mdx)$/;var testFile=/\.(?:test|spec)\.[^.]+$/;async function readSourceCode(cwd){const source=[];await collect(cwd,source,name=>{return!name.startsWith(".")&&!ignoredDirectories.has(name)});return texts(cwd,source.filter(file=>codeExtension.test(file)&&!testFile.test(file)&&!/(?:^|[/\\])[^/\\]+\.config\.[^.]+$/.test(file)),FILE_SIZE_CAP)}async function readCssInputs(cwd){const source=[];await collect(cwd,source,name=>{return!name.startsWith(".")&&!ignoredDirectories.has(name)});const built=[];await collect(path3.join(cwd,"build/client"),built,()=>true);const read=(files,cap)=>texts(cwd,files,cap);return{sourceCss:await read(source.filter(file=>file.endsWith(".css")),FILE_SIZE_CAP),sourceCode:await read(source.filter(file=>codeExtension.test(file)&&!testFile.test(file)&&!/(?:^|[/\\])[^/\\]+\.config\.[^.]+$/.test(file)),FILE_SIZE_CAP),builtCss:await read(built.filter(file=>file.endsWith(".css")),BUILD_FILE_SIZE_CAP),builtCode:await read(built.filter(file=>file.endsWith(".js")),BUILD_FILE_SIZE_CAP)}}async function texts(cwd,files,cap){const result=[];for(const file of files.sort()){const info=await lstat(file);if(!info.isFile()||info.size>cap){continue}result.push({file:relative(cwd,file),text:await readFile3(file,"utf8")})}return result}async function collect(directory,files,enter){let entries;try{entries=await readdir(directory,{withFileTypes:true})}catch(error){if(error instanceof Error&&"code"in error&&error.code==="ENOENT"){return}throw error}for(const entry of entries){if(entry.isSymbolicLink()){continue}const file=path3.join(directory,entry.name);if(entry.isDirectory()){if(enter(entry.name)){await collect(file,files,enter)}}else if(entry.isFile()){files.push(file)}}}var ATTRIBUTION_RULE="lint/powered-by-zappie";var FOOTER=/<footer\b[\s\S]*?<\/footer\s*>|\brole=["'{]*contentinfo[\s\S]{0,4000}/g;function hasAttribution(source){return/<PoweredByZappie\b/.test(source)||/\bdata-zappie-attribution\b/.test(source)||/https:\/\/zappie\.ai\/?["'`]/.test(source)&&/Powered\s+by\b/i.test(source)}function footerHasAttribution(source){return[...source.matchAll(FOOTER)].some(match=>hasAttribution(match[0]))}function attributionProblems(files){if(files.some(file=>footerHasAttribution(file.text))){return{failed:false,problems:[]}}const outside=files.find(file=>hasAttribution(file.text));if(outside){return{failed:false,problems:[problem("Powered by Zappie is in the source, but not inside a <footer> element it writes. Every page must show it in its footer.","Render PoweredByZappie from @zappie/foundations inside the site's <footer>. zappie verify checks the rendered page.",{rule:ATTRIBUTION_RULE,file:outside.file})]}}return{failed:true,problems:[problem("The site has no Powered by Zappie link in its footer. Every Zappie storefront shows it on every page, linking to https://zappie.ai.","Render PoweredByZappie from @zappie/foundations inside the site's <footer>, including the closed page's.",{rule:ATTRIBUTION_RULE})]}}async function checkAttribution(cwd){return attributionProblems(await readSourceCode(cwd))}var SECURITY_IGNORES=["build/**","dist/**",".react-router/**",".wrangler/**","coverage/**","playwright-report/**","test-results/**"];async function checkLint({cwd,signal}){signal?.throwIfAborted();let ESLint;try{const require2=createRequire(path4.join(cwd,"package.json"));const loadedEslint=await import(pathToFileURL2(require2.resolve("eslint")).href);ESLint=loadedEslint.ESLint}catch(error){return step("lint","failed",[problem(message2(error),"Install ESLint in the project.",{rule:"lint/unavailable"})])}try{const zappie=(await import("eslint-plugin-zappie")).default;const eslint=new ESLint({cwd,overrideConfig:{settings:{zappie:{outboundAllow:await outboundAllow(cwd)}}}});const security=await securityResults(zappie,ESLint,cwd);const attribution=await checkAttribution(cwd);signal?.throwIfAborted();const source=await sourceFile(cwd);const config=await eslint.calculateConfigForFile(source);const installed=await installedPlugin(cwd)??zappie;const problems=recommendedProblems(installed,config?.rules??{});if(problems.length>0){return step("lint","failed",[...problems,...lintProblems(cwd,security),...attribution.problems])}const results=[...security,...await eslint.lintFiles(["."])];signal?.throwIfAborted();const failed=results.some(result=>result.messages.some(entry=>entry.fatal||entry.severity===2));return step("lint",failed||attribution.failed?"failed":"passed",[...lintProblems(cwd,results),...attribution.problems])}catch(error){return step("lint","failed",[problem(message2(error),"Fix the project ESLint configuration and run lint again.",{rule:"lint/config"})])}}async function securityResults(zappie,ESLint,cwd){const security=zappie.configs.security;if(!security){throw new Error("This eslint-plugin-zappie has no security config. Update eslint-plugin-zappie and @zappie/check together.")}const eslint=new ESLint({cwd,overrideConfigFile:true,allowInlineConfig:false,errorOnUnmatchedPattern:false,overrideConfig:[{ignores:SECURITY_IGNORES},...security]});return eslint.lintFiles(["."])}function lintProblems(cwd,results){const seen=new Set;return results.flatMap(result=>result.messages.flatMap(entry=>{const file=relative(cwd,result.filePath);const key=[entry.ruleId,file,entry.line,entry.message].join("\0");if(seen.has(key)){return[]}seen.add(key);return[problem(entry.message,null,{...entry.ruleId?{rule:entry.ruleId}:{},file,...entry.line?{line:entry.line}:{}})]}))}async function outboundAllow(cwd){try{const value=(await loadConfig(cwd)).value;if(!value||typeof value!=="object"||!("outbound"in value)){return[]}const outbound=value.outbound;if(!outbound||typeof outbound!=="object"||!("allow"in outbound)){return[]}return Array.isArray(outbound.allow)?outbound.allow.filter(entry=>typeof entry==="string"):[]}catch{return[]}}async function installedPlugin(cwd){for(let directory=path4.resolve(cwd);;){const root=path4.join(directory,"node_modules","eslint-plugin-zappie");const manifest=await readManifest(path4.join(root,"package.json"));if(manifest){const loaded=await import(pathToFileURL2(path4.join(root,entryPoint(manifest))).href);if(!loaded.default?.configs?.recommended){throw new Error("The installed eslint-plugin-zappie has no recommended config. Update eslint-plugin-zappie.")}return loaded.default}const parent=path4.dirname(directory);if(parent===directory){return void 0}directory=parent}}async function readManifest(file){try{return JSON.parse(await readFile4(file,"utf8"))}catch(error){if(error instanceof Error&&"code"in error&&(error.code==="ENOENT"||error.code==="ENOTDIR")){return void 0}throw error}}function entryPoint(manifest){const exported=manifest.exports&&typeof manifest.exports==="object"&&"."in manifest.exports?manifest.exports["."]:manifest.exports;if(typeof exported==="string"){return exported}if(exported&&typeof exported==="object"){for(const condition of["import","default"]){const target=exported[condition];if(typeof target==="string"){return target}}}return typeof manifest.main==="string"?manifest.main:"index.js"}function recommendedProblems(zappie,applied){const expected=recommendedRules(zappie);return Object.entries(expected).flatMap(([rule,severity])=>{if(level(applied[rule])>=level(severity)){return[]}return[problem(`${rule} is not enabled at the recommended severity.`,"Apply every entry from zappie.configs.recommended in eslint.config.mjs.",{rule,file:"eslint.config.mjs"})]})}function recommendedRules(zappie){const result={};for(const config of zappie.configs.recommended??[]){Object.assign(result,config.rules??{})}return Object.fromEntries(Object.entries(result).filter(([name])=>name.startsWith("zappie/")||name.startsWith("jsx-a11y/")))}function level(value){const selected=Array.isArray(value)?value[0]:value;if(selected==="error"||selected===2){return 2}if(selected==="warn"||selected===1){return 1}return 0}async function sourceFile(cwd){const candidates=["app/index.ts","app/root.tsx","src/index.ts","index.ts"];for(const candidate of candidates){try{await import("fs/promises").then(({access:access2})=>access2(path4.join(cwd,candidate)));return candidate}catch{continue}}return"eslint.config.mjs"}function message2(error){return error instanceof Error?error.message:String(error)}import{createRequire as createRequire2}from"module";import path6 from"path";import{fileURLToPath,pathToFileURL as pathToFileURL3}from"url";import{spawn}from"child_process";import{constants}from"fs";import{access}from"fs/promises";import path5 from"path";var KILL_GRACE_MS=2e3;var windows=process.platform==="win32";var running=new Set;var exitHook=false;function track(pid){if(pid===void 0||windows){return}running.add(pid);if(!exitHook){exitHook=true;process.once("exit",()=>{for(const group of running){try{process.kill(-group,"SIGKILL")}catch{}}})}}function command(executable,args,cwd,signal,options={}){const grace=options.killGraceMs??KILL_GRACE_MS;return new Promise((resolve,reject)=>{if(signal?.aborted){reject(signal.reason);return}const child=spawn(executable,args,{cwd,env:{...process.env,NO_COLOR:"1",FORCE_COLOR:"0",COREPACK_ENABLE_DOWNLOAD_PROMPT:"0",GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","pipe","pipe"],detached:!windows,windowsHide:true});track(child.pid);const tree=processTree(child,grace);let stdout="";let stderr="";let settled=false;let exitCode;let lingering;const finish=settle=>{if(settled){return}settled=true;signal?.removeEventListener("abort",onAbort);clearTimeout(lingering);child.stdout.destroy();child.stderr.destroy();settle()};const result=()=>({code:exitCode??1,stdout,stderr});const onAbort=()=>{tree.stop();finish(()=>reject(signal?.reason))};signal?.addEventListener("abort",onAbort,{once:true});child.stdout.on("data",value=>{stdout+=String(value)});child.stderr.on("data",value=>{stderr+=String(value)});child.on("error",error=>{tree.stop();finish(()=>reject(error))});child.on("exit",code=>{exitCode=code??1;tree.stop();lingering=setTimeout(()=>finish(()=>resolve(result())),grace+500)});child.on("close",code=>{exitCode??=code??1;finish(()=>resolve(result()))})})}function processTree(child,grace){let stopped=false;const signalGroup=name=>{if(child.pid===void 0){return false}try{process.kill(-child.pid,name);return true}catch{return false}};return{stop(){if(stopped){return}stopped=true;if(windows){if(child.pid!==void 0){spawn("taskkill",["/pid",String(child.pid),"/T","/F"],{stdio:"ignore",windowsHide:true}).on("error",()=>{})}return}if(signalGroup("SIGTERM")){setTimeout(()=>{signalGroup("SIGKILL");running.delete(child.pid)},grace)}else{running.delete(child.pid)}}}}var PNPM_NO_VERIFY="--config.verify-deps-before-run=false";function execArgs(manager,binary,args){if(manager==="npm"){return{executable:"npm",args:["exec","--no","--",binary,...args]}}if(manager==="yarn"){return{executable:"yarn",args:["exec",binary,...args]}}if(manager==="bun"){return{executable:"bun",args:["x","--no-install",binary,...args]}}return{executable:"pnpm",args:[PNPM_NO_VERIFY,"exec",binary,...args]}}async function binaryArgs(manager,cwd,binary,args){if(!windows){const local=path5.join(cwd,"node_modules",".bin",binary);try{await access(local,constants.X_OK);return{executable:local,args}}catch{}}return execArgs(manager,binary,args)}function scriptArgs(manager,name){if(manager==="bun"){return{executable:"bun",args:["run",name]}}if(manager==="npm"){return{executable:"npm",args:["run",name]}}if(manager==="pnpm"){return{executable:"pnpm",args:[PNPM_NO_VERIFY,name]}}return{executable:manager,args:[name]}}var ISOLATED_STEPS={lint:checkLint};var STEP_RESULT_MARK="zappie-check-step-result:";function isIsolatedStep(name){return typeof name==="string"&&Object.hasOwn(ISOLATED_STEPS,name)}function isolated(name){return async({signal,...options})=>{signal?.throwIfAborted();const result=await command(process.execPath,[...workerArgs(),name,JSON.stringify(options)],options.cwd,signal);signal?.throwIfAborted();return stepReply(name,result.code,result.stdout,result.stderr)}}function stepReply(name,code,stdout,stderr){const line=stdout.split("\n").filter(entry=>entry.startsWith(STEP_RESULT_MARK)).at(-1);if(line===void 0){const reason=stderr.trim().split("\n").at(-1)?.trim();throw new Error(`The ${name} step stopped with exit code ${code} before it reported a result${reason?`: ${reason}`:"."}`)}const reply=JSON.parse(line.slice(STEP_RESULT_MARK.length));if("error"in reply){throw new Error(reply.error)}return reply.step}function workerArgs(){const here=fileURLToPath(import.meta.url);const directory=path6.dirname(here);if(here.endsWith(".ts")){const tsx=pathToFileURL3(createRequire2(here).resolve("tsx")).href;return["--import",tsx,path6.join(directory,"step-worker.ts")]}return[path6.join(directory,"step-worker.js")]}export{DEFAULT_BUDGETS,GLOBAL_PACKAGE_ALLOWLIST,validateBrand,json,relative,problem,step,skipped,supportsTypeScriptImport,loadConfig,checkConfig,KILL_GRACE_MS,command,PNPM_NO_VERIFY,binaryArgs,scriptArgs,readCssInputs,checkLint,ISOLATED_STEPS,STEP_RESULT_MARK,isIsolatedStep,isolated};
2
+ //# sourceMappingURL=chunk-S5IVFL3O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/brand.ts","../../sdk/src/site-config/types.ts","../../sdk/src/site-config/helpers.ts","../../sdk/src/site-config/sections.ts","../../sdk/src/site-config/validate.ts","../../tokens/src/names.ts","../../tokens/src/defaults.ts","../../tokens/src/named-colors.ts","../../tokens/src/parse.ts","../../tokens/src/contrast.ts","../../tokens/src/validate.ts","../src/config.ts","../src/files.ts","../src/result.ts","../src/lint.ts","../src/css-files.ts","../src/attribution.ts","../src/isolate.ts","../src/command.ts"],"mappings":"AAEA,IAAM,EAAI,8CAA8C,MAAM,GAAG,EAEjE,IAAM,MAA8C,CAClD,GAAI,CACF,QAAS,EACT,OAAQ,CAAC,SAAU,WAAY,UAAU,EACzC,UAAW,OACX,SAAU,EACV,KAAM,CAAC,OAAQ,OAAQ,OAAQ,OAAO,EACtC,QAAS,EACT,KAAM,EACN,QAAS,CAAC,SAAU,OAAQ,OAAO,EACnC,MAAO,QACP,KAAM,CAAC,WAAY,UAAW,WAAY,QAAQ,EAClD,OAAQ,CAAC,SAAU,QAAS,QAAS,QAAQ,EAC7C,QAAS,CAAC,OAAQ,UAAW,MAAM,EACnC,SAAU,GACZ,EACA,SAAU,CAAE,KAAM,GAAI,SAAU,IAAK,YAAa,GAAI,EACtD,QAAS,CACP,KAAM,MACN,WAAY,MACZ,UAAW,MACX,gBAAiB,MACnB,EACA,KAAM,CAAE,QAAS,GAAI,KAAM,EAAG,CAChC,EAEA,SAAS,MAAM,KAAY,MAAoC,CAC7D,GAAI,OAAS,EAAG,OAChB,GAAI,OAAS,EAAG,OAAO,QAAU,EAAI,OAAY,YACjD,GAAI,MAAM,QAAQ,IAAI,EACpB,OAAO,KAAK,SAAS,KAAe,EAChC,OACA,kBAAkB,KAAK,KAAK,IAAI,CAAC,GACvC,GAAI,OAAO,OAAS,SAClB,OAAO,OAAO,QAAU,UAAY,CA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MAAQ,KAAK,MAAM,KAAK,MAAM,iBAAiB,MAAM,CAAC,EAE5D,GAAI,UAAW,MAAO,CACpB,MAAM,IAAI,MAAM,MAAM,KAAK,CAC7B,CACA,OAAO,MAAM,IACf,CAGA,SAAS,YAAa,CACpB,MAAM,KAAO,cAAc,YAAY,GAAG,EAC1C,MAAM,UAAYC,MAAK,QAAQ,IAAI,EACnC,GAAI,KAAK,SAAS,KAAK,EAAG,CACxB,MAAM,IAAMC,eAAcC,eAAc,IAAI,EAAE,QAAQ,KAAK,CAAC,EAAE,KAC9D,MAAO,CAAC,WAAY,IAAKF,MAAK,KAAK,UAAW,gBAAgB,CAAC,CACjE,CACA,MAAO,CAACA,MAAK,KAAK,UAAW,gBAAgB,CAAC,CAChD","names":["message","path","path","value","message","path","message","level","relative","record","path","message","readFile","path","message","path","readFile","theme","readFile","path","pathToFileURL","readFile","path","path","readFile","require","path","pathToFileURL","message","readFile","access","createRequire","path","pathToFileURL","path","path","pathToFileURL","createRequire"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as TypeScript from 'typescript';
2
+
1
3
  type CheckResultValue = "passed" | "failed" | "skipped";
2
4
  type CheckProblem = {
3
5
  rule?: string;
@@ -20,7 +22,7 @@ type AuditAdvisory = {
20
22
  ignored: boolean;
21
23
  ignoredUntil?: string;
22
24
  };
23
- type CheckStepName = "config" | "allowlist" | "audit" | "lint" | "types" | "test" | "build" | "secrets" | "readiness" | "budgets" | "css";
25
+ type CheckStepName = "config" | "allowlist" | "audit" | "lint" | "types" | "test" | "build" | "secrets" | "readiness" | "budgets" | "css" | "unused";
24
26
  type CheckStep = {
25
27
  name: CheckStepName;
26
28
  result: CheckResultValue;
@@ -139,7 +141,7 @@ type CssInputs = {
139
141
  builtCode: TextFile[];
140
142
  };
141
143
 
142
- type CssCode = "css/important" | "css/duplicate-keyframes" | "css/duplicate-selector" | "css/arbitrary-token" | "css/unused-custom-property" | "css/reduced-motion" | "css/class-patch" | "css/literal-token" | "css/unreadable";
144
+ type CssCode = "css/important" | "css/duplicate-keyframes" | "css/duplicate-selector" | "css/arbitrary-token" | "css/unused-custom-property" | "css/reduced-motion" | "css/class-patch" | "css/literal-token" | "css/root-route-css" | "css/unreadable";
143
145
  /** These codes fail the step. The other codes warn for one release. */
144
146
  declare const CSS_ERRORS: ReadonlySet<CssCode>;
145
147
  declare function analyseCss(inputs: CssInputs): CheckProblem[];
@@ -179,5 +181,27 @@ declare function checkTests({ cwd, packageManager, signal, }: StepOptions): Prom
179
181
 
180
182
  declare function checkTypes(options: StepOptions): Promise<CheckStep>;
181
183
 
182
- export { BUILTIN_ALLOWLIST_SOURCE, CSS_ERRORS, DEFAULT_STEP_TIMEOUTS, GLOBAL_DEV_PACKAGE_ALLOWLIST, INSTALL_SCRIPT_ALLOWLIST, PREBUILT_ENV, SECRET_FILE_SIZE_CAP, analyseCss, checkAllowlist, checkAudit, checkBudgets, checkBuild, checkConfig, checkCss, checkLint, checkReadiness, checkSecrets, checkTests, checkTypes, devSourceProblems, evaluateAudit, loadConfig, outputProblems, parseAuditOutput, runCheck, scanSecrets, supportsTypeScriptImport, validateBrand };
183
- export type { AllowlistSource, AuditAdvisory, AuditIgnore, AuditMode, CheckOptions, CheckProblem, CheckProgress, CheckResult, CheckResultValue, CheckStep, CheckStepName, CheckStepTimeouts, CssCode, CssInputs, PackageManager, SecretFinding, StepOptions, TextFile };
184
+ /**
185
+ * Reports files under the app directory that nothing imports and exports that no other file imports.
186
+ * Each problem warns, and the step fails only when `unused.fail` is true in zappie.config.ts.
187
+ */
188
+ declare function checkUnused({ cwd, signal, }: StepOptions): Promise<CheckStep>;
189
+
190
+ type TypeScriptApi = typeof TypeScript;
191
+
192
+ type UnusedCode = "unused/file" | "unused/export" | "unused/test-only";
193
+ type UnusedFinding = {
194
+ rule: UnusedCode;
195
+ /** Project-relative path with forward slashes. */
196
+ file: string;
197
+ /** The export, or undefined for a whole file. */
198
+ name?: string;
199
+ /** True when the file reads the export itself, so only the export keyword is unused. */
200
+ usedHere?: boolean;
201
+ line?: number;
202
+ };
203
+ /** Finds files under the app directory that nothing imports, and exports no other file imports. */
204
+ declare function findUnused(project: string, ts: TypeScriptApi, appDirectory?: string): Promise<UnusedFinding[]>;
205
+
206
+ export { BUILTIN_ALLOWLIST_SOURCE, CSS_ERRORS, DEFAULT_STEP_TIMEOUTS, GLOBAL_DEV_PACKAGE_ALLOWLIST, INSTALL_SCRIPT_ALLOWLIST, PREBUILT_ENV, SECRET_FILE_SIZE_CAP, analyseCss, checkAllowlist, checkAudit, checkBudgets, checkBuild, checkConfig, checkCss, checkLint, checkReadiness, checkSecrets, checkTests, checkTypes, checkUnused, devSourceProblems, evaluateAudit, findUnused, loadConfig, outputProblems, parseAuditOutput, runCheck, scanSecrets, supportsTypeScriptImport, validateBrand };
207
+ export type { AllowlistSource, AuditAdvisory, AuditIgnore, AuditMode, CheckOptions, CheckProblem, CheckProgress, CheckResult, CheckResultValue, CheckStep, CheckStepName, CheckStepTimeouts, CssCode, CssInputs, PackageManager, SecretFinding, StepOptions, TextFile, UnusedCode, UnusedFinding };