@zappie/check 0.15.0 → 0.16.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 +17 -0
- package/README.md +21 -0
- package/dist/chunk-PWFNNCJC.js +1 -0
- package/dist/index.d.ts +26 -6
- package/dist/index.js +4 -4
- package/dist/step-worker.js +1 -1
- package/package.json +4 -3
- package/schema/check-result.v1.json +2 -1
- package/dist/chunk-ISB7GXMV.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @zappie/check
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 756dd1b: Self-serve site settings for sites with their own code.
|
|
8
|
+
|
|
9
|
+
- `@zappie/sdk`: `hosts` in `zappie.config.ts` lists each host a site loads or calls with what it does there (`fetch`, `script`, `frame`, `image`, `font`, `style`) and why. `securityHeaders()` adds each host to the directives of its uses, never to `script-src`. `validateConfig()` accepts the key, and `zappie check` validates its entries.
|
|
10
|
+
- `@zappie/check`: on a site with its own code (`code: "own"` in `.zappie/site.json` or `ZAPPIE_CHECK_SITE`), size budgets, unused code, CSS style and lint style warn with `"severity": "warning"` and never fail their step. The security lint rules and every other step stay errors, and templates and sites made in Studio keep every check enforced. The rules that guard credentials, Zappie's hosts, secrets, checkout, the cart and the host list run with the security rules, where no project config or `eslint-disable` comment turns them off. The config step validates `hosts`: hostnames, wildcards over any public suffix (`*.co.uk`, `*.github.io`, `*.workers.dev`), names a URL parser reads as an address (`127.1`), Zappie's own domains and Workers (`config/zappie_host`), uses, duplicates, and at most 53 hosts across `hosts`, `outbound.allow` and `security.csp` (`config/too_many_hosts`). A problem in those lists fails the step on every site, though `zappie.config.ts` is Zappie's file. The lint rules and the output scan read the one host list, valid hosts only, so a `connectSrc` host satisfies `no-unlisted-fetch` and a `script` host lets the site load an https script from it.
|
|
11
|
+
- `@zappie/verify`: `advise` (or `ZAPPIE_VERIFY_ADVISE=1`) makes V14's size and speed budgets warnings. `allowedHosts` (or `ZAPPIE_VERIFY_ALLOWED_HOSTS`) stops requests to other hosts at once, and a check that fails after one fails with `host_not_allowed`, naming the host and the `zappie hosts add` command for what the page did with it (`--for fetch`, `script` or `frame`), without a retry. A check the page passes anyway passes.
|
|
12
|
+
- `eslint-plugin-zappie`: `no-unlisted-fetch` accepts `hosts` entries for fetch and `security.csp.connectSrc`, and its message names `zappie hosts add`. `no-external-scripts` accepts an https script from a host listed for script.
|
|
13
|
+
- `zappie`: `zappie hosts list|add|remove` and `zappie settings`. `zappie push` lists the warnings Publish goes ahead with beside what it will refuse, and records whose code the site is so the local check matches Publish, the first push of a site made in Studio included.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [756dd1b]
|
|
18
|
+
- eslint-plugin-zappie@0.11.0
|
|
19
|
+
|
|
3
20
|
## 0.15.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -175,6 +175,27 @@ In a project linked to no site, such as a template, every finding counts. In JSO
|
|
|
175
175
|
|
|
176
176
|
The rule for which files are yours is exported as `developerMayChange(file, managed)` from `@zappie/check/site-files`, a module that imports nothing.
|
|
177
177
|
|
|
178
|
+
## Sites with their own code
|
|
179
|
+
|
|
180
|
+
On a site whose developer writes its own code, size, unused code and style are a guide, not a gate. Over a budget in `budgets`, an unused file or export, a finding of the `css` step or a lint rule that is only style is reported with `"severity": "warning"`, and its step passes, so Publish goes ahead. A warning reads like `CSS is 11.0 KB gzip, above the 10.5 KB guide.`
|
|
181
|
+
|
|
182
|
+
What protects Zappie, shoppers' money and other merchants stays an error on every site: the `config`, `allowlist`, `audit`, `types`, `test`, `secrets` and `readiness` steps, the build and its output scan, and the lint rules of the security config, `no-direct-api`, `no-unlisted-fetch`, `no-server-env-in-client`, `no-custom-auth`, `no-tracking-scripts`, `checkout-via-sdk` and `cart-via-sdk`.
|
|
183
|
+
|
|
184
|
+
The check knows a site has its own code from `code: "own"` in `.zappie/site.json`, which `zappie pull` and `zappie push` write, or in `ZAPPIE_CHECK_SITE`, as in `{"managed":[],"code":"own"}`. From code, pass `site: { managed: [...], code: "own" }`. A template, a site made in Studio and a project linked to no site keep every check enforced.
|
|
185
|
+
|
|
186
|
+
## The site's hosts
|
|
187
|
+
|
|
188
|
+
A site lists the hosts it loads or calls once, in `hosts` in `zappie.config.ts`, each with what it does there:
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
hosts: [
|
|
192
|
+
{ host: "tickets.example.com", for: ["fetch"], reason: "Ticket checkout loads events" },
|
|
193
|
+
{ host: "widget.example.com", for: ["script"], reason: "Reviews widget" },
|
|
194
|
+
],
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`zappie hosts add` writes it, and the `config` step checks each entry: a hostname without a scheme, path, port or IP, no wildcard as broad as `*.com`, none of Zappie's own hosts, known uses, each host once, and at most 53 hosts across `hosts`, `outbound.allow` and `security.csp`. The lint rules, the build output scan and the site's security policy read it with `outbound.allow` and `security.csp`, which keep working: a `connectSrc` host is a `fetch` host. A `script` host lets the site load an https script from it, which `no-external-scripts` and the output scan otherwise refuse.
|
|
198
|
+
|
|
178
199
|
## Progress and time limits
|
|
179
200
|
|
|
180
201
|
`zappie check` writes a line to stderr as each step starts and finishes, with or without `--json`. Stdout still holds only the result, so the last line of stdout stays the JSON document.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{carriesSecrets,cleanSitePath,developerMayChange}from"./chunk-DX7SE6KL.js";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}import{readFileSync}from"fs";import path from"path";var SITE_ENV="ZAPPIE_CHECK_SITE";var LINK_FILE=path.join(".zappie","site.json");var GENERATED=["build/","dist/",".react-router/",".wrangler/","node_modules/",".zappie/"];var managedOf=value=>{const managed=value?.managed;return Array.isArray(managed)?managed.filter(entry=>typeof entry==="string"):[]};var codeOf=value=>{const code=value?.code;return code==="own"||code==="zappie"?{code}:{}};function siteFilesFor(options,env=process.env){if(options.site!==void 0){return options.site===false?void 0:{managed:[...options.site.managed],...codeOf(options.site)}}const set=env[SITE_ENV]?.trim();if(set){if(set==="1"){return{managed:[]}}let parsed;try{parsed=JSON.parse(set)}catch{throw new Error(`${SITE_ENV} must be 1 or JSON such as {"managed":["vite.config.ts"],"code":"own"}.`)}return{managed:managedOf(parsed),...codeOf(parsed)}}return linkedSite(options.cwd)}function linkedSite(cwd){let state;try{state=JSON.parse(readFileSync(path.join(cwd,LINK_FILE),"utf8"))}catch{return void 0}const site=state?.site;return typeof site==="string"&&site!==""?{managed:managedOf(state),...codeOf(state)}:void 0}function keptByZappie(site,file){if(!site||!file||carriesSecrets(file)||file==="git history"||/^[0-9a-f]{7,64}:/.test(file)){return false}const clean=cleanSitePath(file);if(clean===void 0||clean===""||path.isAbsolute(file)||GENERATED.some(folder=>clean.startsWith(folder))){return false}return!developerMayChange(clean,site.managed)}function owned(site,found){let failed=false;const problems=found.map(({problem:problem2,blocks})=>{if(keptByZappie(site,problem2.file)){return{...problem2,owner:"zappie"}}failed||=blocks;return problem2});return{failed,problems}}var advises=site=>site?.code==="own";var warning=found=>({...found,severity:"warning"});function advised(site,found,advice=()=>true){if(!advises(site)){return owned(site,found)}return owned(site,found.map(entry=>entry.blocks&&advice(entry)?{problem:warning(entry.problem),blocks:false}:entry))}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,path9,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:path9?`${path9}.${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+|0x[0-9a-f]*)$/i.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,path9,keys,issue,validate){if(value===void 0){return}if(!record(value)){issue({path:path9,code:"invalid_type",message:`Expected an object. Set ${path9} to an object or remove it.`,severity:"error"});return}unknownKeys(value,keys,path9,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 path9=`budgets.${key}${route&&`.${route}`}`;if(amount===void 0){continue}if(!Number.isFinite(amount)||amount<=0){error(path9,"invalid_type",`Expected a positive finite number. Set ${path9} to a number greater than zero.`)}else if(key==="tappableMs"&&amount>5e3){error(path9,"invalid_format",`The ${key} budget cannot exceed 5000. Set ${path9} 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(path9,"budget_override",`${message3} Add budgets.override.reason to explain the increase.`)}else{issue({path:path9,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","hosts","security","budgets","readiness","analytics","verify","unused","corners"];function validateConfig(input){const issues=[];const issue=value=>issues.push(value);const error=(path9,code,message3)=>issue({path:path9,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);branchList(stringList(input.branches,"branches",error),error);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,()=>{});for(const key of["unused","corners"]){nested(input[key],key,key==="unused"?["fail"]:["fail","files"],issue,value=>{if(value.fail!==void 0&&typeof value.fail!=="boolean"){error(`${key}.fail`,"invalid_type",`Expected a boolean. Set ${key}.fail to true or remove it.`)}stringList(value.files,`${key}.files`,error)})}return{valid:!issues.some(entry=>entry.severity==="error"),issues}}function theme(value,error){if(typeof value!=="string"||!/\.json$/.test(value)||/^(?:[a-z][a-z\d+.-]*:|\/)|\\/i.test(value)){error("theme",typeof value==="string"?"invalid_format":value===void 0?"missing_required":"invalid_type","Expected a relative .json path. Use a value such as ./theme.json.")}}function stringList(value,path9,error){if(value===void 0){return void 0}if(!Array.isArray(value)||value.some(entry=>typeof entry!=="string")){error(path9,"invalid_type",`Expected an array of strings. Set ${path9} to string values.`);return void 0}return value}function branchList(value,error){if(!value){return}if(value.length===0){error("branches","invalid_format","Expected at least one value. Add a value to branches or remove the field.")}value.forEach((entry,index)=>{if(!nonblank(entry)){error(`branches[${index}]`,"invalid_format","Expected a non-empty branch slug. Remove the empty value or use a branch slug.")}});if(new Set(value).size!==value.length){error("branches","duplicate","Expected unique values. Remove duplicates from branches.")}}function hostList(value,path9,error){stringList(value,path9,error)?.forEach((host,index)=>{if(!hostname(host)){error(`${path9}[${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=(path9,code,message3,severity="error")=>issues.push({path:path9,code,message:message3,severity});const keys=(obj,allowed,path9)=>{for(const key of Object.keys(obj)){if(!allowed.includes(key)){issue(path9?`${path9}.${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 path9=`${group}.${key}`;if(!includes(TOKEN_NAMES,key)){issue(path9,"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(path9,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 path9=`fonts[${i}]`;if(!record2(font)){issue(path9,"invalid_font","Expected a font object");return}keys(font,["family","source","url","weights","role"],path9);if(typeof font.family!=="string"||!isFontFamily(font.family)||font.family.includes(",")){issue(`${path9}.family`,"invalid_font","Expected one unquoted font family")}if(typeof font.source!=="string"||!["google","self","system"].includes(font.source)){issue(`${path9}.source`,"invalid_font","Unknown font source")}if(typeof font.role!=="string"||!["display","body","mono"].includes(font.role)||roles.has(font.role)){issue(`${path9}.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(`${path9}.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(`${path9}.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 path3 from"path";import{pathToFileURL}from"url";import{readFile}from"fs/promises";import path2 from"path";var CLI_STATE_DIRECTORIES=[".zappie",".zappie.next",".zappie.old"];var CLI_STATE_IGNORES=CLI_STATE_DIRECTORIES.map(directory=>`${directory}/**`);function inCliState(relativePath){const first=relativePath.split(/[/\\]/)[0];return first!==void 0&&CLI_STATE_DIRECTORIES.includes(first)}async function json(file){return JSON.parse(await readFile(file,"utf8"))}function relative(cwd,file){return path2.relative(cwd,file).split(path2.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)]);import{getPublicSuffix}from"tldts";var record3=value=>!!value&&typeof value==="object"&&!Array.isArray(value);function hostname2(value){const host=plainHostname(value);if(host===void 0){return false}return!value.startsWith("*.")||!publicSuffix(host)}function plainHostname(value){const host=(value.startsWith("*.")?value.slice(2):value).toLowerCase();const labels=host.split(".");if(labels.length<2||host.length>253||!labels.every(label=>/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label))||/^(?:\d+|0x[0-9a-f]*)$/.test(labels.at(-1)??"")){return void 0}return host}function publicSuffix(name){return getPublicSuffix(name,{allowPrivateDomains:true})===name}var HOST_USES=["fetch","script","frame","image","font","style"];var MAX_SITE_HOSTS=53;var ZAPPIE_DOMAINS=["zappie.ai","zappie.shop","zappie.dev","r2.cloudflarestorage.com"];var ZAPPIE_WORKERS=["site-build","site-workspace"];var cspUses={imgSrc:"image",connectSrc:"fetch",fontSrc:"font",styleSrc:"style",frameSrc:"frame"};function isZappieDomain(value){const lower=value.toLowerCase();const wildcard=lower.startsWith("*.");const host=wildcard?lower.slice(2):lower;if(ZAPPIE_DOMAINS.some(domain=>host===domain||host.endsWith(`.${domain}`))){return true}if(!host.endsWith(".workers.dev")){return false}return wildcard||ZAPPIE_WORKERS.some(worker=>host.startsWith(`${worker}-`)||host.startsWith(`${worker}.`))}var strings=value=>Array.isArray(value)?value.filter(entry=>typeof entry==="string"):[];var useOf=value=>HOST_USES.includes(value);function siteHosts(config){const found=new Map;const add=(value,uses,reason)=>{const host=value.trim().toLowerCase();if(!hostname2(host)||isZappieDomain(host)){return}const entry=found.get(host)??{host,uses:[]};for(const use of uses){if(!entry.uses.includes(use)){entry.uses.push(use)}}if(reason&&!entry.reason){entry.reason=reason}found.set(host,entry)};if(!record3(config)){return[]}for(const entry of Array.isArray(config.hosts)?config.hosts:[]){if(record3(entry)&&typeof entry.host==="string"){const uses=Array.isArray(entry.for)?entry.for.filter(useOf):[];add(entry.host,uses,typeof entry.reason==="string"&&entry.reason.trim()?entry.reason.trim():void 0)}}const outbound=record3(config.outbound)?config.outbound:{};for(const host of strings(outbound.allow)){add(host,["fetch"])}const security=record3(config.security)?config.security:{};const csp=record3(security.csp)?security.csp:{};for(const[name,use]of Object.entries(cspUses)){for(const host of strings(csp[name])){add(host,[use])}}return[...found.values()]}var hostsFor=(config,use)=>siteHosts(config).filter(({uses})=>uses.includes(use)).map(({host})=>host);var ENTRY='Use entries such as { host: "api.example.com", for: ["fetch"] }.';function hostProblems(config){const problems=[];const add=(path9,code,message3,fix)=>problems.push(problem(`${path9}: ${message3}`,fix,{rule:`config/${code}`,file:"zappie.config.ts"}));const hosts=record3(config)?config.hosts:void 0;if(hosts!==void 0&&!Array.isArray(hosts)){add("hosts","invalid_type","Expected an array.",ENTRY)}const seen=new Set;(Array.isArray(hosts)?hosts:[]).forEach((entry,index)=>{const path9=`hosts[${index}]`;if(!record3(entry)){add(path9,"invalid_type","Expected an object.",ENTRY);return}for(const key of Object.keys(entry)){if(!["host","for","reason"].includes(key)){add(`${path9}.${key}`,"unknown_key",`Unknown field "${key}".`,"Remove it. An entry takes host, for and reason.")}}const host=typeof entry.host==="string"?entry.host:void 0;if(host===void 0||!hostname2(host)){add(`${path9}.host`,host===void 0?"missing_required":"invalid_format","Expected a hostname or leading *. subdomain pattern without a scheme, path, port or IP.","Name the host alone, such as api.example.com. A wildcard as broad as *.com lets any site run code on the shop.")}else if(isZappieDomain(host)){add(`${path9}.host`,"zappie_host",`${host} is one of Zappie's own hosts.`,"Remove it. The SDK reaches the Zappie hosts a site needs.")}else if(seen.has(host.toLowerCase())){add(`${path9}.host`,"duplicate",`${host} is listed twice.`,"Keep one entry and list all its uses there.")}if(host){seen.add(host.toLowerCase())}const uses=entry.for;if(!Array.isArray(uses)||uses.length===0||uses.some(use=>!useOf(use))){add(`${path9}.for`,Array.isArray(uses)?"invalid_format":"invalid_type",`Expected one or more of ${HOST_USES.join(", ")}.`,'List what the site does with the host, such as for: ["fetch"].')}if(entry.reason!==void 0&&(typeof entry.reason!=="string"||!entry.reason.trim())){add(`${path9}.reason`,"invalid_format","Expected a non-blank reason.","Say why the site needs the host, or remove reason.")}});const outbound=record3(config)&&record3(config.outbound)?config.outbound:{};const security=record3(config)&&record3(config.security)?config.security:{};const csp=record3(security.csp)?security.csp:{};const legacy=[["outbound.allow",outbound.allow],...Object.keys(cspUses).map(name=>[`security.csp.${name}`,csp[name]])];for(const[list,values]of legacy){(Array.isArray(values)?values:[]).forEach((value,index)=>{if(typeof value!=="string"||plainHostname(value)===void 0){return}if(!hostname2(value)){add(`${list}[${index}]`,"invalid_format",`${value} covers a whole domain ending or shared hosting domain.`,"Name the exact host. A wildcard as broad as *.github.io lets any site run code on the shop.")}})}const listed=siteHosts(config).length;if(listed>MAX_SITE_HOSTS){add("hosts","too_many_hosts",`The site lists ${listed} hosts across hosts, outbound.allow and security.csp, more than the ${MAX_SITE_HOSTS} a site may list.`,"Remove the hosts the site no longer uses.")}return problems}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=path3.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,site}){signal?.throwIfAborted();let loaded;try{loaded=await loadConfig(cwd)}catch(error){const checked2=owned(site,[{problem:problem(message(error),"Create a readable zappie.config.ts in the project root.",{file:"zappie.config.ts"}),blocks:true}]);return step("config",checked2.failed?"failed":"passed",checked2.problems)}const validation=validateConfig(loaded.value);const found=[...validation.issues.map(issue=>({problem:configProblem(issue,loaded.source),blocks:issue.severity==="error"})),...hostProblems(loaded.value).map(found2=>({problem:found2,blocks:true}))];const theme2=configTheme(loaded.value);if(theme2){found.push(...await themeProblems(cwd,theme2))}const brand=await brandProblems(cwd);found.push(...brand.map(problem2=>({problem:problem2,blocks:true})));signal?.throwIfAborted();const hosts=found.filter(({problem:found2})=>hostListProblem(found2));const checked=owned(site,found.filter(entry=>!hosts.includes(entry)));const failed=checked.failed||hosts.some(({blocks})=>blocks);return step("config",failed?"failed":"passed",[...hosts.map(({problem:found2})=>found2),...checked.problems])}var HOST_LISTS=/^(?:hosts|outbound\.allow|security\.csp)\b/;var hostListProblem=found=>found.rule?.startsWith("config/")===true&&found.file==="zappie.config.ts"&&HOST_LISTS.test(found.message);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=path3.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 issues.map(issue=>({problem:themeProblem(issue,source,theme2),blocks:issue.severity==="error"}))}catch(error){return[{problem:problem(message(error),`Make ${theme2} a readable JSON theme file.`,{rule:"theme/unreadable",file:theme2}),blocks:true}]}}var BRAND_FILE="app/brand.json";async function brandProblems(cwd){let source;try{source=await readFile2(path3.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 readFile5}from"fs/promises";import{createRequire}from"module";import path6 from"path";import{pathToFileURL as pathToFileURL2}from"url";import{readFile as readFile4}from"fs/promises";import path5 from"path";import{lstat,readFile as readFile3,readdir}from"fs/promises";import path4 from"path";var FILE_SIZE_CAP=1024*1024;var BUILD_FILE_SIZE_CAP=8*1024*1024;var ignoredDirectories=new Set(["node_modules","build","build-standard","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(path4.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=path4.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 attributionSetting(template){if(typeof template!=="object"||template===null||!("poweredByZappie"in template)){return{}}const setting=template.poweredByZappie;if(setting===void 0){return{}}const reason=typeof setting==="object"&&setting!==null&&setting.required===false&&typeof setting.reason==="string"?setting.reason.trim():"";return reason?{optOut:reason}:{ignored:true}}function attributionProblems(files,setting={}){if(setting.optOut){return{failed:false,problems:[problem(`Powered by Zappie is not checked: the template shows no link, as its zappie.template.json declares: ${/[.!?]$/.test(setting.optOut)?setting.optOut:`${setting.optOut}.`}`,"Remove poweredByZappie from zappie.template.json to require the link again.",{rule:ATTRIBUTION_RULE,file:"zappie.template.json"})]}}const ignored=setting.ignored?[problem('zappie.template.json sets poweredByZappie, but not as { "required": false, "reason": "\u2026" } with a reason, so the link is still required.',"Give poweredByZappie required false and a reason, or remove it.",{rule:ATTRIBUTION_RULE,file:"zappie.template.json"})]:[];const judged=judgeAttribution(files);return{...judged,problems:[...ignored,...judged.problems]}}function judgeAttribution(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 readSetting(cwd){try{return attributionSetting(JSON.parse(await readFile4(path5.join(cwd,"zappie.template.json"),"utf8")))}catch{return{}}}async function checkAttribution(cwd){return attributionProblems(await readSourceCode(cwd),await readSetting(cwd))}var SECURITY_IGNORES=[...CLI_STATE_IGNORES,"build/**","build-standard/**","dist/**",".react-router/**",".wrangler/**","coverage/**","playwright-report/**","test-results/**"];var ENFORCED_LINT_RULES=["zappie/no-direct-api","zappie/no-unlisted-fetch","zappie/no-server-env-in-client","zappie/no-custom-auth","zappie/no-tracking-scripts","zappie/checkout-via-sdk","zappie/cart-via-sdk"];async function checkLint({cwd,signal,site}){signal?.throwIfAborted();let ESLint;try{const require2=createRequire(path6.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 loadedPlugin=await import("eslint-plugin-zappie");const zappie=loadedPlugin.default;const siteValue=await siteConfig(cwd);const settings={zappie:{outboundAllow:hostsFor(siteValue,"fetch"),scriptHosts:hostsFor(siteValue,"script")}};const enforced=new Set([...ENFORCED_LINT_RULES,...(zappie.configs.security??[]).flatMap(entry=>Object.keys(entry.rules??{}))]);const style=({problem:found,fatal})=>!fatal&&!(found.rule!==void 0&&enforced.has(found.rule));const eslint=new ESLint({cwd,overrideConfig:[{ignores:CLI_STATE_IGNORES},{settings}]});const security=await securityResults(zappie,ESLint,cwd,settings);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){const checked2=advised(site,[...problems.map(found=>({problem:found,blocks:true})),...lintProblems(cwd,security)],style);return step("lint",checked2.failed||attribution.failed?"failed":"passed",[...checked2.problems,...attribution.problems])}const results=[...security,...await eslint.lintFiles(["."])];signal?.throwIfAborted();const checked=advised(site,lintProblems(cwd,results),style);return step("lint",checked.failed||attribution.failed?"failed":"passed",[...checked.problems,...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,settings){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},{settings},...security,{name:"zappie/check-enforced",files:["**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"],ignores:["**/*.test.*","**/*.spec.*","**/__tests__/**"],plugins:{zappie},rules:Object.fromEntries(ENFORCED_LINT_RULES.map(rule=>[rule,"error"]))}]});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:problem(entry.message,null,{...entry.ruleId?{rule:entry.ruleId}:{},file,...entry.line?{line:entry.line}:{}}),blocks:entry.fatal===true||entry.severity===2,...entry.fatal?{fatal:true}:{}}]}))}async function siteConfig(cwd){try{return(await loadConfig(cwd)).value}catch{return void 0}}async function installedPlugin(cwd){for(let directory=path6.resolve(cwd);;){const root=path6.join(directory,"node_modules","eslint-plugin-zappie");const manifest=await readManifest(path6.join(root,"package.json"));if(manifest){const loaded=await import(pathToFileURL2(path6.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=path6.dirname(directory);if(parent===directory){return void 0}directory=parent}}async function readManifest(file){try{return JSON.parse(await readFile5(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(path6.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 path8 from"path";import{fileURLToPath,pathToFileURL as pathToFileURL3}from"url";import{spawn}from"child_process";import{constants}from"fs";import{access}from"fs/promises";import path7 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=path7.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=path8.dirname(here);if(here.endsWith(".ts")){const tsx=pathToFileURL3(createRequire2(here).resolve("tsx")).href;return["--import",tsx,path8.join(directory,"step-worker.ts")]}return[path8.join(directory,"step-worker.js")]}export{DEFAULT_BUDGETS,GLOBAL_PACKAGE_ALLOWLIST,validateBrand,inCliState,json,relative,problem,step,skipped,siteHosts,hostsFor,SITE_ENV,siteFilesFor,owned,advises,warning,advised,supportsTypeScriptImport,loadConfig,checkConfig,KILL_GRACE_MS,command,PNPM_NO_VERIFY,binaryArgs,scriptArgs,readCssInputs,checkLint,ISOLATED_STEPS,STEP_RESULT_MARK,isIsolatedStep,isolated};
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,24 @@ type CheckProblem = {
|
|
|
14
14
|
* test. Zappie fixes it, and it never fails its step. Absent for every other problem.
|
|
15
15
|
*/
|
|
16
16
|
owner?: "zappie";
|
|
17
|
+
/**
|
|
18
|
+
* "warning" when the problem is advice: it is reported and never fails its step. On a site with its own code, size,
|
|
19
|
+
* unused code and lint style are advice. Absent, or "error", for a problem that fails its step, and absent for a
|
|
20
|
+
* note in a step that passed.
|
|
21
|
+
*/
|
|
22
|
+
severity?: "error" | "warning";
|
|
17
23
|
};
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The files of a Zappie site that Zappie keeps current, as entries in the starter's `managed` list, and whose code it
|
|
26
|
+
* is. `code: "own"` is a site whose developer writes its code: there size, unused code and lint style only warn.
|
|
27
|
+
* Unset, the site is Zappie's, a template or made in Studio, and every check is enforced.
|
|
28
|
+
*/
|
|
19
29
|
type SiteFiles = {
|
|
20
30
|
managed: readonly string[];
|
|
31
|
+
code?: SiteCode;
|
|
21
32
|
};
|
|
33
|
+
/** Who writes a site's code: its own developer, or Zappie (a gallery template or a site made in Studio). */
|
|
34
|
+
type SiteCode = "own" | "zappie";
|
|
22
35
|
type AuditMode = "off" | "report" | "enforce";
|
|
23
36
|
type AuditAdvisory = {
|
|
24
37
|
id: string;
|
|
@@ -79,6 +92,7 @@ type CheckOptions = {
|
|
|
79
92
|
* Checks the code of a Zappie site, where the developer changes only app/ and public/: a finding in any other file,
|
|
80
93
|
* a test or a file Zappie manages is Zappie's and never fails its step. Unset, it follows ZAPPIE_CHECK_SITE, then
|
|
81
94
|
* .zappie/site.json, which zappie link and zappie pull write. `false` counts every finding, as for a template.
|
|
95
|
+
* `code: "own"` makes size, unused code and lint style warnings, as Publish does for a site with its own code.
|
|
82
96
|
*/
|
|
83
97
|
site?: SiteFiles | false;
|
|
84
98
|
};
|
|
@@ -128,7 +142,11 @@ declare function validateBrand(value: unknown): {
|
|
|
128
142
|
message: string;
|
|
129
143
|
}[];
|
|
130
144
|
|
|
131
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Measures each route's JavaScript and CSS against the site's budgets. Over a budget fails the step, except on a site
|
|
147
|
+
* with its own code, where the budgets are a guide: a figure over one is a warning and the step passes.
|
|
148
|
+
*/
|
|
149
|
+
declare function checkBudgets({ cwd, signal, site, }: StepOptions): Promise<CheckStep>;
|
|
132
150
|
|
|
133
151
|
/** Set to 1 to scan an existing build instead of building again, as runCheck's `prebuilt` does. */
|
|
134
152
|
declare const PREBUILT_ENV = "ZAPPIE_CHECK_PREBUILT";
|
|
@@ -237,8 +255,9 @@ declare const SEO_RULES: {
|
|
|
237
255
|
declare function checkSeo({ cwd, signal, site, }: StepOptions): Promise<CheckStep>;
|
|
238
256
|
|
|
239
257
|
/**
|
|
240
|
-
* Set by Zappie's publish build: `1`, or `{"managed":[...]}` naming the files Zappie keeps current
|
|
241
|
-
* counts only findings in files the developer may change, as
|
|
258
|
+
* Set by Zappie's publish build: `1`, or `{"managed":[...],"code":"own"}` naming the files Zappie keeps current and,
|
|
259
|
+
* for a site with its own code, saying so. The check then counts only findings in files the developer may change, as
|
|
260
|
+
* runCheck's `site` does, and on a site with its own code turns size, unused code and lint style into warnings.
|
|
242
261
|
*/
|
|
243
262
|
declare const SITE_ENV = "ZAPPIE_CHECK_SITE";
|
|
244
263
|
|
|
@@ -250,7 +269,8 @@ type TypeScriptApi = typeof TypeScript;
|
|
|
250
269
|
|
|
251
270
|
/**
|
|
252
271
|
* Reports files under the app directory that nothing imports and exports that no other file imports.
|
|
253
|
-
* Each problem warns, and the step fails only when `unused.fail` is true in zappie.config.ts
|
|
272
|
+
* Each problem warns, and the step fails only when `unused.fail` is true in zappie.config.ts and the site's code is
|
|
273
|
+
* not its own developer's: there unused code is always a warning.
|
|
254
274
|
*/
|
|
255
275
|
declare function checkUnused({ cwd, signal, site, }: StepOptions): Promise<CheckStep>;
|
|
256
276
|
|
|
@@ -269,4 +289,4 @@ type UnusedFinding = {
|
|
|
269
289
|
declare function findUnused(project: string, ts: TypeScriptApi, appDirectory?: string): Promise<UnusedFinding[]>;
|
|
270
290
|
|
|
271
291
|
export { BUILTIN_ALLOWLIST_SOURCE, CSS_ERRORS, DEFAULT_CORNER_FILES, DEFAULT_STEP_TIMEOUTS, GLOBAL_DEV_PACKAGE_ALLOWLIST, INSTALL_SCRIPT_ALLOWLIST, PREBUILT_ENV, SECRET_FILE_SIZE_CAP, SEO_RULES, SITE_ENV, analyseCss, checkAllowlist, checkAudit, checkBudgets, checkBuild, checkConfig, checkCss, checkLint, checkReadiness, checkSecrets, checkSeo, checkTests, checkTypes, checkUnused, devSourceProblems, evaluateAudit, findUnused, loadConfig, outputProblems, parseAuditOutput, runCheck, scanSecrets, supportsTypeScriptImport, validateBrand };
|
|
272
|
-
export type { AllowlistSource, AuditAdvisory, AuditIgnore, AuditMode, CheckOptions, CheckProblem, CheckProgress, CheckResult, CheckResultValue, CheckStep, CheckStepName, CheckStepTimeouts, CornerSettings, CssCode, CssInputs, PackageManager, SecretFinding, SiteFiles, StepOptions, TextFile, UnusedCode, UnusedFinding };
|
|
292
|
+
export type { AllowlistSource, AuditAdvisory, AuditIgnore, AuditMode, CheckOptions, CheckProblem, CheckProgress, CheckResult, CheckResultValue, CheckStep, CheckStepName, CheckStepTimeouts, CornerSettings, CssCode, CssInputs, PackageManager, SecretFinding, SiteCode, SiteFiles, StepOptions, TextFile, UnusedCode, UnusedFinding };
|