SaaSAudit: how to rebuild the consent script from this source
======================================================================

This folder holds the unminified source of the consent script that the plugin
bundles: cmp.js and the chunk files in c/ (and assets/revisit-icon.svg, copied
as is). It is the whole input of the build: nothing here points outside this
folder, and no node_modules are included.

  cmp-loader/     the script's TypeScript (src/), its service descriptions
                  (services/), the build scripts and the rollup configs
  shared/src/     the catalogs of known services and trackers the script imports
                  (cmp-loader/src reaches them as ../../shared/src)
  tsconfig.base.json

Needs Node.js 22 (LTS) and npm.

  cd source/cmp-loader
  npm ci
  GITHUB_SHA=<the build id> CMP_API_BASE_URL=https://consent.saasaudit.ai npm run build

The build id is the commit this release was built from; the plugin names it in
SAASAUDIT_BUNDLED_LOADER in rules.php (the first seven characters are what the
script contains). Use any 40-character hexadecimal value that starts with those
seven to get the same bytes.

What `npm run build` does, in order:

  1. rollup -c rollup.chunks.config.mjs   builds the lazily loaded chunks
                                          (prefs and info) into dist/c/
  2. node scripts/hash-chunks.mjs dist/c  names each chunk by a hash of its
                                          contents (c/prefs.<hash>.js) and writes
                                          dist/c/chunks.json, the list of names
                                          and integrity hashes
  3. rollup -c                            builds the main script, cmp.js, which
                                          embeds that list so it can load the
                                          chunks (scripts/minify-css.mjs shrinks
                                          the CSS in its templates)
  4. node scripts/generate-manifest.js    writes dist/cmp.manifest.json, and
     node scripts/check-size.js           the size check (both by-products)

Output, in source/cmp-loader/dist/:

  cmp.js     ->  the plugin's cmp.js
  c/*.js     ->  the plugin's c/*.js

With the same build id and API address the files are identical to the ones in
the plugin, byte for byte. (The other files in dist/ are build by-products.)
