From a9dda975424313ac2c4fd41fd54f7e67881925ba Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Sat, 27 Jun 2026 21:04:03 -0400 Subject: [PATCH] Add generic runtime-island package producer to php-transformer Adds RuntimeIslandPackageBuilder: a generic, product-neutral producer that projects compiled-site runtime-island metadata into an actionable carry-forward envelope (schema blocks-engine/php-transformer/runtime-island-package/v1). Per preserved island it carries a stable id, the verbatim source markup, the associated script assets (external src + scoped inline JS, resolved against the artifact), a generic enqueue handle hint, a preserve-vs-rebuild signal, and a role classification so telemetry/analytics scripts are dropped rather than carried. Wired into ArtifactCompiler::compile() alongside the existing runtime_islands report; emitted only when islands exist. Preserve-vs-rebuild (#224): runtime islands carry verbatim markup, so their JS may be carried verbatim (js_handling=preserve_verbatim). Transformed regions are not islands and never reach this package. Telemetry scripts get disposition=drop and per-script droppable=true. Upstream fix: inline " + } + }, + "expect_island": { + "kind": "script", + "select_by_role": "first_party", + "disposition": "preserve", + "js_handling": "preserve_verbatim", + "markup_fidelity": "verbatim", + "script_source_kind": "inline", + "script_role": "first_party", + "content_contains": "window.toggleApp()", + "droppable": false + } + }, + { + "name": "telemetry-external-script-dropped", + "artifact": { + "entrypoint": "index.html", + "files": { + "index.html": "

Home

" + } + }, + "expect_island": { + "kind": "script", + "select_by_role": "telemetry", + "disposition": "drop", + "js_handling": "drop", + "markup_fidelity": "verbatim", + "script_source_kind": "external", + "script_role": "telemetry", + "materialized": false, + "droppable": true + } + }, + { + "name": "canvas-island-external-and-inline-scripts", + "artifact": { + "entrypoint": "index.html", + "files": { + "index.html": "
fallback
", + "js/chart.js": "const c = document.getElementById(\"chart\").getContext(\"2d\"); c.strokeRect(0, 0, 5, 5);" + } + }, + "expect_island": { + "kind": "canvas", + "select_by_kind": "canvas", + "disposition": "preserve", + "js_handling": "preserve_verbatim", + "markup_fidelity": "verbatim", + "markup_contains": "