Everything in this directory, plus the top-level vendor/ directory, is
independent of Astro. Together they are the future @basicrum/boomerang-core
package. Nothing here may import astro, Vite-specific syntax, or files
outside src/core/ and vendor/. A unit test enforces both directions of
that boundary.
| File | Role |
|---|---|
index.ts |
Public entry for build-time code. Adapters import only this. |
consent.ts |
Browser-safe entry: setConsent(). No Node imports. |
options.ts |
Validation and defaults for user options. |
bootstrap.ts |
Generates the inline classic head script. |
assets.ts |
Knows the Boomerang version, loader files and content hash (see the endpoint exception below). |
An adapter does three things:
normalizeOptions(userOptions)at configuration time so typos fail early.createInstallation(settings, { generator, base })to get the head script and the public path where the bundle must be served.- Serve the bundle bytes at that path with immutable caching.
src/boomerang-endpoint.ts names the bundle file literally in its ?raw
import, because Vite needs a static specifier. That is the one place outside
assets.ts that repeats the vendored file name; the unit test "the endpoint
serves the same bundle file the core catalogue names" keeps the two in sync.
Keep that test whenever the import moves.
The package name below is a placeholder; decide it first.
- Create the core package and move
src/core/andvendor/(includingprovenance.jsonand the Boomerang licence) into it, together with the Boomerang and loader sections ofTHIRD-PARTY-NOTICES.md. Give it anexportsmap with"."(dist/core/index.jsanddist/core/index.d.ts),"./consent"(dist/core/consent.jsanddist/core/consent.d.ts) and"./vendor/*", and afileslist withdist/,vendor/and the notices. Move the TypeScript build setup too; preserve or adjust the generated asset module's relative path tovendor/. - Move
tests/unit/core.test.jsandtools/verify-boomerang-provenance.shwith it; both referencevendor/andsrc/core/assets.ts. Copytests/unit/helpers/module-graph.jsandtools/verify-ascii.sh, which both packages need. - In this package, add the core package as an exact-pinned regular
dependency (not a peer dependency: sites must not have to install it) and
change the import sites:
src/index.ts:./core/index.jsbecomes the package name for both runtime and type imports and re-exports.src/client.ts:./core/consent.jsbecomes the package's/consentexport.src/boomerang-endpoint.ts: the?rawimport becomes the package's/vendor/boomerang/<file>?rawexport.
- Update the adapter tests in
tests/unit/integration.test.js: importBOOMERANG_BUNDLE_PATHandreadLoaderSourcefrom the package, make the boundary test accept the package specifiers instead of resolved local paths, and keep the endpoint synchronization check against the package'sBOOMERANG_BUNDLE_PATH. - Update
tools/verify-package.mjs(it imports the core for the expected asset name), dropvendorfrom this package'sfiles, remove the provenance script from theconventionsscript, and revise the package layout table inREADME.mdand the structure section inAGENTS.md. - Run
npm run verify:packageagainst the published core package before tagging: the packed consumer must still emit the bundle byte for byte.