@zappie/check 0.4.1 → 0.6.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,26 @@
1
1
  # @zappie/check
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 009fbbf: The lint step runs the security rules from `eslint-plugin-zappie` as errors on every source file, with Zappie's config alone, so a project's ESLint config, ignores and `eslint-disable` comments can't turn them off. The build step scans the build output once for navigation off the site, refresh tags and headers, external scripts and links or sources on hosts the site doesn't list (`build/*`).
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [1ad2db2]
12
+ - Updated dependencies [d9baf67]
13
+ - Updated dependencies [8ea70dc]
14
+ - Updated dependencies [ea37bcf]
15
+ - eslint-plugin-zappie@0.4.0
16
+ - @zappie/sdk@0.2.0
17
+
18
+ ## 0.5.0
19
+
20
+ ### Minor Changes
21
+
22
+ - 68b9710: The config step checks `app/brand.json`, Studio's brand brief, when a site has one: its size, its JSON and every key and choice (`brand/*`). Its source map no longer copies the source text, which keeps the archive under its size budget.
23
+
3
24
  ## 0.4.1
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -11,19 +11,32 @@ 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 |
20
- | `types` | A TypeScript check of the project |
21
- | `test` | Your project's tests |
22
- | `build` | A production build |
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 |
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
+
28
+ ### Build output problems
29
+
30
+ The build step reads every HTML and JavaScript file under `build/client` and `build/server` once, so code from packages and generated code are covered too.
31
+
32
+ | Code | What it catches |
33
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------- |
34
+ | `build/no-offsite-navigation` | Code that sends the shopper to a URL written out in full, such as `location.href = "https://..."`, off Zappie's hosts |
35
+ | `build/no-meta-refresh` | A refresh tag or `Refresh` header to a URL off Zappie's hosts |
36
+ | `build/no-external-script` | A built page that loads a script from another host or a `data:` URL |
37
+ | `build/unlisted-link-host` | A link, form or source on a host that isn't Zappie's, the SDK's or listed in your config |
38
+
39
+ A store's own domains and the sites it links to go in `security.links` in `zappie.config.ts`. Image and font hosts can go in `security.csp`, and request hosts in `outbound.allow`. A refresh or navigation to a URL computed at run time isn't caught here; the lint rules cover the source that builds it.
27
40
 
28
41
  ### CSS problems
29
42
 
package/dist/index.d.ts CHANGED
@@ -72,6 +72,12 @@ declare function checkAudit(options: StepOptions, dependencies?: AuditDependenci
72
72
  declare function evaluateAudit(advisories: AuditAdvisory[], mode: "report" | "enforce", ignores?: AuditIgnore[], file?: string): CheckStep;
73
73
  declare function parseAuditOutput(manager: PackageManager, source: string): AuditAdvisory[];
74
74
 
75
+ /** Checks a parsed `app/brand.json`. Returns one problem per wrong, missing or unknown key, with its JSON path. */
76
+ declare function validateBrand(value: unknown): {
77
+ path: string;
78
+ message: string;
79
+ }[];
80
+
75
81
  declare function checkBudgets({ cwd, signal, }: StepOptions): Promise<CheckStep>;
76
82
 
77
83
  declare function checkBuild({ cwd, packageManager, signal, }: StepOptions): Promise<CheckStep>;
@@ -115,6 +121,13 @@ declare function devSourceProblems(cwd: string): Promise<CheckProblem[]>;
115
121
 
116
122
  declare function checkLint({ cwd, signal, }: StepOptions): Promise<CheckStep>;
117
123
 
124
+ /**
125
+ * Scan the build output once, which includes code from packages and code generated at build time, for navigation off
126
+ * the site, refresh tags and headers, pages that load scripts from elsewhere, and links or sources on hosts the site
127
+ * doesn't list.
128
+ */
129
+ declare function outputProblems(cwd: string): Promise<CheckProblem[]>;
130
+
118
131
  declare function checkReadiness({ cwd, signal, }: StepOptions): Promise<CheckStep>;
119
132
 
120
133
  declare function runCheck(options: CheckOptions): Promise<CheckResult>;
@@ -132,5 +145,5 @@ declare function checkTests({ cwd, packageManager, signal, }: StepOptions): Prom
132
145
 
133
146
  declare function checkTypes(options: StepOptions): Promise<CheckStep>;
134
147
 
135
- export { BUILTIN_ALLOWLIST_SOURCE, CSS_ERRORS, GLOBAL_DEV_PACKAGE_ALLOWLIST, INSTALL_SCRIPT_ALLOWLIST, SECRET_FILE_SIZE_CAP, analyseCss, checkAllowlist, checkAudit, checkBudgets, checkBuild, checkConfig, checkCss, checkLint, checkReadiness, checkSecrets, checkTests, checkTypes, devSourceProblems, evaluateAudit, loadConfig, parseAuditOutput, runCheck, scanSecrets, supportsTypeScriptImport };
148
+ export { BUILTIN_ALLOWLIST_SOURCE, CSS_ERRORS, GLOBAL_DEV_PACKAGE_ALLOWLIST, INSTALL_SCRIPT_ALLOWLIST, 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 };
136
149
  export type { AllowlistSource, AuditAdvisory, AuditIgnore, AuditMode, CheckOptions, CheckProblem, CheckResult, CheckResultValue, CheckStep, CheckStepName, CssCode, CssInputs, PackageManager, SecretFinding, StepOptions, TextFile };