PermDock
CLI

bundle

Measure the client bundle per role and per shared part, in raw and gzip bytes.

permdock bundle size reports the size of clientBundle(policy), the module permdock gen --kind bundle writes and a snapshot written with omitStatic resolves against. Sizes are bytes of JSON.stringify(bundle).

Usage

permdock bundle size
permdock bundle size --budget 32768 --json
FlagMeaning
--policy <module>Module exporting the policy; default policy in the config
--budget <bytes>Bytes the bundle may weigh. Default budgets.bundle. Never a failure
--jsonPrint the report as JSON

The report lists conditions, the grant terms every role shares, and each other top-level part, then one row per role, largest first, with the total and the largest part. The generated module records the same total on the line under its header:

// @generated by permdock generate bundle@0.35.1 from policy.ts sha-256:…; do not edit
// clientBundle: 1840 bytes of JSON, 412 gzip

Budgets

budgets in permdock.config.ts sets a byte budget for the bundle, the snapshot and the token claim. permdock generate --check exits 1 and doctor reports PD132 when the policy is over one; both print the size, the budget and the largest part.

permdock.config.ts
export default defineConfig({
  policy: "./src/policy.ts",
  budgets: {
    bundle: 32_768,
    snapshot: { bytes: 65_536, memberships: 12 },
    claims: 1_024,
  },
});
KeyMeasures
bundleJSON.stringify(clientBundle(policy))
snapshot.bytesThe snapshot of the role with the most grants, as snapshot size measures it
snapshot.membershipsMemberships of that probe subject. Default 3
claimsThe memberships claim for snapshot.memberships memberships of one role each

The snapshot probe passes omitStatic when gen.kinds includes bundle, as the pages that render the generated bundle do.

Side effects

CommandEffects
permdock bundle sizeNone

Last updated on

On this page