@rivi-software/workers-bundle-check 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/check.d.ts CHANGED
@@ -27,45 +27,58 @@ export type WorkerBundleCheckOptions = {
27
27
  export type WorkerBundleProblem = ({
28
28
  /** A Worker file holds modules a rule forbids, largest first. */
29
29
  kind: "forbidden-module";
30
+ /** The rule the modules break. */
30
31
  rule: ForbiddenRule;
32
+ /** The Worker file that holds them. */
31
33
  file: string;
34
+ /** The modules the rule's pattern matches, and the bytes each renders in the file. */
32
35
  modules: BundledModule[];
33
36
  } | {
34
37
  /** A Worker file contains a forbidden marker. */
35
38
  kind: "forbidden-marker";
39
+ /** The rule whose marker the file contains. */
36
40
  rule: ForbiddenRule;
41
+ /** The Worker file that contains it. */
37
42
  file: string;
38
43
  } | {
39
44
  /** A rule's module pattern or marker matches nothing the project has. */
40
45
  kind: "stale-rule";
46
+ /** The rule that guards nothing. */
41
47
  rule: ForbiddenRule;
48
+ /** The part of it that matches nothing. */
42
49
  part: "module" | "marker";
43
50
  } | {
44
51
  /** A Worker file has no source map, so the rules cannot see its modules. */
45
52
  kind: "missing-source-map";
53
+ /** The Worker file without a map. */
46
54
  file: string;
47
55
  } | {
48
56
  /** A `.map` file the assets would serve. */
49
57
  kind: "served-source-map";
58
+ /** The map, in the assets directory. */
50
59
  file: string;
51
60
  } | {
52
61
  /** A script or style the assets would serve with its source map inline. */
53
62
  kind: "inline-source-map";
63
+ /** The script or style, in the assets directory. */
54
64
  file: string;
55
65
  } | {
56
66
  /** A value shaped like a secret, in a Worker file or a served asset. */
57
67
  kind: "secret";
68
+ /** The Worker file or served asset that holds the value. */
58
69
  file: string;
59
70
  /** The pattern's name. */
60
71
  name: string;
61
72
  /** The first 16 hexadecimal digits of the value's SHA-256; the value is never reported. */
62
73
  fingerprint: string;
74
+ /** The line the value is on, from 1. */
63
75
  line: number;
64
76
  /** The module the value comes from, when the file has a source map. */
65
77
  module?: string;
66
78
  } | {
67
79
  /** An allowed secret that matches no finding. */
68
80
  kind: "stale-allowed-secret";
81
+ /** The entry of `allowedSecrets` that matches nothing. */
69
82
  allowed: AllowedSecret;
70
83
  }) & {
71
84
  /** The problem in one line, for a report. */
@@ -87,6 +100,7 @@ export type WorkerBundleReport = {
87
100
  ignoredAssets: number;
88
101
  /** How many findings of secrets the allow-list let through. */
89
102
  allowedSecrets: number;
103
+ /** What the check found. {@link checkWorkerBundle} throws when it finds any. */
90
104
  problems: WorkerBundleProblem[];
91
105
  };
92
106
  /** Thrown by {@link checkWorkerBundle} when it finds problems: they are in `report.problems`. */
@@ -24,7 +24,9 @@ export type WorkerFile = {
24
24
  };
25
25
  /** A module the Worker holds, and the bytes of code it renders there. */
26
26
  export type BundledModule = {
27
+ /** Its path relative to `cwd`, symlinks resolved, with `/` between segments. */
27
28
  path: string;
29
+ /** The bytes of generated code it renders in the file. */
28
30
  bytes: number;
29
31
  };
30
32
  /** A forbidden rule the Worker breaks, in one of its files. */
package/dist/secrets.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { type ModulePattern } from "./modules.js";
2
2
  /** The shape of a kind of secret, by the name reports give it. */
3
3
  export type SecretPattern = {
4
+ /** What reports call a value it matches: `Stripe secret key`. */
4
5
  name: string;
6
+ /** What the value looks like. It must not match an empty string. */
5
7
  pattern: RegExp;
6
8
  };
7
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivi-software/workers-bundle-check",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fails CI on what a Cloudflare Worker's build should not contain: a forbidden module or marker in the Worker, a source map its static assets would serve, or a value shaped like a secret",
5
5
  "keywords": [
6
6
  "cloudflare",